@itwin/core-frontend 4.0.0-dev.1 → 4.0.0-dev.4
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/lib/cjs/IModelApp.d.ts +1 -0
- package/lib/cjs/IModelApp.d.ts.map +1 -1
- package/lib/cjs/IModelApp.js +2 -4
- package/lib/cjs/IModelApp.js.map +1 -1
- package/lib/cjs/SubCategoriesCache.d.ts.map +1 -1
- package/lib/cjs/SubCategoriesCache.js +0 -1
- package/lib/cjs/SubCategoriesCache.js.map +1 -1
- package/lib/cjs/render/RealityMeshParams.d.ts +4 -1
- package/lib/cjs/render/RealityMeshParams.d.ts.map +1 -1
- package/lib/cjs/render/RealityMeshParams.js +14 -4
- package/lib/cjs/render/RealityMeshParams.js.map +1 -1
- package/lib/cjs/render/RenderSystem.d.ts +5 -16
- package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
- package/lib/cjs/render/RenderSystem.js +0 -6
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/ScreenSpaceEffectBuilder.d.ts +3 -4
- package/lib/cjs/render/ScreenSpaceEffectBuilder.d.ts.map +1 -1
- package/lib/cjs/render/ScreenSpaceEffectBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/AttributeBuffers.d.ts +9 -79
- package/lib/cjs/render/webgl/AttributeBuffers.d.ts.map +1 -1
- package/lib/cjs/render/webgl/AttributeBuffers.js +19 -152
- package/lib/cjs/render/webgl/AttributeBuffers.js.map +1 -1
- package/lib/cjs/render/webgl/BackgroundMapDrape.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BackgroundMapDrape.js +0 -3
- package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.js +0 -8
- package/lib/cjs/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/ClipStack.d.ts +0 -1
- package/lib/cjs/render/webgl/ClipStack.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ClipStack.js +2 -6
- package/lib/cjs/render/webgl/ClipStack.js.map +1 -1
- package/lib/cjs/render/webgl/ClipVolume.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ClipVolume.js +1 -5
- package/lib/cjs/render/webgl/ClipVolume.js.map +1 -1
- package/lib/cjs/render/webgl/ClippingProgram.d.ts +3 -2
- package/lib/cjs/render/webgl/ClippingProgram.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ClippingProgram.js +10 -37
- package/lib/cjs/render/webgl/ClippingProgram.js.map +1 -1
- package/lib/cjs/render/webgl/DrawCommand.d.ts +2 -2
- package/lib/cjs/render/webgl/DrawCommand.d.ts.map +1 -1
- package/lib/cjs/render/webgl/DrawCommand.js +1 -1
- package/lib/cjs/render/webgl/DrawCommand.js.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/render/webgl/FloatRGBA.d.ts.map +1 -1
- package/lib/cjs/render/webgl/FloatRGBA.js +0 -4
- package/lib/cjs/render/webgl/FloatRGBA.js.map +1 -1
- package/lib/cjs/render/webgl/FrameBuffer.js.map +1 -1
- package/lib/cjs/render/webgl/GLTimer.d.ts.map +1 -1
- package/lib/cjs/render/webgl/GLTimer.js +2 -35
- package/lib/cjs/render/webgl/GLTimer.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +13 -71
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/PointCloud.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PointCloud.js +1 -3
- package/lib/cjs/render/webgl/PointCloud.js.map +1 -1
- package/lib/cjs/render/webgl/RenderBuffer.d.ts +1 -1
- package/lib/cjs/render/webgl/RenderBuffer.d.ts.map +1 -1
- package/lib/cjs/render/webgl/RenderBuffer.js +2 -3
- package/lib/cjs/render/webgl/RenderBuffer.js.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.d.ts +1 -2
- package/lib/cjs/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.js +4 -6
- package/lib/cjs/render/webgl/RenderFlags.js.map +1 -1
- package/lib/cjs/render/webgl/SceneCompositor.d.ts +0 -2
- package/lib/cjs/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SceneCompositor.js +754 -1135
- package/lib/cjs/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/render/webgl/ScreenSpaceEffect.js +1 -1
- package/lib/cjs/render/webgl/ScreenSpaceEffect.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts +1 -2
- package/lib/cjs/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ShaderBuilder.js +13 -48
- package/lib/cjs/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/render/webgl/ShaderProgram.d.ts +1 -2
- package/lib/cjs/render/webgl/ShaderProgram.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ShaderProgram.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +6 -18
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +11 -10
- package/lib/cjs/render/webgl/System.d.ts.map +1 -1
- package/lib/cjs/render/webgl/System.js +40 -122
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Technique.d.ts +4 -5
- package/lib/cjs/render/webgl/Technique.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Technique.js +4 -28
- package/lib/cjs/render/webgl/Technique.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Texture.js +14 -18
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/render/webgl/ThematicSensors.d.ts +4 -3
- package/lib/cjs/render/webgl/ThematicSensors.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ThematicSensors.js +9 -50
- package/lib/cjs/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/cjs/render/webgl/ThematicUniforms.js +1 -1
- package/lib/cjs/render/webgl/ThematicUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/UniformHandle.d.ts.map +1 -1
- package/lib/cjs/render/webgl/UniformHandle.js +1 -4
- package/lib/cjs/render/webgl/UniformHandle.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/AmbientOcclusion.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/AmbientOcclusion.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js +1 -1
- package/lib/cjs/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/Animation.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Animation.js +23 -26
- package/lib/cjs/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Blur.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/Blur.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Blur.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/ClearPickAndColor.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/ClearPickAndColor.js +2 -9
- package/lib/cjs/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/ClearTranslucent.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/ClearTranslucent.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/ClearTranslucent.js +2 -10
- package/lib/cjs/render/webgl/glsl/ClearTranslucent.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Clipping.d.ts +1 -1
- package/lib/cjs/render/webgl/glsl/Clipping.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Clipping.js +5 -36
- package/lib/cjs/render/webgl/glsl/Clipping.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Combine3Textures.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/Combine3Textures.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Combine3Textures.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/CombineTextures.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/CombineTextures.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/CombineTextures.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Common.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Common.js +9 -55
- package/lib/cjs/render/webgl/glsl/Common.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Composite.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/Composite.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Composite.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyColor.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/CopyColor.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyColor.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyPickBuffers.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/CopyPickBuffers.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyPickBuffers.js +12 -19
- package/lib/cjs/render/webgl/glsl/CopyPickBuffers.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyStencil.d.ts +4 -7
- package/lib/cjs/render/webgl/glsl/CopyStencil.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/CopyStencil.js +2 -39
- package/lib/cjs/render/webgl/glsl/CopyStencil.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/EDL.d.ts +4 -5
- package/lib/cjs/render/webgl/glsl/EDL.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/EDL.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/EVSMFromDepth.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/EVSMFromDepth.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/EVSMFromDepth.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Edge.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Edge.js +2 -2
- package/lib/cjs/render/webgl/glsl/Edge.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +3 -24
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Fragment.d.ts +0 -7
- package/lib/cjs/render/webgl/glsl/Fragment.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Fragment.js +5 -40
- package/lib/cjs/render/webgl/glsl/Fragment.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Instancing.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Instancing.js +1 -5
- package/lib/cjs/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/LogarithmicDepthBuffer.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/LogarithmicDepthBuffer.js +0 -2
- package/lib/cjs/render/webgl/glsl/LogarithmicDepthBuffer.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarGrid.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/PlanarGrid.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarGrid.js +2 -12
- package/lib/cjs/render/webgl/glsl/PlanarGrid.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/RealityMesh.js +3 -8
- package/lib/cjs/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/SkyBox.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/SkyBox.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/SkyBox.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/SkySphere.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/SkySphere.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/SkySphere.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js +1 -1
- package/lib/cjs/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +33 -57
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.js +3 -36
- package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Translucency.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Translucency.js +2 -12
- package/lib/cjs/render/webgl/glsl/Translucency.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Vertex.d.ts +1 -2
- package/lib/cjs/render/webgl/glsl/Vertex.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Vertex.js +15 -78
- package/lib/cjs/render/webgl/glsl/Vertex.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Wiremesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Wiremesh.js +2 -5
- package/lib/cjs/render/webgl/glsl/Wiremesh.js.map +1 -1
- package/lib/cjs/tile/PrimaryTileTree.d.ts +0 -3
- package/lib/cjs/tile/PrimaryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/PrimaryTileTree.js +6 -28
- package/lib/cjs/tile/PrimaryTileTree.js.map +1 -1
- package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
- package/lib/cjs/tile/TileAdmin.js +2 -2
- package/lib/cjs/tile/TileAdmin.js.map +1 -1
- package/lib/esm/IModelApp.d.ts +1 -0
- package/lib/esm/IModelApp.d.ts.map +1 -1
- package/lib/esm/IModelApp.js +2 -4
- package/lib/esm/IModelApp.js.map +1 -1
- package/lib/esm/SubCategoriesCache.d.ts.map +1 -1
- package/lib/esm/SubCategoriesCache.js +0 -1
- package/lib/esm/SubCategoriesCache.js.map +1 -1
- package/lib/esm/render/RealityMeshParams.d.ts +4 -1
- package/lib/esm/render/RealityMeshParams.d.ts.map +1 -1
- package/lib/esm/render/RealityMeshParams.js +14 -4
- package/lib/esm/render/RealityMeshParams.js.map +1 -1
- package/lib/esm/render/RenderSystem.d.ts +5 -16
- package/lib/esm/render/RenderSystem.d.ts.map +1 -1
- package/lib/esm/render/RenderSystem.js +0 -6
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/ScreenSpaceEffectBuilder.d.ts +3 -4
- package/lib/esm/render/ScreenSpaceEffectBuilder.d.ts.map +1 -1
- package/lib/esm/render/ScreenSpaceEffectBuilder.js.map +1 -1
- package/lib/esm/render/webgl/AttributeBuffers.d.ts +9 -79
- package/lib/esm/render/webgl/AttributeBuffers.d.ts.map +1 -1
- package/lib/esm/render/webgl/AttributeBuffers.js +16 -144
- package/lib/esm/render/webgl/AttributeBuffers.js.map +1 -1
- package/lib/esm/render/webgl/BackgroundMapDrape.d.ts.map +1 -1
- package/lib/esm/render/webgl/BackgroundMapDrape.js +0 -3
- package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.js +0 -8
- package/lib/esm/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/esm/render/webgl/ClipStack.d.ts +0 -1
- package/lib/esm/render/webgl/ClipStack.d.ts.map +1 -1
- package/lib/esm/render/webgl/ClipStack.js +2 -6
- package/lib/esm/render/webgl/ClipStack.js.map +1 -1
- package/lib/esm/render/webgl/ClipVolume.d.ts.map +1 -1
- package/lib/esm/render/webgl/ClipVolume.js +1 -5
- package/lib/esm/render/webgl/ClipVolume.js.map +1 -1
- package/lib/esm/render/webgl/ClippingProgram.d.ts +3 -2
- package/lib/esm/render/webgl/ClippingProgram.d.ts.map +1 -1
- package/lib/esm/render/webgl/ClippingProgram.js +10 -37
- package/lib/esm/render/webgl/ClippingProgram.js.map +1 -1
- package/lib/esm/render/webgl/DrawCommand.d.ts +2 -2
- package/lib/esm/render/webgl/DrawCommand.d.ts.map +1 -1
- package/lib/esm/render/webgl/DrawCommand.js +1 -1
- package/lib/esm/render/webgl/DrawCommand.js.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/render/webgl/FloatRGBA.d.ts.map +1 -1
- package/lib/esm/render/webgl/FloatRGBA.js +0 -4
- package/lib/esm/render/webgl/FloatRGBA.js.map +1 -1
- package/lib/esm/render/webgl/FrameBuffer.js.map +1 -1
- package/lib/esm/render/webgl/GLTimer.d.ts.map +1 -1
- package/lib/esm/render/webgl/GLTimer.js +2 -35
- package/lib/esm/render/webgl/GLTimer.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +13 -71
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/PointCloud.d.ts.map +1 -1
- package/lib/esm/render/webgl/PointCloud.js +1 -3
- package/lib/esm/render/webgl/PointCloud.js.map +1 -1
- package/lib/esm/render/webgl/RenderBuffer.d.ts +1 -1
- package/lib/esm/render/webgl/RenderBuffer.d.ts.map +1 -1
- package/lib/esm/render/webgl/RenderBuffer.js +2 -3
- package/lib/esm/render/webgl/RenderBuffer.js.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.d.ts +1 -2
- package/lib/esm/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.js +4 -6
- package/lib/esm/render/webgl/RenderFlags.js.map +1 -1
- package/lib/esm/render/webgl/SceneCompositor.d.ts +0 -2
- package/lib/esm/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/esm/render/webgl/SceneCompositor.js +756 -1137
- package/lib/esm/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/render/webgl/ScreenSpaceEffect.js +1 -1
- package/lib/esm/render/webgl/ScreenSpaceEffect.js.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.d.ts +1 -2
- package/lib/esm/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/esm/render/webgl/ShaderBuilder.js +13 -48
- package/lib/esm/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/render/webgl/ShaderProgram.d.ts +1 -2
- package/lib/esm/render/webgl/ShaderProgram.d.ts.map +1 -1
- package/lib/esm/render/webgl/ShaderProgram.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.d.ts.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +6 -18
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +11 -10
- package/lib/esm/render/webgl/System.d.ts.map +1 -1
- package/lib/esm/render/webgl/System.js +42 -124
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Technique.d.ts +4 -5
- package/lib/esm/render/webgl/Technique.d.ts.map +1 -1
- package/lib/esm/render/webgl/Technique.js +5 -29
- package/lib/esm/render/webgl/Technique.js.map +1 -1
- package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
- package/lib/esm/render/webgl/Texture.js +14 -18
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/render/webgl/ThematicSensors.d.ts +4 -3
- package/lib/esm/render/webgl/ThematicSensors.d.ts.map +1 -1
- package/lib/esm/render/webgl/ThematicSensors.js +9 -50
- package/lib/esm/render/webgl/ThematicSensors.js.map +1 -1
- package/lib/esm/render/webgl/ThematicUniforms.js +1 -1
- package/lib/esm/render/webgl/ThematicUniforms.js.map +1 -1
- package/lib/esm/render/webgl/UniformHandle.d.ts.map +1 -1
- package/lib/esm/render/webgl/UniformHandle.js +1 -4
- package/lib/esm/render/webgl/UniformHandle.js.map +1 -1
- package/lib/esm/render/webgl/glsl/AmbientOcclusion.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/AmbientOcclusion.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/AmbientOcclusion.js +1 -1
- package/lib/esm/render/webgl/glsl/AmbientOcclusion.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/Animation.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Animation.js +23 -26
- package/lib/esm/render/webgl/glsl/Animation.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Blur.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/Blur.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Blur.js.map +1 -1
- package/lib/esm/render/webgl/glsl/ClearPickAndColor.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/ClearPickAndColor.js +2 -9
- package/lib/esm/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
- package/lib/esm/render/webgl/glsl/ClearTranslucent.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/ClearTranslucent.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/ClearTranslucent.js +2 -10
- package/lib/esm/render/webgl/glsl/ClearTranslucent.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Clipping.d.ts +1 -1
- package/lib/esm/render/webgl/glsl/Clipping.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Clipping.js +5 -36
- package/lib/esm/render/webgl/glsl/Clipping.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Combine3Textures.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/Combine3Textures.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Combine3Textures.js.map +1 -1
- package/lib/esm/render/webgl/glsl/CombineTextures.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/CombineTextures.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/CombineTextures.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Common.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Common.js +9 -55
- package/lib/esm/render/webgl/glsl/Common.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Composite.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/Composite.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Composite.js.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyColor.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/CopyColor.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyColor.js.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyPickBuffers.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/CopyPickBuffers.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyPickBuffers.js +12 -19
- package/lib/esm/render/webgl/glsl/CopyPickBuffers.js.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyStencil.d.ts +4 -7
- package/lib/esm/render/webgl/glsl/CopyStencil.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/CopyStencil.js +1 -37
- package/lib/esm/render/webgl/glsl/CopyStencil.js.map +1 -1
- package/lib/esm/render/webgl/glsl/EDL.d.ts +4 -5
- package/lib/esm/render/webgl/glsl/EDL.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/EDL.js.map +1 -1
- package/lib/esm/render/webgl/glsl/EVSMFromDepth.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/EVSMFromDepth.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/EVSMFromDepth.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Edge.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Edge.js +2 -2
- package/lib/esm/render/webgl/glsl/Edge.js.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +3 -24
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Fragment.d.ts +0 -7
- package/lib/esm/render/webgl/glsl/Fragment.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Fragment.js +4 -38
- package/lib/esm/render/webgl/glsl/Fragment.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Instancing.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Instancing.js +1 -5
- package/lib/esm/render/webgl/glsl/Instancing.js.map +1 -1
- package/lib/esm/render/webgl/glsl/LogarithmicDepthBuffer.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/LogarithmicDepthBuffer.js +0 -2
- package/lib/esm/render/webgl/glsl/LogarithmicDepthBuffer.js.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarGrid.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/PlanarGrid.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarGrid.js +2 -12
- package/lib/esm/render/webgl/glsl/PlanarGrid.js.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/RealityMesh.js +3 -8
- package/lib/esm/render/webgl/glsl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/glsl/SkyBox.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/SkyBox.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/SkyBox.js.map +1 -1
- package/lib/esm/render/webgl/glsl/SkySphere.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/SkySphere.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/SkySphere.js.map +1 -1
- package/lib/esm/render/webgl/glsl/SolarShadowMapping.js +1 -1
- package/lib/esm/render/webgl/glsl/SolarShadowMapping.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +33 -57
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.js +3 -36
- package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Translucency.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Translucency.js +3 -13
- package/lib/esm/render/webgl/glsl/Translucency.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Vertex.d.ts +1 -2
- package/lib/esm/render/webgl/glsl/Vertex.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Vertex.js +16 -79
- package/lib/esm/render/webgl/glsl/Vertex.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Wiremesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Wiremesh.js +2 -5
- package/lib/esm/render/webgl/glsl/Wiremesh.js.map +1 -1
- package/lib/esm/tile/PrimaryTileTree.d.ts +0 -3
- package/lib/esm/tile/PrimaryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/PrimaryTileTree.js +8 -30
- package/lib/esm/tile/PrimaryTileTree.js.map +1 -1
- package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
- package/lib/esm/tile/TileAdmin.js +2 -2
- package/lib/esm/tile/TileAdmin.js.map +1 -1
- package/package.json +20 -20
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
import { assert, dispose } from "@itwin/core-bentley";
|
|
9
9
|
import { Transform, Vector2d, Vector3d } from "@itwin/core-geometry";
|
|
10
10
|
import { RenderMode, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, } from "@itwin/core-common";
|
|
11
|
-
import {
|
|
11
|
+
import { RenderType } from "@itwin/webgl-compatibility";
|
|
12
12
|
import { Pixel } from "../Pixel";
|
|
13
13
|
import { BranchState } from "./BranchState";
|
|
14
|
-
import { AmbientOcclusionGeometry, BlurGeometry, BlurType, BoundaryType, CompositeGeometry, CopyPickBufferGeometry,
|
|
14
|
+
import { AmbientOcclusionGeometry, BlurGeometry, BlurType, BoundaryType, CompositeGeometry, CopyPickBufferGeometry, SingleTexturedViewportQuadGeometry, ViewportQuadGeometry, VolumeClassifierGeometry, } from "./CachedGeometry";
|
|
15
15
|
import { Debug } from "./Diagnostics";
|
|
16
16
|
import { extractFlashedVolumeClassifierCommands, extractHilitedVolumeClassifierCommands } from "./DrawCommand";
|
|
17
|
-
import { FloatRgba } from "./FloatRGBA";
|
|
18
17
|
import { FrameBuffer } from "./FrameBuffer";
|
|
19
18
|
import { GL } from "./GL";
|
|
20
19
|
import { IModelFrameLifecycle } from "./IModelFrameLifecycle";
|
|
@@ -97,23 +96,14 @@ class Textures {
|
|
|
97
96
|
init(width, height, numSamples) {
|
|
98
97
|
assert(undefined === this.accumulation);
|
|
99
98
|
let pixelDataType = GL.Texture.DataType.UnsignedByte;
|
|
100
|
-
switch (System.instance.
|
|
99
|
+
switch (System.instance.maxRenderType) {
|
|
101
100
|
case RenderType.TextureFloat: {
|
|
102
101
|
pixelDataType = GL.Texture.DataType.Float;
|
|
103
102
|
break;
|
|
104
103
|
}
|
|
105
104
|
case RenderType.TextureHalfFloat: {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
const ext = System.instance.capabilities.queryExtensionObject("OES_texture_half_float");
|
|
112
|
-
if (undefined !== ext) {
|
|
113
|
-
pixelDataType = ext.HALF_FLOAT_OES;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
105
|
+
pixelDataType = System.instance.context.HALF_FLOAT;
|
|
106
|
+
break;
|
|
117
107
|
}
|
|
118
108
|
/* falls through */
|
|
119
109
|
case RenderType.TextureUnsignedByte: {
|
|
@@ -203,9 +193,25 @@ class FrameBuffers {
|
|
|
203
193
|
this.depthAndOrder = FrameBuffer.create([textures.depthAndOrder], depth);
|
|
204
194
|
this.hilite = FrameBuffer.create([textures.hilite], depth);
|
|
205
195
|
this.hiliteUsingStencil = FrameBuffer.create([textures.hilite], depth);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
196
|
+
if (!this.depthAndOrder || !this.hilite || !this.hiliteUsingStencil)
|
|
197
|
+
return false;
|
|
198
|
+
assert(undefined === this.opaqueAll);
|
|
199
|
+
if (!this.initPotentialMSMRTFbos(textures, depth, depthMS))
|
|
200
|
+
return false;
|
|
201
|
+
assert(undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
202
|
+
const colors = [textures.accumulation, textures.revealage];
|
|
203
|
+
this.translucent = FrameBuffer.create(colors, depth);
|
|
204
|
+
this.clearTranslucent = FrameBuffer.create(colors);
|
|
205
|
+
// We borrow the SceneCompositor's accum and revealage textures for the surface pass.
|
|
206
|
+
// First we render edges, writing to our textures.
|
|
207
|
+
// Then we copy our textures to borrowed textures.
|
|
208
|
+
// Finally we render surfaces, writing to our textures and reading from borrowed textures.
|
|
209
|
+
assert(undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
210
|
+
const pingPong = [textures.accumulation, textures.revealage];
|
|
211
|
+
this.pingPong = FrameBuffer.create(pingPong);
|
|
212
|
+
return undefined !== this.translucent
|
|
213
|
+
&& undefined !== this.clearTranslucent
|
|
214
|
+
&& undefined !== this.pingPong;
|
|
209
215
|
}
|
|
210
216
|
initPotentialMSFbos(textures, depth, depthMS) {
|
|
211
217
|
const boundColor = System.instance.frameBufferStack.currentColorBuffer;
|
|
@@ -222,19 +228,69 @@ class FrameBuffers {
|
|
|
222
228
|
return undefined !== this.opaqueColor
|
|
223
229
|
&& undefined !== this.opaqueAndCompositeColor;
|
|
224
230
|
}
|
|
225
|
-
|
|
231
|
+
initPotentialMSMRTFbos(textures, depth, depthMs) {
|
|
232
|
+
const boundColor = System.instance.frameBufferStack.currentColorBuffer;
|
|
233
|
+
assert(undefined !== boundColor && undefined !== textures.color && undefined !== textures.featureId && undefined !== textures.depthAndOrder && undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
234
|
+
const colorAndPick = [boundColor, textures.featureId, textures.depthAndOrder];
|
|
235
|
+
if (undefined === depthMs) {
|
|
236
|
+
this.opaqueAll = FrameBuffer.create(colorAndPick, depth);
|
|
237
|
+
colorAndPick[0] = textures.color;
|
|
238
|
+
this.opaqueAndCompositeAll = FrameBuffer.create(colorAndPick, depth);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
assert(undefined !== textures.colorMsBuff && undefined !== textures.featureIdMsBuff && undefined !== textures.featureIdMsBuffHidden && undefined !== textures.depthAndOrderMsBuff && undefined !== textures.depthAndOrderMsBuffHidden);
|
|
242
|
+
const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff];
|
|
243
|
+
const colorAndPickFilters = [GL.MultiSampling.Filter.Linear, GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
244
|
+
this.opaqueAll = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
245
|
+
colorAndPick[0] = textures.color;
|
|
246
|
+
this.opaqueAndCompositeAll = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
247
|
+
}
|
|
248
|
+
return undefined !== this.opaqueAll
|
|
249
|
+
&& undefined !== this.opaqueAndCompositeAll;
|
|
250
|
+
}
|
|
251
|
+
enableOcclusion(textures, depth, depthMs) {
|
|
226
252
|
assert(undefined !== textures.occlusion && undefined !== textures.occlusionBlur);
|
|
227
253
|
this.occlusion = FrameBuffer.create([textures.occlusion]);
|
|
228
254
|
this.occlusionBlur = FrameBuffer.create([textures.occlusionBlur]);
|
|
229
|
-
|
|
255
|
+
let rVal = undefined !== this.occlusion && undefined !== this.occlusionBlur;
|
|
256
|
+
if (undefined === depthMs) {
|
|
257
|
+
// If not using multisampling then we can use the accumulation and revealage textures for the hidden pick buffers,
|
|
258
|
+
assert(undefined !== textures.color && undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
259
|
+
const colorAndPick = [textures.color, textures.accumulation, textures.revealage];
|
|
260
|
+
this.opaqueAndCompositeAllHidden = FrameBuffer.create(colorAndPick, depth);
|
|
261
|
+
rVal = rVal && undefined !== this.opaqueAndCompositeAllHidden;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
// If multisampling then we cannot use the revealage texture for depthAndOrder for the hidden edges since it is of the wrong type for blitting,
|
|
265
|
+
// so instead use a special depthAndOrderHidden texture just for this purpose.
|
|
266
|
+
// The featureId texture is not needed for hidden edges, so the accumulation texture can be used for it if we don't blit from the multisample bufffer into it.
|
|
267
|
+
assert(undefined !== textures.color && undefined !== textures.accumulation && undefined !== textures.depthAndOrderHidden);
|
|
268
|
+
assert(undefined !== textures.colorMsBuff && undefined !== textures.featureIdMsBuffHidden && undefined !== textures.depthAndOrderMsBuffHidden);
|
|
269
|
+
const colorAndPick = [textures.color, textures.accumulation, textures.depthAndOrderHidden];
|
|
270
|
+
const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuffHidden, textures.depthAndOrderMsBuffHidden];
|
|
271
|
+
const colorAndPickFilters = [GL.MultiSampling.Filter.Linear, GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
272
|
+
this.opaqueAndCompositeAllHidden = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
273
|
+
// We will also need a frame buffer for copying the real pick data buffers into these hidden edge pick data buffers.
|
|
274
|
+
const pingPong = [textures.accumulation, textures.depthAndOrderHidden];
|
|
275
|
+
const pingPongMSBuffs = [textures.featureIdMsBuffHidden, textures.depthAndOrderMsBuffHidden];
|
|
276
|
+
const pingPongFilters = [GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
277
|
+
this.pingPongMS = FrameBuffer.create(pingPong, depth, pingPongMSBuffs, pingPongFilters, depthMs);
|
|
278
|
+
rVal = rVal && undefined !== this.opaqueAndCompositeAllHidden && (undefined === depthMs || undefined !== this.pingPongMS);
|
|
279
|
+
}
|
|
280
|
+
return rVal;
|
|
230
281
|
}
|
|
231
282
|
disableOcclusion() {
|
|
232
283
|
if (undefined !== this.occlusion) {
|
|
233
284
|
this.occlusion = dispose(this.occlusion);
|
|
234
285
|
this.occlusionBlur = dispose(this.occlusionBlur);
|
|
235
286
|
}
|
|
287
|
+
this.opaqueAndCompositeAllHidden = dispose(this.opaqueAndCompositeAllHidden);
|
|
288
|
+
this.pingPongMS = dispose(this.pingPongMS);
|
|
236
289
|
}
|
|
237
290
|
enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
291
|
+
const boundColor = System.instance.frameBufferStack.currentColorBuffer;
|
|
292
|
+
if (undefined === boundColor)
|
|
293
|
+
return;
|
|
238
294
|
if (undefined === this.stencilSet) {
|
|
239
295
|
if (undefined !== depthMS) { // if multisampling use the multisampled depth everywhere
|
|
240
296
|
this.stencilSet = FrameBuffer.create([], depth, [], [], depthMS);
|
|
@@ -249,6 +305,16 @@ class FrameBuffers {
|
|
|
249
305
|
this.volClassCreateBlendAltZ = FrameBuffer.create([textures.volClassBlend], volClassDepth);
|
|
250
306
|
}
|
|
251
307
|
}
|
|
308
|
+
if (undefined !== this.opaqueAll && undefined !== this.opaqueAndCompositeAll) {
|
|
309
|
+
if (undefined !== volClassDepth) {
|
|
310
|
+
let ids = [this.opaqueAll.getColor(0), this.opaqueAll.getColor(1)];
|
|
311
|
+
this.idsAndZ = FrameBuffer.create(ids, depth);
|
|
312
|
+
this.idsAndAltZ = FrameBuffer.create(ids, volClassDepth);
|
|
313
|
+
ids = [this.opaqueAndCompositeAll.getColor(0), this.opaqueAndCompositeAll.getColor(1)];
|
|
314
|
+
this.idsAndZComposite = FrameBuffer.create(ids, depth);
|
|
315
|
+
this.idsAndAltZComposite = FrameBuffer.create(ids, volClassDepth);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
252
318
|
}
|
|
253
319
|
disableVolumeClassifier() {
|
|
254
320
|
if (undefined !== this.stencilSet) {
|
|
@@ -257,29 +323,40 @@ class FrameBuffers {
|
|
|
257
323
|
this.volClassCreateBlend = dispose(this.volClassCreateBlend);
|
|
258
324
|
this.volClassCreateBlendAltZ = dispose(this.volClassCreateBlendAltZ);
|
|
259
325
|
}
|
|
326
|
+
if (undefined !== this.idsAndZ) {
|
|
327
|
+
this.idsAndZ = dispose(this.idsAndZ);
|
|
328
|
+
this.idsAndAltZ = dispose(this.idsAndAltZ);
|
|
329
|
+
this.idsAndZComposite = dispose(this.idsAndZComposite);
|
|
330
|
+
this.idsAndAltZComposite = dispose(this.idsAndAltZComposite);
|
|
331
|
+
}
|
|
260
332
|
}
|
|
261
333
|
enableMultiSampling(textures, depth, depthMS) {
|
|
262
334
|
this.opaqueColor = dispose(this.opaqueColor);
|
|
263
335
|
this.opaqueAndCompositeColor = dispose(this.opaqueAndCompositeColor);
|
|
264
|
-
|
|
336
|
+
let rVal = this.initPotentialMSFbos(textures, depth, depthMS);
|
|
337
|
+
this.opaqueAll = dispose(this.opaqueAll);
|
|
338
|
+
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
339
|
+
rVal = this.initPotentialMSMRTFbos(textures, depth, depthMS);
|
|
340
|
+
return rVal;
|
|
265
341
|
}
|
|
266
342
|
disableMultiSampling(textures, depth) {
|
|
343
|
+
this.opaqueAll = dispose(this.opaqueAll);
|
|
344
|
+
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
345
|
+
if (!this.initPotentialMSMRTFbos(textures, depth, undefined))
|
|
346
|
+
return false;
|
|
267
347
|
this.opaqueColor = dispose(this.opaqueColor);
|
|
268
348
|
this.opaqueAndCompositeColor = dispose(this.opaqueAndCompositeColor);
|
|
269
349
|
return this.initPotentialMSFbos(textures, depth, undefined);
|
|
270
350
|
}
|
|
271
351
|
get isDisposed() {
|
|
272
|
-
return undefined === this.opaqueColor
|
|
273
|
-
&& undefined === this.
|
|
274
|
-
&& undefined === this.
|
|
275
|
-
&& undefined === this.
|
|
276
|
-
&& undefined === this.
|
|
277
|
-
&& undefined === this.
|
|
278
|
-
&& undefined === this.
|
|
279
|
-
&& undefined === this.
|
|
280
|
-
&& undefined === this.altZOnly
|
|
281
|
-
&& undefined === this.volClassCreateBlend
|
|
282
|
-
&& undefined === this.volClassCreateBlendAltZ;
|
|
352
|
+
return undefined === this.opaqueColor && undefined === this.opaqueAndCompositeColor && undefined === this.depthAndOrder
|
|
353
|
+
&& undefined === this.hilite && undefined === this.hiliteUsingStencil && undefined === this.occlusion
|
|
354
|
+
&& undefined === this.occlusionBlur && undefined === this.stencilSet && undefined === this.altZOnly
|
|
355
|
+
&& undefined === this.volClassCreateBlend && undefined === this.volClassCreateBlendAltZ && undefined === this.opaqueAll
|
|
356
|
+
&& undefined === this.opaqueAndCompositeAll && undefined === this.opaqueAndCompositeAllHidden && undefined === this.pingPong
|
|
357
|
+
&& undefined === this.pingPongMS && undefined === this.translucent && undefined === this.clearTranslucent
|
|
358
|
+
&& undefined === this.idsAndZ && undefined === this.idsAndAltZ && undefined === this.idsAndZComposite
|
|
359
|
+
&& undefined === this.idsAndAltZComposite && undefined === this.edlDrawCol;
|
|
283
360
|
}
|
|
284
361
|
dispose() {
|
|
285
362
|
this.opaqueColor = dispose(this.opaqueColor);
|
|
@@ -293,6 +370,18 @@ class FrameBuffers {
|
|
|
293
370
|
this.altZOnly = dispose(this.altZOnly);
|
|
294
371
|
this.volClassCreateBlend = dispose(this.volClassCreateBlend);
|
|
295
372
|
this.volClassCreateBlendAltZ = dispose(this.volClassCreateBlendAltZ);
|
|
373
|
+
this.opaqueAll = dispose(this.opaqueAll);
|
|
374
|
+
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
375
|
+
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAllHidden);
|
|
376
|
+
this.pingPong = dispose(this.pingPong);
|
|
377
|
+
this.pingPongMS = dispose(this.pingPongMS);
|
|
378
|
+
this.translucent = dispose(this.translucent);
|
|
379
|
+
this.clearTranslucent = dispose(this.clearTranslucent);
|
|
380
|
+
this.idsAndZ = dispose(this.idsAndZ);
|
|
381
|
+
this.idsAndAltZ = dispose(this.idsAndAltZ);
|
|
382
|
+
this.idsAndZComposite = dispose(this.idsAndZComposite);
|
|
383
|
+
this.idsAndAltZComposite = dispose(this.idsAndAltZComposite);
|
|
384
|
+
this.edlDrawCol = dispose(this.edlDrawCol);
|
|
296
385
|
}
|
|
297
386
|
}
|
|
298
387
|
export function collectGeometryStatistics(geom, stats) {
|
|
@@ -305,17 +394,25 @@ class Geometry {
|
|
|
305
394
|
collectGeometryStatistics(this.composite, stats);
|
|
306
395
|
collectGeometryStatistics(this.volClassColorStencil, stats);
|
|
307
396
|
collectGeometryStatistics(this.volClassCopyZ, stats);
|
|
308
|
-
collectGeometryStatistics(this.volClassCopyZWithPoints, stats);
|
|
309
397
|
collectGeometryStatistics(this.volClassSetBlend, stats);
|
|
310
398
|
collectGeometryStatistics(this.volClassBlend, stats);
|
|
311
399
|
collectGeometryStatistics(this.occlusion, stats);
|
|
312
400
|
collectGeometryStatistics(this.occlusionXBlur, stats);
|
|
313
401
|
collectGeometryStatistics(this.occlusionYBlur, stats);
|
|
402
|
+
collectGeometryStatistics(this.copyPickBuffers, stats);
|
|
403
|
+
collectGeometryStatistics(this.clearTranslucent, stats);
|
|
404
|
+
collectGeometryStatistics(this.clearPickAndColor, stats);
|
|
314
405
|
}
|
|
315
406
|
init(textures) {
|
|
316
407
|
assert(undefined === this.composite);
|
|
317
408
|
this.composite = CompositeGeometry.createGeometry(textures.color.getHandle(), textures.accumulation.getHandle(), textures.revealage.getHandle(), textures.hilite.getHandle());
|
|
318
|
-
|
|
409
|
+
if (undefined === this.composite)
|
|
410
|
+
return false;
|
|
411
|
+
assert(undefined === this.copyPickBuffers);
|
|
412
|
+
this.copyPickBuffers = CopyPickBufferGeometry.createGeometry(textures.featureId.getHandle(), textures.depthAndOrder.getHandle());
|
|
413
|
+
this.clearTranslucent = ViewportQuadGeometry.create(16 /* OITClearTranslucent */);
|
|
414
|
+
this.clearPickAndColor = ViewportQuadGeometry.create(21 /* ClearPickAndColor */);
|
|
415
|
+
return undefined !== this.copyPickBuffers && undefined !== this.clearTranslucent && undefined !== this.clearPickAndColor;
|
|
319
416
|
}
|
|
320
417
|
enableOcclusion(textures, depth) {
|
|
321
418
|
var _a;
|
|
@@ -332,16 +429,13 @@ class Geometry {
|
|
|
332
429
|
this.occlusionXBlur = dispose(this.occlusionXBlur);
|
|
333
430
|
this.occlusionYBlur = dispose(this.occlusionYBlur);
|
|
334
431
|
}
|
|
335
|
-
enableVolumeClassifier(textures, depth
|
|
432
|
+
enableVolumeClassifier(textures, depth) {
|
|
336
433
|
assert(undefined === this.volClassColorStencil && undefined === this.volClassCopyZ && undefined === this.volClassSetBlend && undefined === this.volClassBlend);
|
|
337
434
|
this.volClassColorStencil = ViewportQuadGeometry.create(20 /* VolClassColorUsingStencil */);
|
|
338
435
|
this.volClassCopyZ = SingleTexturedViewportQuadGeometry.createGeometry(depth.getHandle(), 31 /* VolClassCopyZ */);
|
|
339
436
|
this.volClassSetBlend = VolumeClassifierGeometry.createVCGeometry(depth.getHandle());
|
|
340
437
|
this.volClassBlend = SingleTexturedViewportQuadGeometry.createGeometry(textures.volClassBlend.getHandle(), 33 /* VolClassBlend */);
|
|
341
|
-
|
|
342
|
-
this.volClassCopyZWithPoints = ScreenPointsGeometry.createGeometry(width, height, depth.getHandle());
|
|
343
|
-
return undefined !== this.volClassColorStencil && undefined !== this.volClassCopyZ && undefined !== this.volClassSetBlend && undefined !== this.volClassBlend
|
|
344
|
-
&& (System.instance.capabilities.supportsFragDepth || undefined !== this.volClassCopyZWithPoints);
|
|
438
|
+
return undefined !== this.volClassColorStencil && undefined !== this.volClassCopyZ && undefined !== this.volClassSetBlend && undefined !== this.volClassBlend;
|
|
345
439
|
}
|
|
346
440
|
disableVolumeClassifier() {
|
|
347
441
|
if (undefined !== this.volClassColorStencil) {
|
|
@@ -349,20 +443,13 @@ class Geometry {
|
|
|
349
443
|
this.volClassCopyZ = dispose(this.volClassCopyZ);
|
|
350
444
|
this.volClassSetBlend = dispose(this.volClassSetBlend);
|
|
351
445
|
this.volClassBlend = dispose(this.volClassBlend);
|
|
352
|
-
if (!System.instance.capabilities.supportsFragDepth)
|
|
353
|
-
this.volClassCopyZWithPoints = dispose(this.volClassCopyZWithPoints);
|
|
354
446
|
}
|
|
355
447
|
}
|
|
356
448
|
get isDisposed() {
|
|
357
|
-
return undefined === this.composite
|
|
358
|
-
&& undefined === this.
|
|
359
|
-
&& undefined === this.
|
|
360
|
-
&& undefined === this.
|
|
361
|
-
&& undefined === this.volClassColorStencil
|
|
362
|
-
&& undefined === this.volClassCopyZ
|
|
363
|
-
&& undefined === this.volClassSetBlend
|
|
364
|
-
&& undefined === this.volClassBlend
|
|
365
|
-
&& undefined === this.volClassCopyZWithPoints;
|
|
449
|
+
return undefined === this.composite && undefined === this.occlusion && undefined === this.occlusionXBlur
|
|
450
|
+
&& undefined === this.occlusionYBlur && undefined === this.volClassColorStencil && undefined === this.volClassCopyZ
|
|
451
|
+
&& undefined === this.volClassSetBlend && undefined === this.volClassBlend && undefined === this.copyPickBuffers
|
|
452
|
+
&& undefined === this.clearTranslucent && undefined === this.clearPickAndColor;
|
|
366
453
|
}
|
|
367
454
|
dispose() {
|
|
368
455
|
this.composite = dispose(this.composite);
|
|
@@ -370,6 +457,9 @@ class Geometry {
|
|
|
370
457
|
this.occlusionXBlur = dispose(this.occlusionXBlur);
|
|
371
458
|
this.occlusionYBlur = dispose(this.occlusionYBlur);
|
|
372
459
|
this.disableVolumeClassifier();
|
|
460
|
+
this.copyPickBuffers = dispose(this.copyPickBuffers);
|
|
461
|
+
this.clearTranslucent = dispose(this.clearTranslucent);
|
|
462
|
+
this.clearPickAndColor = dispose(this.clearPickAndColor);
|
|
373
463
|
}
|
|
374
464
|
}
|
|
375
465
|
// Represents a view of data read from a region of the frame buffer.
|
|
@@ -522,7 +612,7 @@ export class SceneCompositor {
|
|
|
522
612
|
}
|
|
523
613
|
get needHiddenEdges() { return this._needHiddenEdges; }
|
|
524
614
|
static create(target) {
|
|
525
|
-
return
|
|
615
|
+
return new Compositor(target);
|
|
526
616
|
}
|
|
527
617
|
}
|
|
528
618
|
// This describes what types of primitives a compositor should draw. See the `drawPrimitive` method of Compositor.
|
|
@@ -534,7 +624,7 @@ var PrimitiveDrawState;
|
|
|
534
624
|
})(PrimitiveDrawState || (PrimitiveDrawState = {}));
|
|
535
625
|
// The actual base class. Specializations are provided based on whether or not multiple render targets are supported.
|
|
536
626
|
class Compositor extends SceneCompositor {
|
|
537
|
-
constructor(target
|
|
627
|
+
constructor(target) {
|
|
538
628
|
super(target);
|
|
539
629
|
this._width = -1;
|
|
540
630
|
this._height = -1;
|
|
@@ -553,8 +643,8 @@ class Compositor extends SceneCompositor {
|
|
|
553
643
|
this._antialiasSamples = 1;
|
|
554
644
|
this._viewProjectionMatrix = new Matrix4();
|
|
555
645
|
this._primitiveDrawState = PrimitiveDrawState.Both; // used by drawPrimitive to decide whether a primitive needs to be drawn.
|
|
556
|
-
this.
|
|
557
|
-
this._geom =
|
|
646
|
+
this._fbos = new FrameBuffers();
|
|
647
|
+
this._geom = new Geometry();
|
|
558
648
|
this._opaqueRenderState.flags.depthTest = true;
|
|
559
649
|
this._pointCloudRenderState.flags.depthTest = true;
|
|
560
650
|
this._translucentRenderState.flags.depthMask = false;
|
|
@@ -574,232 +664,499 @@ class Compositor extends SceneCompositor {
|
|
|
574
664
|
this._layerRenderState.depthFunc = GL.DepthFunc.Always;
|
|
575
665
|
this._layerRenderState.blend.setBlendFunc(GL.BlendFactor.One, GL.BlendFactor.OneMinusSrcAlpha);
|
|
576
666
|
}
|
|
667
|
+
get featureIds() { return this.getSamplerTexture(this._readPickDataFromPingPong ? 0 : 1); }
|
|
668
|
+
get depthAndOrder() { return this.getSamplerTexture(this._readPickDataFromPingPong ? 1 : 2); }
|
|
669
|
+
get _samplerFbo() { return this._readPickDataFromPingPong ? this._fbos.pingPong : this._fbos.opaqueAll; }
|
|
670
|
+
getSamplerTexture(index) { return this._samplerFbo.getColor(index); }
|
|
577
671
|
drawPrimitive(primitive, exec, outputsToPick) {
|
|
578
672
|
if ((outputsToPick && this._primitiveDrawState !== PrimitiveDrawState.NonPickable) ||
|
|
579
673
|
(!outputsToPick && this._primitiveDrawState !== PrimitiveDrawState.Pickable))
|
|
580
674
|
primitive.draw(exec);
|
|
581
675
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
enableVolumeClassifierFbos(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
585
|
-
this._frameBuffers.enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS);
|
|
586
|
-
}
|
|
587
|
-
disableVolumeClassifierFbos() { this._frameBuffers.disableVolumeClassifier(); }
|
|
588
|
-
/** This function generates a texture that contains ambient occlusion information to be applied later. */
|
|
589
|
-
renderAmbientOcclusion() {
|
|
676
|
+
clearOpaque(needComposite) {
|
|
677
|
+
const fbo = needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll;
|
|
590
678
|
const system = System.instance;
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
const params = getDrawParams(this.target, this._geom.
|
|
597
|
-
this.target.techniques.draw(params);
|
|
598
|
-
});
|
|
599
|
-
this.target.endPerfMetricRecord();
|
|
600
|
-
// Render the X-blurred ambient occlusion based on unblurred ambient occlusion
|
|
601
|
-
fbo = this._frameBuffers.occlusionBlur;
|
|
602
|
-
this.target.beginPerfMetricRecord("Blur AO X");
|
|
603
|
-
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
604
|
-
System.instance.applyRenderState(RenderState.defaults);
|
|
605
|
-
const params = getDrawParams(this.target, this._geom.occlusionXBlur);
|
|
606
|
-
this.target.techniques.draw(params);
|
|
607
|
-
});
|
|
608
|
-
this.target.endPerfMetricRecord();
|
|
609
|
-
// Render the Y-blurred ambient occlusion based on X-blurred ambient occlusion (render into original occlusion framebuffer)
|
|
610
|
-
fbo = this._frameBuffers.occlusion;
|
|
611
|
-
this.target.beginPerfMetricRecord("Blur AO Y");
|
|
612
|
-
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
613
|
-
System.instance.applyRenderState(RenderState.defaults);
|
|
614
|
-
const params = getDrawParams(this.target, this._geom.occlusionYBlur);
|
|
679
|
+
system.frameBufferStack.execute(fbo, true, this.useMsBuffers, () => {
|
|
680
|
+
// Clear pick data buffers to 0's and color buffer to background color
|
|
681
|
+
// (0,0,0,0) in elementID0 and ElementID1 buffers indicates invalid element id
|
|
682
|
+
// (0,0,0,0) in DepthAndOrder buffer indicates render order 0 and encoded depth of 0 (= far plane)
|
|
683
|
+
system.applyRenderState(this._noDepthMaskRenderState);
|
|
684
|
+
const params = getDrawParams(this.target, this._geom.clearPickAndColor);
|
|
615
685
|
this.target.techniques.draw(params);
|
|
686
|
+
// Clear depth buffer
|
|
687
|
+
system.applyRenderState(RenderState.defaults); // depthMask == true.
|
|
688
|
+
system.context.clearDepth(1.0);
|
|
689
|
+
system.context.clear(GL.BufferBit.Depth);
|
|
616
690
|
});
|
|
617
|
-
this.target.endPerfMetricRecord();
|
|
618
691
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
692
|
+
renderLayers(commands, needComposite, pass) {
|
|
693
|
+
const fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
|
|
694
|
+
const useMsBuffers = 1 /* OpaqueLayers */ === pass && fbo.isMultisampled && this.useMsBuffers;
|
|
695
|
+
this._readPickDataFromPingPong = !useMsBuffers;
|
|
696
|
+
System.instance.frameBufferStack.execute(fbo, true, useMsBuffers, () => {
|
|
697
|
+
this.drawPass(commands, pass, true);
|
|
698
|
+
});
|
|
699
|
+
this._readPickDataFromPingPong = false;
|
|
626
700
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const includeOcclusion = this.target.wantAmbientOcclusion;
|
|
632
|
-
const wantVolumeClassifier = (undefined !== this.target.activeVolumeClassifierProps);
|
|
633
|
-
let wantAntialiasSamples = this.target.antialiasSamples <= 1 || !System.instance.capabilities.supportsDrawBuffers ? 1 : this.target.antialiasSamples;
|
|
634
|
-
if (wantAntialiasSamples > System.instance.capabilities.maxAntialiasSamples)
|
|
635
|
-
wantAntialiasSamples = System.instance.capabilities.maxAntialiasSamples;
|
|
636
|
-
const changeAntialiasSamples = (this._antialiasSamples > 1 && wantAntialiasSamples > 1 && this._antialiasSamples !== wantAntialiasSamples);
|
|
637
|
-
// If not yet initialized, or dimensions changed, or antialiasing changed the number of samples, initialize.
|
|
638
|
-
if (undefined === this._textures.accumulation || width !== this._width || height !== this._height || changeAntialiasSamples) {
|
|
639
|
-
this._width = width;
|
|
640
|
-
this._height = height;
|
|
641
|
-
this._antialiasSamples = wantAntialiasSamples;
|
|
642
|
-
// init() first calls dispose(), which releases all of our fbos, textures, etc, and resets the _includeOcclusion flag.
|
|
643
|
-
if (!this.init()) {
|
|
644
|
-
assert(false, "Failed to initialize scene compositor");
|
|
645
|
-
return false;
|
|
646
|
-
}
|
|
701
|
+
renderOpaque(commands, compositeFlags, renderForReadPixels) {
|
|
702
|
+
if (0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */) && !renderForReadPixels) {
|
|
703
|
+
this.renderOpaqueAO(commands);
|
|
704
|
+
return;
|
|
647
705
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
this._haveVolumeClassifier = false;
|
|
663
|
-
}
|
|
664
|
-
if (includeOcclusion && this._includeOcclusion) {
|
|
665
|
-
// Multisampling and AO buffers are also somewhat co-dependent, so if AO is on
|
|
666
|
-
// and is staying on, just disable AO and let it get re-enabled later.
|
|
667
|
-
this._geom.disableOcclusion();
|
|
668
|
-
this._frameBuffers.disableOcclusion();
|
|
669
|
-
this._textures.disableOcclusion();
|
|
670
|
-
this._includeOcclusion = false;
|
|
671
|
-
}
|
|
672
|
-
if (this._antialiasSamples > 1) {
|
|
673
|
-
if (!this.enableMultiSampling()) {
|
|
674
|
-
assert(false, "Failed to initialize multisampling buffers");
|
|
675
|
-
return false;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
else {
|
|
679
|
-
if (!this.disableMultiSampling()) {
|
|
680
|
-
assert(false, "Failed to initialize multisampling buffers");
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
706
|
+
const needComposite = 0 /* None */ !== compositeFlags;
|
|
707
|
+
const fbStack = System.instance.frameBufferStack;
|
|
708
|
+
// Output the first 2 passes to color and pick data buffers. (All 3 in the case of rendering for readPixels() or ambient occlusion).
|
|
709
|
+
let fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
|
|
710
|
+
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
711
|
+
this._readPickDataFromPingPong = !useMsBuffers; // if multisampling then can read pick textures directly.
|
|
712
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
713
|
+
this.drawPass(commands, 2 /* OpaqueLinear */);
|
|
714
|
+
this.drawPass(commands, 3 /* OpaquePlanar */, true);
|
|
715
|
+
if (renderForReadPixels) {
|
|
716
|
+
this.drawPass(commands, 4 /* PointClouds */, true); // don't need EDL for this
|
|
717
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, true);
|
|
718
|
+
if (useMsBuffers)
|
|
719
|
+
fbo.blitMsBuffersToTextures(true);
|
|
683
720
|
}
|
|
721
|
+
});
|
|
722
|
+
this._readPickDataFromPingPong = false;
|
|
723
|
+
// The general pass (and following) will not bother to write to pick buffers and so can read from the actual pick buffers.
|
|
724
|
+
if (!renderForReadPixels) {
|
|
725
|
+
fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
|
|
726
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
727
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
728
|
+
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
729
|
+
});
|
|
730
|
+
// assume we are done with MS at this point, so update the non-MS buffers
|
|
731
|
+
if (useMsBuffers)
|
|
732
|
+
fbo.blitMsBuffersToTextures(needComposite);
|
|
684
733
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
734
|
+
}
|
|
735
|
+
renderOpaqueAO(commands) {
|
|
736
|
+
const fbStack = System.instance.frameBufferStack;
|
|
737
|
+
const haveHiddenEdges = 0 !== commands.getCommands(9 /* HiddenEdge */).length;
|
|
738
|
+
// Output the linear, planar, and pickable surfaces to color and pick data buffers.
|
|
739
|
+
let fbo = this._fbos.opaqueAndCompositeAll;
|
|
740
|
+
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
741
|
+
this._readPickDataFromPingPong = !useMsBuffers; // if multisampling then can read pick textures directly.
|
|
742
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
743
|
+
this.drawPass(commands, 2 /* OpaqueLinear */);
|
|
744
|
+
this.drawPass(commands, 3 /* OpaquePlanar */, true);
|
|
745
|
+
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
746
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, true);
|
|
747
|
+
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
748
|
+
if (useMsBuffers)
|
|
749
|
+
fbo.blitMsBuffersToTextures(true);
|
|
750
|
+
});
|
|
751
|
+
this._readPickDataFromPingPong = false;
|
|
752
|
+
// Output the non-pickable surfaces and hidden edges to just the color buffer.
|
|
753
|
+
fbo = this._fbos.opaqueAndCompositeColor;
|
|
754
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
755
|
+
this._primitiveDrawState = PrimitiveDrawState.NonPickable;
|
|
756
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
757
|
+
if (haveHiddenEdges)
|
|
758
|
+
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
759
|
+
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
760
|
+
});
|
|
761
|
+
if (useMsBuffers)
|
|
762
|
+
fbo.blitMsBuffersToTextures(true);
|
|
763
|
+
// If there are no hidden edges, then we're done & can run the AO passes using the normal depthAndOrder texture.
|
|
764
|
+
if (haveHiddenEdges) {
|
|
765
|
+
// AO needs the pick data (orderAndDepth) for the hidden edges. We don't want it in with the other pick data though since they are not pickable, so we will use other textures.
|
|
766
|
+
// If not multisampling we will re-use the ping-pong/transparency textures since we are done with ping-ponging at this point and transparency happens later.
|
|
767
|
+
// If multisampling then we will use the accumulation texture for featureIDs and a special texture for depthAndOrder since the revealage texture is not the right type for multisampling.
|
|
768
|
+
// First we will need to copy what's in the pick buffers so far into the hidden pick buffers.
|
|
769
|
+
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
770
|
+
fbo = (useMsBuffers ? this._fbos.pingPongMS : this._fbos.pingPong);
|
|
771
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
772
|
+
const params = getDrawParams(this.target, this._geom.copyPickBuffers);
|
|
773
|
+
this.target.techniques.draw(params);
|
|
774
|
+
});
|
|
775
|
+
if (useMsBuffers)
|
|
776
|
+
fbo.blitMsBuffersToTextures(false, 1); // only want to blit the depth/order target
|
|
777
|
+
// Now draw the hidden edges, using an fbo which places their depth/order into the hidden pick buffers.
|
|
778
|
+
// Since we are not writing to the actual pick buffers we let this._readPickDataFromPingPong remain false.
|
|
779
|
+
fbo = this._fbos.opaqueAndCompositeAllHidden;
|
|
780
|
+
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
781
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
782
|
+
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
783
|
+
});
|
|
784
|
+
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
785
|
+
if (useMsBuffers) {
|
|
786
|
+
// Only want to blit the color and depth/order targets as the featureId target is not blit-able and will generate a GL error.
|
|
787
|
+
fbo.blitMsBuffersToTextures(false, 0);
|
|
788
|
+
fbo.blitMsBuffersToTextures(false, 2);
|
|
789
|
+
}
|
|
790
|
+
this._needHiddenEdges = false;
|
|
791
|
+
}
|
|
792
|
+
this._needHiddenEdges = haveHiddenEdges; // this will cause the alternate renderAndOrder texture with the hidden edges to be read for the 2nd AO blur pass.
|
|
793
|
+
this.renderAmbientOcclusion();
|
|
794
|
+
this._needHiddenEdges = false;
|
|
795
|
+
}
|
|
796
|
+
renderPointClouds(commands, compositeFlags) {
|
|
797
|
+
var _a, _b;
|
|
798
|
+
const is3d = 2 /* Perspective */ === this.target.uniforms.frustum.type;
|
|
799
|
+
// separate individual point clouds and get their point cloud settings
|
|
800
|
+
const pointClouds = [];
|
|
801
|
+
let pcs;
|
|
802
|
+
const cmds = commands.getCommands(4 /* PointClouds */);
|
|
803
|
+
let curPC;
|
|
804
|
+
let pushDepth = 0;
|
|
805
|
+
for (const cmd of cmds) {
|
|
806
|
+
if ("pushBranch" === cmd.opcode) { // should be first command
|
|
807
|
+
++pushDepth;
|
|
808
|
+
if (pushDepth === 1) {
|
|
809
|
+
pcs = (_a = cmd.branch.branch.realityModelDisplaySettings) === null || _a === void 0 ? void 0 : _a.pointCloud;
|
|
810
|
+
this.target.uniforms.realityModel.pointCloud.updateRange(cmd.branch.branch.realityModelRange, this.target, cmd.branch.localToWorldTransform, is3d);
|
|
811
|
+
pointClouds.push(curPC = { pcs, cmds: [cmd] });
|
|
692
812
|
}
|
|
693
|
-
|
|
694
|
-
assert(
|
|
695
|
-
|
|
813
|
+
else {
|
|
814
|
+
assert(undefined !== curPC);
|
|
815
|
+
curPC.cmds.push(cmd);
|
|
696
816
|
}
|
|
697
|
-
this._geom.enableOcclusion(this._textures, this._depth);
|
|
698
817
|
}
|
|
699
818
|
else {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
819
|
+
if ("popBranch" === cmd.opcode)
|
|
820
|
+
--pushDepth;
|
|
821
|
+
assert(undefined !== curPC);
|
|
822
|
+
curPC.cmds.push(cmd);
|
|
703
823
|
}
|
|
704
824
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
825
|
+
const needComposite = 0 /* None */ !== compositeFlags;
|
|
826
|
+
const fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
|
|
827
|
+
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
828
|
+
const system = System.instance;
|
|
829
|
+
const fbStack = system.frameBufferStack;
|
|
830
|
+
this._readPickDataFromPingPong = false;
|
|
831
|
+
for (const pc of pointClouds) {
|
|
832
|
+
pcs = pc.pcs;
|
|
833
|
+
let edlOn = (pcs === null || pcs === void 0 ? void 0 : pcs.edlMode) !== "off" && is3d;
|
|
834
|
+
if (edlOn) {
|
|
835
|
+
if (undefined === this._textures.hilite)
|
|
836
|
+
edlOn = false;
|
|
837
|
+
else {
|
|
838
|
+
// create fbo on fly if not present, or has changed (from MS)
|
|
839
|
+
// ###TODO consider not drawing point clouds to MS buffers, at least if EDL, it isn't worth the overhead.
|
|
840
|
+
// would have to blit depth before draw, use depth for draw, then run shader to copy depth back to MSAA
|
|
841
|
+
// at end, wherever color buf changed (test alpha, else discard)
|
|
842
|
+
// this would also simplify this code considerably
|
|
843
|
+
let drawColBufs;
|
|
844
|
+
if (undefined !== this._fbos.edlDrawCol)
|
|
845
|
+
drawColBufs = this._fbos.edlDrawCol.getColorTargets(useMsBuffers, 0);
|
|
846
|
+
if (undefined === this._fbos.edlDrawCol || this._textures.hilite !== (drawColBufs === null || drawColBufs === void 0 ? void 0 : drawColBufs.tex) || this._textures.hiliteMsBuff !== drawColBufs.msBuf) {
|
|
847
|
+
this._fbos.edlDrawCol = dispose(this._fbos.edlDrawCol);
|
|
848
|
+
const filters = [GL.MultiSampling.Filter.Linear];
|
|
849
|
+
if (useMsBuffers)
|
|
850
|
+
this._fbos.edlDrawCol = FrameBuffer.create([this._textures.hilite], this._depth, useMsBuffers && this._textures.hiliteMsBuff ? [this._textures.hiliteMsBuff] : undefined, filters, this._depthMS);
|
|
851
|
+
else
|
|
852
|
+
this._fbos.edlDrawCol = FrameBuffer.create([this._textures.hilite], this._depth);
|
|
853
|
+
}
|
|
854
|
+
if (undefined === this._fbos.edlDrawCol)
|
|
855
|
+
edlOn = false;
|
|
856
|
+
else { // can draw EDL
|
|
857
|
+
// first draw pointcloud to borrowed hilite texture(MS) and regular depth(MS) buffers
|
|
858
|
+
fbStack.execute(this._fbos.edlDrawCol, true, useMsBuffers, () => {
|
|
859
|
+
system.context.clearColor(0, 0, 0, 0);
|
|
860
|
+
system.context.clear(GL.BufferBit.Color);
|
|
861
|
+
system.applyRenderState(this.getRenderState(4 /* PointClouds */));
|
|
862
|
+
this.target.techniques.execute(this.target, pc.cmds, 4 /* PointClouds */);
|
|
863
|
+
});
|
|
864
|
+
if (useMsBuffers)
|
|
865
|
+
this._fbos.edlDrawCol.blitMsBuffersToTextures(true, 0); // need to read the non-MS depth and hilite buffers
|
|
866
|
+
// next process buffers to generate EDL (depth buffer is passed during init)
|
|
867
|
+
this.target.beginPerfMetricRecord("Calc EDL"); // ### todo keep? (probably)
|
|
868
|
+
const sts = this.eyeDomeLighting.draw({
|
|
869
|
+
edlMode: ((_b = pc.pcs) === null || _b === void 0 ? void 0 : _b.edlMode) === "full" ? EDLMode.Full : EDLMode.On,
|
|
870
|
+
edlFilter: !!(pcs === null || pcs === void 0 ? void 0 : pcs.edlFilter),
|
|
871
|
+
useMsBuffers,
|
|
872
|
+
inputTex: this._textures.hilite,
|
|
873
|
+
curFbo: fbo,
|
|
874
|
+
});
|
|
875
|
+
this.target.endPerfMetricRecord();
|
|
876
|
+
if (!sts) {
|
|
877
|
+
edlOn = false;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
722
880
|
}
|
|
723
|
-
this.enableVolumeClassifierFbos(this._textures, this._depth, this._vcAltDepthStencil, this._depthMS, this._vcAltDepthStencilMS);
|
|
724
|
-
this._haveVolumeClassifier = true;
|
|
725
881
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
this._vcAltDepthStencil = undefined;
|
|
733
|
-
}
|
|
734
|
-
this._haveVolumeClassifier = false;
|
|
882
|
+
if (!edlOn) {
|
|
883
|
+
// draw the regular way
|
|
884
|
+
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
885
|
+
system.applyRenderState(this.getRenderState(4 /* PointClouds */));
|
|
886
|
+
this.target.techniques.execute(this.target, pc.cmds, 4 /* PointClouds */);
|
|
887
|
+
});
|
|
735
888
|
}
|
|
736
889
|
}
|
|
737
|
-
return true;
|
|
738
890
|
}
|
|
739
|
-
|
|
740
|
-
if (!this.preDraw()) {
|
|
741
|
-
assert(false);
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
const compositeFlags = commands.compositeFlags;
|
|
891
|
+
renderForVolumeClassification(commands, compositeFlags, renderForReadPixels) {
|
|
745
892
|
const needComposite = 0 /* None */ !== compositeFlags;
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
// Render the background
|
|
754
|
-
this.target.beginPerfMetricRecord("Render Background");
|
|
755
|
-
this.renderBackground(commands, needComposite);
|
|
756
|
-
this.target.endPerfMetricRecord();
|
|
757
|
-
// Render the sky box
|
|
758
|
-
this.target.beginPerfMetricRecord("Render Skybox");
|
|
759
|
-
this.renderSkyBox(commands, needComposite);
|
|
760
|
-
this.target.endPerfMetricRecord();
|
|
761
|
-
// Render the background map graphics
|
|
762
|
-
this.target.beginPerfMetricRecord("Render Background Map");
|
|
763
|
-
this.renderBackgroundMap(commands, needComposite);
|
|
764
|
-
this.target.endPerfMetricRecord();
|
|
765
|
-
this.target.frameStatsCollector.endTime("backgroundTime");
|
|
766
|
-
// Enable clipping
|
|
767
|
-
this.target.beginPerfMetricRecord("Enable Clipping");
|
|
768
|
-
this.target.pushViewClip();
|
|
769
|
-
this.target.endPerfMetricRecord();
|
|
770
|
-
// Render volume classification first so that we only classify the reality data
|
|
771
|
-
this.target.frameStatsCollector.beginTime("classifiersTime");
|
|
772
|
-
this.target.beginPerfMetricRecord("Render VolumeClassification");
|
|
773
|
-
this.renderVolumeClassification(commands, compositeFlags, false);
|
|
774
|
-
this.target.endPerfMetricRecord();
|
|
775
|
-
this.target.frameStatsCollector.endTime("classifiersTime");
|
|
776
|
-
this.target.frameStatsCollector.beginTime("opaqueTime");
|
|
777
|
-
// Render layers
|
|
778
|
-
this.target.beginPerfMetricRecord("Render Opaque Layers");
|
|
779
|
-
this.renderLayers(commands, needComposite, 1 /* OpaqueLayers */);
|
|
780
|
-
this.target.endPerfMetricRecord();
|
|
781
|
-
// Render opaque geometry
|
|
782
|
-
this.target.frameStatsCollector.beginTime("onRenderOpaqueTime");
|
|
783
|
-
IModelFrameLifecycle.onRenderOpaque.raiseEvent({
|
|
784
|
-
commands,
|
|
785
|
-
needComposite,
|
|
786
|
-
compositeFlags,
|
|
787
|
-
fbo: this.getBackgroundFbo(needComposite),
|
|
788
|
-
frameBufferStack: System.instance.frameBufferStack,
|
|
789
|
-
});
|
|
790
|
-
this.target.frameStatsCollector.endTime("onRenderOpaqueTime");
|
|
791
|
-
// Render point cloud geometry with possible EDL (WebGL2 only)
|
|
792
|
-
if (System.instance.capabilities.isWebGL2) {
|
|
793
|
-
this.target.beginPerfMetricRecord("Render PointClouds");
|
|
794
|
-
this.renderPointClouds(commands, compositeFlags);
|
|
795
|
-
this.target.endPerfMetricRecord();
|
|
893
|
+
const needAO = 0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */);
|
|
894
|
+
const fbStack = System.instance.frameBufferStack;
|
|
895
|
+
if (renderForReadPixels || needAO) {
|
|
896
|
+
this._readPickDataFromPingPong = true;
|
|
897
|
+
fbStack.execute(needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll, true, this.useMsBuffers, () => {
|
|
898
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, true, 20 /* VolumeClassifiedRealityData */);
|
|
899
|
+
});
|
|
796
900
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
901
|
+
else {
|
|
902
|
+
this._readPickDataFromPingPong = false;
|
|
903
|
+
fbStack.execute(needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor, true, this.useMsBuffers, () => {
|
|
904
|
+
this.drawPass(commands, 5 /* OpaqueGeneral */, false, 20 /* VolumeClassifiedRealityData */);
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
renderIndexedClassifierForReadPixels(cmds, state, renderForIntersectingVolumes, needComposite) {
|
|
909
|
+
this._readPickDataFromPingPong = true;
|
|
910
|
+
const fbo = (renderForIntersectingVolumes ? (needComposite ? this._fbos.idsAndZComposite : this._fbos.idsAndZ)
|
|
911
|
+
: (needComposite ? this._fbos.idsAndAltZComposite : this._fbos.idsAndAltZ));
|
|
912
|
+
System.instance.frameBufferStack.execute(fbo, true, false, () => {
|
|
913
|
+
System.instance.applyRenderState(state);
|
|
914
|
+
this.target.techniques.execute(this.target, cmds, 5 /* OpaqueGeneral */);
|
|
915
|
+
});
|
|
916
|
+
this._readPickDataFromPingPong = false;
|
|
917
|
+
}
|
|
918
|
+
clearTranslucent() {
|
|
919
|
+
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
920
|
+
System.instance.frameBufferStack.execute(this._fbos.clearTranslucent, true, false, () => {
|
|
921
|
+
const params = getDrawParams(this.target, this._geom.clearTranslucent);
|
|
922
|
+
this.target.techniques.draw(params);
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
renderTranslucent(commands) {
|
|
926
|
+
System.instance.frameBufferStack.execute(this._fbos.translucent, true, false, () => {
|
|
927
|
+
this.drawPass(commands, 8 /* Translucent */);
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
getBackgroundFbo(needComposite) {
|
|
931
|
+
return needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor;
|
|
932
|
+
}
|
|
933
|
+
pingPong() {
|
|
934
|
+
if (this._fbos.opaqueAll.isMultisampled && this.useMsBuffers) {
|
|
935
|
+
// If we are multisampling we can just blit the FeatureId and DepthAndOrder MS buffers to their textures.
|
|
936
|
+
this._fbos.opaqueAll.blitMsBuffersToTextures(false, 1);
|
|
937
|
+
this._fbos.opaqueAll.blitMsBuffersToTextures(false, 2);
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
941
|
+
System.instance.frameBufferStack.execute(this._fbos.pingPong, true, this.useMsBuffers, () => {
|
|
942
|
+
const params = getDrawParams(this.target, this._geom.copyPickBuffers);
|
|
943
|
+
this.target.techniques.draw(params);
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
get antialiasSamples() { return this._antialiasSamples; }
|
|
948
|
+
get useMsBuffers() { return this._antialiasSamples > 1 && !this.target.isReadPixelsInProgress; }
|
|
949
|
+
enableVolumeClassifierFbos(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
950
|
+
this._fbos.enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS);
|
|
951
|
+
}
|
|
952
|
+
disableVolumeClassifierFbos() {
|
|
953
|
+
this._fbos.disableVolumeClassifier();
|
|
954
|
+
}
|
|
955
|
+
/** This function generates a texture that contains ambient occlusion information to be applied later. */
|
|
956
|
+
renderAmbientOcclusion() {
|
|
957
|
+
const system = System.instance;
|
|
958
|
+
// Render unblurred ambient occlusion based on depth buffer
|
|
959
|
+
let fbo = this._fbos.occlusion;
|
|
960
|
+
this.target.beginPerfMetricRecord("Compute AO");
|
|
961
|
+
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
962
|
+
System.instance.applyRenderState(RenderState.defaults);
|
|
963
|
+
const params = getDrawParams(this.target, this._geom.occlusion);
|
|
964
|
+
this.target.techniques.draw(params);
|
|
965
|
+
});
|
|
966
|
+
this.target.endPerfMetricRecord();
|
|
967
|
+
// Render the X-blurred ambient occlusion based on unblurred ambient occlusion
|
|
968
|
+
fbo = this._fbos.occlusionBlur;
|
|
969
|
+
this.target.beginPerfMetricRecord("Blur AO X");
|
|
970
|
+
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
971
|
+
System.instance.applyRenderState(RenderState.defaults);
|
|
972
|
+
const params = getDrawParams(this.target, this._geom.occlusionXBlur);
|
|
973
|
+
this.target.techniques.draw(params);
|
|
974
|
+
});
|
|
975
|
+
this.target.endPerfMetricRecord();
|
|
976
|
+
// Render the Y-blurred ambient occlusion based on X-blurred ambient occlusion (render into original occlusion framebuffer)
|
|
977
|
+
fbo = this._fbos.occlusion;
|
|
978
|
+
this.target.beginPerfMetricRecord("Blur AO Y");
|
|
979
|
+
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
980
|
+
System.instance.applyRenderState(RenderState.defaults);
|
|
981
|
+
const params = getDrawParams(this.target, this._geom.occlusionYBlur);
|
|
982
|
+
this.target.techniques.draw(params);
|
|
983
|
+
});
|
|
984
|
+
this.target.endPerfMetricRecord();
|
|
985
|
+
}
|
|
986
|
+
collectStatistics(stats) {
|
|
987
|
+
if (undefined !== this._depth)
|
|
988
|
+
stats.addTextureAttachment(this._depth.bytesUsed);
|
|
989
|
+
if (undefined !== this._depthMS)
|
|
990
|
+
stats.addTextureAttachment(this._depthMS.bytesUsed);
|
|
991
|
+
this._textures.collectStatistics(stats);
|
|
992
|
+
this._geom.collectStatistics(stats);
|
|
993
|
+
}
|
|
994
|
+
preDraw() {
|
|
995
|
+
const rect = this.target.viewRect;
|
|
996
|
+
const width = rect.width;
|
|
997
|
+
const height = rect.height;
|
|
998
|
+
const includeOcclusion = this.target.wantAmbientOcclusion;
|
|
999
|
+
const wantVolumeClassifier = (undefined !== this.target.activeVolumeClassifierProps);
|
|
1000
|
+
let wantAntialiasSamples = this.target.antialiasSamples <= 1 ? 1 : this.target.antialiasSamples;
|
|
1001
|
+
if (wantAntialiasSamples > System.instance.maxAntialiasSamples)
|
|
1002
|
+
wantAntialiasSamples = System.instance.maxAntialiasSamples;
|
|
1003
|
+
const changeAntialiasSamples = (this._antialiasSamples > 1 && wantAntialiasSamples > 1 && this._antialiasSamples !== wantAntialiasSamples);
|
|
1004
|
+
// If not yet initialized, or dimensions changed, or antialiasing changed the number of samples, initialize.
|
|
1005
|
+
if (undefined === this._textures.accumulation || width !== this._width || height !== this._height || changeAntialiasSamples) {
|
|
1006
|
+
this._width = width;
|
|
1007
|
+
this._height = height;
|
|
1008
|
+
this._antialiasSamples = wantAntialiasSamples;
|
|
1009
|
+
// init() first calls dispose(), which releases all of our fbos, textures, etc, and resets the _includeOcclusion flag.
|
|
1010
|
+
if (!this.init()) {
|
|
1011
|
+
assert(false, "Failed to initialize scene compositor");
|
|
1012
|
+
return false;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
else if (this._antialiasSamples !== wantAntialiasSamples) {
|
|
1016
|
+
// Turn on or off multisampling. Rather than just re-initializing, we can save the
|
|
1017
|
+
// non multisampled textures & FBOs and just try to add or delete the multisampled ones.
|
|
1018
|
+
this._antialiasSamples = wantAntialiasSamples;
|
|
1019
|
+
if (wantVolumeClassifier && this._haveVolumeClassifier) {
|
|
1020
|
+
// Multisampling and volume classification buffers are somewhat co-dependent so if volume classification is on
|
|
1021
|
+
// and is staying on, just disable volume classifiers and let them get re-enabled later.
|
|
1022
|
+
this.disableVolumeClassifierFbos();
|
|
1023
|
+
this._geom.disableVolumeClassifier();
|
|
1024
|
+
this._textures.disableVolumeClassifier();
|
|
1025
|
+
if (undefined !== this._vcAltDepthStencil) {
|
|
1026
|
+
this._vcAltDepthStencil.dispose();
|
|
1027
|
+
this._vcAltDepthStencil = undefined;
|
|
1028
|
+
}
|
|
1029
|
+
this._haveVolumeClassifier = false;
|
|
1030
|
+
}
|
|
1031
|
+
if (includeOcclusion && this._includeOcclusion) {
|
|
1032
|
+
// Multisampling and AO buffers are also somewhat co-dependent, so if AO is on
|
|
1033
|
+
// and is staying on, just disable AO and let it get re-enabled later.
|
|
1034
|
+
this._geom.disableOcclusion();
|
|
1035
|
+
this._fbos.disableOcclusion();
|
|
1036
|
+
this._textures.disableOcclusion();
|
|
1037
|
+
this._includeOcclusion = false;
|
|
1038
|
+
}
|
|
1039
|
+
if (this._antialiasSamples > 1) {
|
|
1040
|
+
if (!this.enableMultiSampling()) {
|
|
1041
|
+
assert(false, "Failed to initialize multisampling buffers");
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
if (!this.disableMultiSampling()) {
|
|
1047
|
+
assert(false, "Failed to initialize multisampling buffers");
|
|
1048
|
+
return false;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
// Allocate or free ambient occlusion-related resources if necessary
|
|
1053
|
+
if (includeOcclusion !== this._includeOcclusion) {
|
|
1054
|
+
this._includeOcclusion = includeOcclusion;
|
|
1055
|
+
if (includeOcclusion) {
|
|
1056
|
+
if (!this._textures.enableOcclusion(width, height, this._antialiasSamples)) {
|
|
1057
|
+
assert(false, "Failed to initialize occlusion textures");
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
if (!this._fbos.enableOcclusion(this._textures, this._depth, this._depthMS)) {
|
|
1061
|
+
assert(false, "Failed to initialize occlusion frame buffers");
|
|
1062
|
+
return false;
|
|
1063
|
+
}
|
|
1064
|
+
this._geom.enableOcclusion(this._textures, this._depth);
|
|
1065
|
+
}
|
|
1066
|
+
else {
|
|
1067
|
+
this._geom.disableOcclusion();
|
|
1068
|
+
this._fbos.disableOcclusion();
|
|
1069
|
+
this._textures.disableOcclusion();
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
// Allocate or free volume classifier-related resources if necessary.
|
|
1073
|
+
if (wantVolumeClassifier !== this._haveVolumeClassifier) {
|
|
1074
|
+
if (wantVolumeClassifier) {
|
|
1075
|
+
this._vcAltDepthStencil = System.instance.createDepthBuffer(width, height);
|
|
1076
|
+
if (undefined !== this._depthMS)
|
|
1077
|
+
this._vcAltDepthStencilMS = System.instance.createDepthBuffer(width, height, this._antialiasSamples);
|
|
1078
|
+
if (undefined === this._vcAltDepthStencil || (undefined !== this._depthMS && undefined === this._vcAltDepthStencilMS))
|
|
1079
|
+
return false;
|
|
1080
|
+
if (!this._textures.enableVolumeClassifier(width, height, this._antialiasSamples))
|
|
1081
|
+
return false;
|
|
1082
|
+
if (!this._geom.enableVolumeClassifier(this._textures, this._depth))
|
|
1083
|
+
return false;
|
|
1084
|
+
this.enableVolumeClassifierFbos(this._textures, this._depth, this._vcAltDepthStencil, this._depthMS, this._vcAltDepthStencilMS);
|
|
1085
|
+
this._haveVolumeClassifier = true;
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
this.disableVolumeClassifierFbos();
|
|
1089
|
+
this._geom.disableVolumeClassifier();
|
|
1090
|
+
this._textures.disableVolumeClassifier();
|
|
1091
|
+
if (undefined !== this._vcAltDepthStencil) {
|
|
1092
|
+
this._vcAltDepthStencil.dispose();
|
|
1093
|
+
this._vcAltDepthStencil = undefined;
|
|
1094
|
+
}
|
|
1095
|
+
this._haveVolumeClassifier = false;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return true;
|
|
1099
|
+
}
|
|
1100
|
+
draw(commands) {
|
|
1101
|
+
if (!this.preDraw())
|
|
1102
|
+
return;
|
|
1103
|
+
const compositeFlags = commands.compositeFlags;
|
|
1104
|
+
const needComposite = 0 /* None */ !== compositeFlags;
|
|
1105
|
+
// Clear output targets
|
|
1106
|
+
this.target.frameStatsCollector.beginTime("opaqueTime");
|
|
1107
|
+
this.target.beginPerfMetricRecord("Clear Opaque");
|
|
1108
|
+
this.clearOpaque(needComposite);
|
|
1109
|
+
this.target.endPerfMetricRecord();
|
|
1110
|
+
this.target.frameStatsCollector.endTime("opaqueTime");
|
|
1111
|
+
this.target.frameStatsCollector.beginTime("backgroundTime"); // includes skybox
|
|
1112
|
+
// Render the background
|
|
1113
|
+
this.target.beginPerfMetricRecord("Render Background");
|
|
1114
|
+
this.renderBackground(commands, needComposite);
|
|
1115
|
+
this.target.endPerfMetricRecord();
|
|
1116
|
+
// Render the sky box
|
|
1117
|
+
this.target.beginPerfMetricRecord("Render Skybox");
|
|
1118
|
+
this.renderSkyBox(commands, needComposite);
|
|
1119
|
+
this.target.endPerfMetricRecord();
|
|
1120
|
+
// Render the background map graphics
|
|
1121
|
+
this.target.beginPerfMetricRecord("Render Background Map");
|
|
1122
|
+
this.renderBackgroundMap(commands, needComposite);
|
|
1123
|
+
this.target.endPerfMetricRecord();
|
|
1124
|
+
this.target.frameStatsCollector.endTime("backgroundTime");
|
|
1125
|
+
// Enable clipping
|
|
1126
|
+
this.target.beginPerfMetricRecord("Enable Clipping");
|
|
1127
|
+
this.target.pushViewClip();
|
|
1128
|
+
this.target.endPerfMetricRecord();
|
|
1129
|
+
// Render volume classification first so that we only classify the reality data
|
|
1130
|
+
this.target.frameStatsCollector.beginTime("classifiersTime");
|
|
1131
|
+
this.target.beginPerfMetricRecord("Render VolumeClassification");
|
|
1132
|
+
this.renderVolumeClassification(commands, compositeFlags, false);
|
|
1133
|
+
this.target.endPerfMetricRecord();
|
|
1134
|
+
this.target.frameStatsCollector.endTime("classifiersTime");
|
|
1135
|
+
this.target.frameStatsCollector.beginTime("opaqueTime");
|
|
1136
|
+
// Render layers
|
|
1137
|
+
this.target.beginPerfMetricRecord("Render Opaque Layers");
|
|
1138
|
+
this.renderLayers(commands, needComposite, 1 /* OpaqueLayers */);
|
|
1139
|
+
this.target.endPerfMetricRecord();
|
|
1140
|
+
// Render opaque geometry
|
|
1141
|
+
this.target.frameStatsCollector.beginTime("onRenderOpaqueTime");
|
|
1142
|
+
IModelFrameLifecycle.onRenderOpaque.raiseEvent({
|
|
1143
|
+
commands,
|
|
1144
|
+
needComposite,
|
|
1145
|
+
compositeFlags,
|
|
1146
|
+
fbo: this.getBackgroundFbo(needComposite),
|
|
1147
|
+
frameBufferStack: System.instance.frameBufferStack,
|
|
1148
|
+
});
|
|
1149
|
+
this.target.frameStatsCollector.endTime("onRenderOpaqueTime");
|
|
1150
|
+
// Render point cloud geometry with possible EDL
|
|
1151
|
+
this.target.beginPerfMetricRecord("Render PointClouds");
|
|
1152
|
+
this.renderPointClouds(commands, compositeFlags);
|
|
1153
|
+
this.target.endPerfMetricRecord();
|
|
1154
|
+
// Render opaque geometry
|
|
1155
|
+
this.target.beginPerfMetricRecord("Render Opaque");
|
|
1156
|
+
this.renderOpaque(commands, compositeFlags, false);
|
|
1157
|
+
this.target.endPerfMetricRecord();
|
|
1158
|
+
this.target.frameStatsCollector.endTime("opaqueTime");
|
|
1159
|
+
this.target.frameStatsCollector.beginTime("translucentTime");
|
|
803
1160
|
// Render translucent layers
|
|
804
1161
|
this.target.beginPerfMetricRecord("Render Translucent Layers");
|
|
805
1162
|
this.renderLayers(commands, needComposite, 7 /* TranslucentLayers */);
|
|
@@ -883,7 +1240,7 @@ class Compositor extends SceneCompositor {
|
|
|
883
1240
|
// (If *only* overlays exist, then clearOpaque() above already took care of this).
|
|
884
1241
|
if (haveRenderCommands) {
|
|
885
1242
|
const system = System.instance;
|
|
886
|
-
system.frameBufferStack.execute(this.
|
|
1243
|
+
system.frameBufferStack.execute(this._fbos.opaqueColor, true, this.useMsBuffers, () => {
|
|
887
1244
|
system.applyRenderState(RenderState.defaults);
|
|
888
1245
|
system.context.clearDepth(1.0);
|
|
889
1246
|
system.context.clear(GL.BufferBit.Depth);
|
|
@@ -901,7 +1258,7 @@ class Compositor extends SceneCompositor {
|
|
|
901
1258
|
readPixels(rect, selector) {
|
|
902
1259
|
return PixelBuffer.create(rect, selector, this);
|
|
903
1260
|
}
|
|
904
|
-
readDepthAndOrder(rect) { return this.readFrameBuffer(rect, this.
|
|
1261
|
+
readDepthAndOrder(rect) { return this.readFrameBuffer(rect, this._fbos.depthAndOrder); }
|
|
905
1262
|
readFeatureIds(rect) {
|
|
906
1263
|
const tex = this._textures.featureId;
|
|
907
1264
|
if (undefined === tex)
|
|
@@ -915,8 +1272,8 @@ class Compositor extends SceneCompositor {
|
|
|
915
1272
|
this.solarShadowMap.update(context);
|
|
916
1273
|
}
|
|
917
1274
|
get screenSpaceEffectFbo() {
|
|
918
|
-
assert(undefined !== this.
|
|
919
|
-
return this.
|
|
1275
|
+
assert(undefined !== this._fbos.hilite);
|
|
1276
|
+
return this._fbos.hilite;
|
|
920
1277
|
}
|
|
921
1278
|
readFrameBuffer(rect, fbo) {
|
|
922
1279
|
if (undefined === fbo || !Debug.isValidFrameBuffer)
|
|
@@ -941,7 +1298,7 @@ class Compositor extends SceneCompositor {
|
|
|
941
1298
|
&& undefined === this._vcAltDepthStencil
|
|
942
1299
|
&& !this._includeOcclusion
|
|
943
1300
|
&& this._textures.isDisposed
|
|
944
|
-
&& this.
|
|
1301
|
+
&& this._fbos.isDisposed
|
|
945
1302
|
&& this._geom.isDisposed
|
|
946
1303
|
&& !this._haveVolumeClassifier
|
|
947
1304
|
&& this.solarShadowMap.isDisposed
|
|
@@ -960,7 +1317,7 @@ class Compositor extends SceneCompositor {
|
|
|
960
1317
|
this._vcAltDepthStencil = dispose(this._vcAltDepthStencil);
|
|
961
1318
|
this._includeOcclusion = false;
|
|
962
1319
|
dispose(this._textures);
|
|
963
|
-
dispose(this.
|
|
1320
|
+
dispose(this._fbos);
|
|
964
1321
|
dispose(this._geom);
|
|
965
1322
|
this._haveVolumeClassifier = false;
|
|
966
1323
|
this.eyeDomeLighting.reset();
|
|
@@ -974,7 +1331,7 @@ class Compositor extends SceneCompositor {
|
|
|
974
1331
|
this._depthMS = undefined;
|
|
975
1332
|
if (this._depth !== undefined) {
|
|
976
1333
|
return this._textures.init(this._width, this._height, this._antialiasSamples)
|
|
977
|
-
&& this.
|
|
1334
|
+
&& this._fbos.init(this._textures, this._depth, this._depthMS)
|
|
978
1335
|
&& this._geom.init(this._textures)
|
|
979
1336
|
&& this.eyeDomeLighting.init(this._width, this._height, this._depth);
|
|
980
1337
|
}
|
|
@@ -986,9 +1343,15 @@ class Compositor extends SceneCompositor {
|
|
|
986
1343
|
this._depthMS = System.instance.createDepthBuffer(this._width, this._height, this._antialiasSamples);
|
|
987
1344
|
if (undefined === this._depthMS)
|
|
988
1345
|
return false;
|
|
989
|
-
|
|
1346
|
+
if (!this._textures.enableMultiSampling(this._width, this._height, this._antialiasSamples))
|
|
1347
|
+
return false;
|
|
1348
|
+
assert(undefined !== this._depth && undefined !== this._depthMS);
|
|
1349
|
+
return this._fbos.enableMultiSampling(this._textures, this._depth, this._depthMS);
|
|
990
1350
|
}
|
|
991
1351
|
disableMultiSampling() {
|
|
1352
|
+
assert(undefined !== this._depth);
|
|
1353
|
+
if (!this._fbos.disableMultiSampling(this._textures, this._depth))
|
|
1354
|
+
return false;
|
|
992
1355
|
// Want to disable multisampling without deleting & reallocating other stuff.
|
|
993
1356
|
this._depthMS = dispose(this._depthMS);
|
|
994
1357
|
assert(undefined !== this._depth);
|
|
@@ -1134,7 +1497,7 @@ class Compositor extends SceneCompositor {
|
|
|
1134
1497
|
}
|
|
1135
1498
|
renderIndexedVolumeClassifier(cmdsByIndex, needComposite) {
|
|
1136
1499
|
// Set the stencil for the given classifier stencil volume.
|
|
1137
|
-
System.instance.frameBufferStack.execute(this.
|
|
1500
|
+
System.instance.frameBufferStack.execute(this._fbos.stencilSet, false, this.useMsBuffers, () => {
|
|
1138
1501
|
this.target.pushState(this._vcBranchState);
|
|
1139
1502
|
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1140
1503
|
this.target.techniques.executeForIndexedClassifier(this.target, cmdsByIndex, 6 /* Classification */);
|
|
@@ -1187,16 +1550,16 @@ class Compositor extends SceneCompositor {
|
|
|
1187
1550
|
});
|
|
1188
1551
|
return;
|
|
1189
1552
|
}
|
|
1190
|
-
if (undefined === this.
|
|
1553
|
+
if (undefined === this._fbos.altZOnly || undefined === this._fbos.stencilSet)
|
|
1191
1554
|
return;
|
|
1192
1555
|
if (renderForReadPixels && this.target.vcSupportIntersectingVolumes) {
|
|
1193
1556
|
// Clear the stencil.
|
|
1194
|
-
fbStack.execute(this.
|
|
1557
|
+
fbStack.execute(this._fbos.stencilSet, false, this.useMsBuffers, () => {
|
|
1195
1558
|
System.instance.context.clearStencil(0);
|
|
1196
1559
|
System.instance.context.clear(GL.BufferBit.Stencil);
|
|
1197
1560
|
});
|
|
1198
1561
|
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1199
|
-
this.
|
|
1562
|
+
this._fbos.stencilSet.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1200
1563
|
for (let i = 0; i < cmdsByIndex.length; i += numCmdsPerClassifier)
|
|
1201
1564
|
this.renderIndexedVolumeClassifier(cmdsByIndex.slice(i, i + numCmdsPerClassifier), needComposite);
|
|
1202
1565
|
return;
|
|
@@ -1206,10 +1569,10 @@ class Compositor extends SceneCompositor {
|
|
|
1206
1569
|
const doColorByElement = SpatialClassifierInsideDisplay.ElementColor === insideFlags || renderForReadPixels;
|
|
1207
1570
|
const doColorByElementForIntersectingVolumes = this.target.vcSupportIntersectingVolumes;
|
|
1208
1571
|
const needAltZ = (doColorByElement && !doColorByElementForIntersectingVolumes) || needOutsideDraw;
|
|
1209
|
-
let zOnlyFbo = this.
|
|
1210
|
-
let volClassBlendFbo = this.
|
|
1572
|
+
let zOnlyFbo = this._fbos.stencilSet;
|
|
1573
|
+
let volClassBlendFbo = this._fbos.volClassCreateBlend;
|
|
1211
1574
|
let volClassBlendReadZTexture = this._vcAltDepthStencil.getHandle();
|
|
1212
|
-
let volClassBlendReadZTextureFbo = this.
|
|
1575
|
+
let volClassBlendReadZTextureFbo = this._fbos.altZOnly;
|
|
1213
1576
|
if (!needAltZ) {
|
|
1214
1577
|
// Initialize the blend texture and the stencil.
|
|
1215
1578
|
assert(undefined !== volClassBlendFbo);
|
|
@@ -1222,28 +1585,25 @@ class Compositor extends SceneCompositor {
|
|
|
1222
1585
|
else {
|
|
1223
1586
|
// If we are doing color-by-element for the inside do not care about intersecting volumes or we need to color the outside
|
|
1224
1587
|
// then we need to copy the Z buffer and set up a different zbuffer/stencil to render in.
|
|
1225
|
-
zOnlyFbo = this.
|
|
1226
|
-
volClassBlendFbo = this.
|
|
1588
|
+
zOnlyFbo = this._fbos.altZOnly;
|
|
1589
|
+
volClassBlendFbo = this._fbos.volClassCreateBlendAltZ;
|
|
1227
1590
|
assert(undefined !== volClassBlendFbo);
|
|
1228
1591
|
volClassBlendReadZTexture = this._depth.getHandle();
|
|
1229
|
-
volClassBlendReadZTextureFbo = this.
|
|
1592
|
+
volClassBlendReadZTextureFbo = this._fbos.stencilSet;
|
|
1230
1593
|
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1231
1594
|
volClassBlendReadZTextureFbo.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1232
1595
|
// Copy the current Z into the Alt-Z. At the same time go ahead and clear the stencil and the blend texture.
|
|
1233
1596
|
fbStack.execute(volClassBlendFbo, true, this.useMsBuffers, () => {
|
|
1234
1597
|
this.target.pushState(this.target.decorationsState);
|
|
1235
1598
|
System.instance.applyRenderState(this._vcCopyZRenderState);
|
|
1236
|
-
|
|
1237
|
-
this.target.techniques.draw(getDrawParams(this.target, this._geom.volClassCopyZ)); // This method uses the EXT_frag_depth extension
|
|
1238
|
-
else
|
|
1239
|
-
this.target.techniques.draw(getDrawParams(this.target, this._geom.volClassCopyZWithPoints)); // This method draws GL_POINTS (1 per pixel) to set Z in vertex shader
|
|
1599
|
+
this.target.techniques.draw(getDrawParams(this.target, this._geom.volClassCopyZ)); // This method uses the EXT_frag_depth extension
|
|
1240
1600
|
System.instance.bindTexture2d(TextureUnit.Zero, undefined);
|
|
1241
1601
|
this.target.popBranch();
|
|
1242
1602
|
});
|
|
1243
1603
|
}
|
|
1244
1604
|
if (renderForReadPixels) {
|
|
1245
1605
|
// Set the stencil for all of the classifier volumes.
|
|
1246
|
-
System.instance.frameBufferStack.execute(this.
|
|
1606
|
+
System.instance.frameBufferStack.execute(this._fbos.altZOnly, false, this.useMsBuffers, () => {
|
|
1247
1607
|
this.target.pushState(this._vcBranchState);
|
|
1248
1608
|
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1249
1609
|
this.target.techniques.execute(this.target, cmds, 6 /* Classification */);
|
|
@@ -1265,7 +1625,7 @@ class Compositor extends SceneCompositor {
|
|
|
1265
1625
|
this.setAllStencilOps(this._vcColorRenderState, GL.StencilOperation.Keep); // don't clear the stencil so that all classifiers behind reality mesh will still draw
|
|
1266
1626
|
this.target.activeVolumeClassifierTexture = this._geom.volClassCopyZ.texture;
|
|
1267
1627
|
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1268
|
-
this.
|
|
1628
|
+
this._fbos.stencilSet.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1269
1629
|
this.renderIndexedClassifierForReadPixels(cmds, this._vcColorRenderState, false, needComposite);
|
|
1270
1630
|
this.target.activeVolumeClassifierTexture = undefined;
|
|
1271
1631
|
this._vcColorRenderState.flags.depthTest = false;
|
|
@@ -1360,7 +1720,7 @@ class Compositor extends SceneCompositor {
|
|
|
1360
1720
|
}
|
|
1361
1721
|
else {
|
|
1362
1722
|
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1363
|
-
this.
|
|
1723
|
+
this._fbos.stencilSet.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1364
1724
|
fbStack.execute(volClassBlendFbo, false, this.useMsBuffers, () => {
|
|
1365
1725
|
// For coloring the inside by element color we will draw the inside using the the classifiers themselves.
|
|
1366
1726
|
// To do this we need to first clear our Alt-Z. The shader will then test and write Z and will discard
|
|
@@ -1400,888 +1760,147 @@ class Compositor extends SceneCompositor {
|
|
|
1400
1760
|
// if (cmdsSelected.length > 0 && insideFlags !== this.target.activeVolumeClassifierProps!.flags.selected) {
|
|
1401
1761
|
if (!doColorByElement && cmdsSelected.length > 0 && insideFlags !== SpatialClassifierInsideDisplay.Hilite) { // assume selected ones are always hilited
|
|
1402
1762
|
// Set the stencil using just the hilited volume classifiers.
|
|
1403
|
-
fbStack.execute(this.
|
|
1763
|
+
fbStack.execute(this._fbos.stencilSet, false, this.useMsBuffers, () => {
|
|
1404
1764
|
this.target.pushState(this._vcBranchState);
|
|
1405
|
-
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1406
|
-
if (needAltZ) {
|
|
1407
|
-
// If we are using the alternate Z then the stencil that goes with the original Z has not been cleared yet, so clear it here.
|
|
1408
|
-
System.instance.context.clearStencil(0);
|
|
1409
|
-
System.instance.context.clear(GL.BufferBit.Stencil);
|
|
1410
|
-
}
|
|
1411
|
-
this.target.techniques.execute(this.target, cmdsSelected, 6 /* Classification */);
|
|
1412
|
-
this.target.popBranch();
|
|
1413
|
-
});
|
|
1414
|
-
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1415
|
-
this._frameBuffers.altZOnly.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1416
|
-
fbStack.execute(this._frameBuffers.volClassCreateBlend, false, this.useMsBuffers, () => {
|
|
1417
|
-
this._geom.volClassSetBlend.boundaryType = BoundaryType.Selected;
|
|
1418
|
-
this._geom.volClassSetBlend.texture = this._vcAltDepthStencil.getHandle(); // need to attach the alt depth instead of the real one since it is bound to the frame buffer
|
|
1419
|
-
this.target.pushState(this.target.decorationsState);
|
|
1420
|
-
this._vcColorRenderState.flags.blend = false;
|
|
1421
|
-
System.instance.applyRenderState(this._vcColorRenderState);
|
|
1422
|
-
const params = getDrawParams(this.target, this._geom.volClassSetBlend);
|
|
1423
|
-
this.target.techniques.draw(params);
|
|
1424
|
-
this._vcColorRenderState.flags.blend = true;
|
|
1425
|
-
this.target.popBranch();
|
|
1426
|
-
System.instance.bindTexture2d(TextureUnit.Zero, undefined);
|
|
1427
|
-
});
|
|
1428
|
-
}
|
|
1429
|
-
// Now modify the color of the reality mesh by using the blend texture to blend with it.
|
|
1430
|
-
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers) {
|
|
1431
|
-
volClassBlendFbo.blitMsBuffersToTextures(false); // make sure the volClassBlend texture that we are about to read has been blitted
|
|
1432
|
-
}
|
|
1433
|
-
fbStack.execute(fboColorAndZ, false, this.useMsBuffers, () => {
|
|
1434
|
-
this.target.pushState(this.target.decorationsState);
|
|
1435
|
-
this._vcBlendRenderState.blend.setBlendFuncSeparate(GL.BlendFactor.SrcAlpha, GL.BlendFactor.Zero, GL.BlendFactor.OneMinusSrcAlpha, GL.BlendFactor.One);
|
|
1436
|
-
System.instance.applyRenderState(this._vcBlendRenderState);
|
|
1437
|
-
const params = getDrawParams(this.target, this._geom.volClassBlend);
|
|
1438
|
-
this.target.techniques.draw(params);
|
|
1439
|
-
this.target.popBranch();
|
|
1440
|
-
System.instance.bindTexture2d(TextureUnit.Zero, undefined);
|
|
1441
|
-
});
|
|
1442
|
-
// Process the flashed classifier if there is one.
|
|
1443
|
-
// Like the selected volumes, we do not need to do this step if we used by-element-color since the flashing is included in the element color.
|
|
1444
|
-
const flashedClassifierCmds = extractFlashedVolumeClassifierCommands(this.target.flashedId, cmdsByIndex, numCmdsPerClassifier);
|
|
1445
|
-
if (undefined !== flashedClassifierCmds && !doColorByElement) {
|
|
1446
|
-
// Set the stencil for this one classifier.
|
|
1447
|
-
fbStack.execute(this._frameBuffers.stencilSet, false, this.useMsBuffers, () => {
|
|
1448
|
-
this.target.pushState(this._vcBranchState);
|
|
1449
|
-
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1450
|
-
this.target.techniques.executeForIndexedClassifier(this.target, flashedClassifierCmds, 5 /* OpaqueGeneral */);
|
|
1451
|
-
this.target.popBranch();
|
|
1452
|
-
});
|
|
1453
|
-
// Process the stencil to flash the contents.
|
|
1454
|
-
fbStack.execute(fboColorAndZ, true, this.useMsBuffers, () => {
|
|
1455
|
-
this.target.pushState(this.target.decorationsState);
|
|
1456
|
-
this._vcColorRenderState.blend.color = [1.0, 1.0, 1.0, this.target.flashIntensity * 0.2];
|
|
1457
|
-
this._vcColorRenderState.blend.setBlendFuncSeparate(GL.BlendFactor.ConstAlpha, GL.BlendFactor.Zero, GL.BlendFactor.One, GL.BlendFactor.One);
|
|
1458
|
-
System.instance.applyRenderState(this._vcColorRenderState);
|
|
1459
|
-
const params = getDrawParams(this.target, this._geom.volClassColorStencil);
|
|
1460
|
-
this.target.techniques.draw(params);
|
|
1461
|
-
this.target.popBranch();
|
|
1462
|
-
});
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
renderHilite(commands) {
|
|
1466
|
-
const system = System.instance;
|
|
1467
|
-
system.frameBufferStack.execute(this._frameBuffers.hilite, true, false, () => {
|
|
1468
|
-
// Clear the hilite buffer.
|
|
1469
|
-
system.context.clearColor(0, 0, 0, 0);
|
|
1470
|
-
system.context.clear(GL.BufferBit.Color);
|
|
1471
|
-
// Draw the normal hilite geometry.
|
|
1472
|
-
this.drawPass(commands, 10 /* Hilite */);
|
|
1473
|
-
});
|
|
1474
|
-
// Process planar classifiers
|
|
1475
|
-
const planarClassifierCmds = commands.getCommands(18 /* HilitePlanarClassification */);
|
|
1476
|
-
if (0 !== planarClassifierCmds.length) {
|
|
1477
|
-
system.frameBufferStack.execute(this._frameBuffers.hiliteUsingStencil, true, false, () => {
|
|
1478
|
-
system.applyRenderState(this._opaqueRenderState);
|
|
1479
|
-
this.target.techniques.execute(this.target, planarClassifierCmds, 18 /* HilitePlanarClassification */);
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
// Process the volume classifiers.
|
|
1483
|
-
const vcHiliteCmds = commands.getCommands(16 /* HiliteClassification */);
|
|
1484
|
-
if (0 !== vcHiliteCmds.length && undefined !== this._vcBranchState) {
|
|
1485
|
-
// Set the stencil for the given classifier stencil volume.
|
|
1486
|
-
system.frameBufferStack.execute(this._frameBuffers.stencilSet, false, false, () => {
|
|
1487
|
-
this.target.pushState(this._vcBranchState);
|
|
1488
|
-
system.applyRenderState(this._vcSetStencilRenderState);
|
|
1489
|
-
this.target.techniques.execute(this.target, vcHiliteCmds, 10 /* Hilite */);
|
|
1490
|
-
this.target.popBranch();
|
|
1491
|
-
});
|
|
1492
|
-
// Process the stencil for the hilite data.
|
|
1493
|
-
system.frameBufferStack.execute(this._frameBuffers.hiliteUsingStencil, true, false, () => {
|
|
1494
|
-
system.applyRenderState(this._vcPickDataRenderState);
|
|
1495
|
-
this.target.techniques.execute(this.target, vcHiliteCmds, 10 /* Hilite */);
|
|
1496
|
-
});
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
composite() {
|
|
1500
|
-
System.instance.applyRenderState(RenderState.defaults);
|
|
1501
|
-
const params = getDrawParams(this.target, this._geom.composite);
|
|
1502
|
-
this.target.techniques.draw(params);
|
|
1503
|
-
}
|
|
1504
|
-
getRenderState(pass) {
|
|
1505
|
-
switch (pass) {
|
|
1506
|
-
case 1 /* OpaqueLayers */:
|
|
1507
|
-
case 7 /* TranslucentLayers */:
|
|
1508
|
-
case 11 /* OverlayLayers */:
|
|
1509
|
-
// NB: During pick, we don't want blending - it will mess up our pick buffer data and we don't care about the color data.
|
|
1510
|
-
// During normal draw, we don't use the pick buffers for anything, and we want color blending.
|
|
1511
|
-
// (We get away with this because surfaces always draw before their edges, and we're not depth-testing, so edges always draw atop surfaces without pick buffer testing).
|
|
1512
|
-
this._layerRenderState.flags.blend = !this.target.isReadPixelsInProgress;
|
|
1513
|
-
// Transparent non-overlay Layers are drawn between opaque and translucent passes. Test depth, don't write it, so that they blend with opaque.
|
|
1514
|
-
this._layerRenderState.flags.depthMask = 7 /* TranslucentLayers */ !== pass;
|
|
1515
|
-
this._layerRenderState.depthFunc = (7 /* TranslucentLayers */ === pass) ? GL.DepthFunc.Default : GL.DepthFunc.Always;
|
|
1516
|
-
return this._layerRenderState;
|
|
1517
|
-
case 2 /* OpaqueLinear */:
|
|
1518
|
-
case 3 /* OpaquePlanar */:
|
|
1519
|
-
case 5 /* OpaqueGeneral */:
|
|
1520
|
-
case 18 /* HilitePlanarClassification */:
|
|
1521
|
-
return this._opaqueRenderState;
|
|
1522
|
-
case 8 /* Translucent */:
|
|
1523
|
-
return this._translucentRenderState;
|
|
1524
|
-
case 10 /* Hilite */:
|
|
1525
|
-
return this._hiliteRenderState;
|
|
1526
|
-
case 15 /* BackgroundMap */:
|
|
1527
|
-
return this._backgroundMapRenderState;
|
|
1528
|
-
case 4 /* PointClouds */:
|
|
1529
|
-
return this._pointCloudRenderState;
|
|
1530
|
-
default:
|
|
1531
|
-
return this._noDepthMaskRenderState;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
drawPass(commands, pass, pingPong = false, cmdPass = 255 /* None */) {
|
|
1535
|
-
const cmds = commands.getCommands(255 /* None */ !== cmdPass ? cmdPass : pass);
|
|
1536
|
-
if (0 === cmds.length) {
|
|
1537
|
-
return;
|
|
1538
|
-
}
|
|
1539
|
-
else if (pingPong) {
|
|
1540
|
-
this.pingPong();
|
|
1541
|
-
}
|
|
1542
|
-
System.instance.applyRenderState(this.getRenderState(pass));
|
|
1543
|
-
this.target.techniques.execute(this.target, cmds, pass);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
class MRTFrameBuffers extends FrameBuffers {
|
|
1547
|
-
init(textures, depth, depthMs) {
|
|
1548
|
-
if (!super.init(textures, depth, depthMs))
|
|
1549
|
-
return false;
|
|
1550
|
-
assert(undefined === this.opaqueAll);
|
|
1551
|
-
if (!this.initPotentialMSMRTFbos(textures, depth, depthMs))
|
|
1552
|
-
return false;
|
|
1553
|
-
assert(undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
1554
|
-
const colors = [textures.accumulation, textures.revealage];
|
|
1555
|
-
this.translucent = FrameBuffer.create(colors, depth);
|
|
1556
|
-
this.clearTranslucent = FrameBuffer.create(colors);
|
|
1557
|
-
// We borrow the SceneCompositor's accum and revealage textures for the surface pass.
|
|
1558
|
-
// First we render edges, writing to our textures.
|
|
1559
|
-
// Then we copy our textures to borrowed textures.
|
|
1560
|
-
// Finally we render surfaces, writing to our textures and reading from borrowed textures.
|
|
1561
|
-
assert(undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
1562
|
-
const pingPong = [textures.accumulation, textures.revealage];
|
|
1563
|
-
this.pingPong = FrameBuffer.create(pingPong);
|
|
1564
|
-
return undefined !== this.translucent
|
|
1565
|
-
&& undefined !== this.clearTranslucent
|
|
1566
|
-
&& undefined !== this.pingPong;
|
|
1567
|
-
}
|
|
1568
|
-
initPotentialMSMRTFbos(textures, depth, depthMs) {
|
|
1569
|
-
const boundColor = System.instance.frameBufferStack.currentColorBuffer;
|
|
1570
|
-
assert(undefined !== boundColor && undefined !== textures.color && undefined !== textures.featureId && undefined !== textures.depthAndOrder && undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
1571
|
-
const colorAndPick = [boundColor, textures.featureId, textures.depthAndOrder];
|
|
1572
|
-
if (undefined === depthMs) {
|
|
1573
|
-
this.opaqueAll = FrameBuffer.create(colorAndPick, depth);
|
|
1574
|
-
colorAndPick[0] = textures.color;
|
|
1575
|
-
this.opaqueAndCompositeAll = FrameBuffer.create(colorAndPick, depth);
|
|
1576
|
-
}
|
|
1577
|
-
else {
|
|
1578
|
-
assert(undefined !== textures.colorMsBuff && undefined !== textures.featureIdMsBuff && undefined !== textures.featureIdMsBuffHidden && undefined !== textures.depthAndOrderMsBuff && undefined !== textures.depthAndOrderMsBuffHidden);
|
|
1579
|
-
const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff];
|
|
1580
|
-
const colorAndPickFilters = [GL.MultiSampling.Filter.Linear, GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
1581
|
-
this.opaqueAll = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
1582
|
-
colorAndPick[0] = textures.color;
|
|
1583
|
-
this.opaqueAndCompositeAll = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
1584
|
-
}
|
|
1585
|
-
return undefined !== this.opaqueAll
|
|
1586
|
-
&& undefined !== this.opaqueAndCompositeAll;
|
|
1587
|
-
}
|
|
1588
|
-
enableOcclusion(textures, depth, depthMs) {
|
|
1589
|
-
let rVal = super.enableOcclusion(textures, depth, depthMs);
|
|
1590
|
-
if (undefined === depthMs) {
|
|
1591
|
-
// If not using multisampling then we can use the accumulation and revealage textures for the hidden pick buffers,
|
|
1592
|
-
assert(undefined !== textures.color && undefined !== textures.accumulation && undefined !== textures.revealage);
|
|
1593
|
-
const colorAndPick = [textures.color, textures.accumulation, textures.revealage];
|
|
1594
|
-
this.opaqueAndCompositeAllHidden = FrameBuffer.create(colorAndPick, depth);
|
|
1595
|
-
rVal = rVal && undefined !== this.opaqueAndCompositeAllHidden;
|
|
1596
|
-
}
|
|
1597
|
-
else {
|
|
1598
|
-
// If multisampling then we cannot use the revealage texture for depthAndOrder for the hidden edges since it is of the wrong type for blitting,
|
|
1599
|
-
// so instead use a special depthAndOrderHidden texture just for this purpose.
|
|
1600
|
-
// The featureId texture is not needed for hidden edges, so the accumulation texture can be used for it if we don't blit from the multisample bufffer into it.
|
|
1601
|
-
assert(undefined !== textures.color && undefined !== textures.accumulation && undefined !== textures.depthAndOrderHidden);
|
|
1602
|
-
assert(undefined !== textures.colorMsBuff && undefined !== textures.featureIdMsBuffHidden && undefined !== textures.depthAndOrderMsBuffHidden);
|
|
1603
|
-
const colorAndPick = [textures.color, textures.accumulation, textures.depthAndOrderHidden];
|
|
1604
|
-
const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuffHidden, textures.depthAndOrderMsBuffHidden];
|
|
1605
|
-
const colorAndPickFilters = [GL.MultiSampling.Filter.Linear, GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
1606
|
-
this.opaqueAndCompositeAllHidden = FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
1607
|
-
// We will also need a frame buffer for copying the real pick data buffers into these hidden edge pick data buffers.
|
|
1608
|
-
const pingPong = [textures.accumulation, textures.depthAndOrderHidden];
|
|
1609
|
-
const pingPongMSBuffs = [textures.featureIdMsBuffHidden, textures.depthAndOrderMsBuffHidden];
|
|
1610
|
-
const pingPongFilters = [GL.MultiSampling.Filter.Nearest, GL.MultiSampling.Filter.Nearest];
|
|
1611
|
-
this.pingPongMS = FrameBuffer.create(pingPong, depth, pingPongMSBuffs, pingPongFilters, depthMs);
|
|
1612
|
-
rVal = rVal && undefined !== this.opaqueAndCompositeAllHidden && (undefined === depthMs || undefined !== this.pingPongMS);
|
|
1613
|
-
}
|
|
1614
|
-
return rVal;
|
|
1615
|
-
}
|
|
1616
|
-
disableOcclusion() {
|
|
1617
|
-
super.disableOcclusion();
|
|
1618
|
-
this.opaqueAndCompositeAllHidden = dispose(this.opaqueAndCompositeAllHidden);
|
|
1619
|
-
this.pingPongMS = dispose(this.pingPongMS);
|
|
1620
|
-
}
|
|
1621
|
-
enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
1622
|
-
const boundColor = System.instance.frameBufferStack.currentColorBuffer;
|
|
1623
|
-
if (undefined === boundColor)
|
|
1624
|
-
return;
|
|
1625
|
-
super.enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS);
|
|
1626
|
-
if (undefined !== this.opaqueAll && undefined !== this.opaqueAndCompositeAll) {
|
|
1627
|
-
if (undefined !== volClassDepth) {
|
|
1628
|
-
let ids = [this.opaqueAll.getColor(0), this.opaqueAll.getColor(1)];
|
|
1629
|
-
this.idsAndZ = FrameBuffer.create(ids, depth);
|
|
1630
|
-
this.idsAndAltZ = FrameBuffer.create(ids, volClassDepth);
|
|
1631
|
-
ids = [this.opaqueAndCompositeAll.getColor(0), this.opaqueAndCompositeAll.getColor(1)];
|
|
1632
|
-
this.idsAndZComposite = FrameBuffer.create(ids, depth);
|
|
1633
|
-
this.idsAndAltZComposite = FrameBuffer.create(ids, volClassDepth);
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
disableVolumeClassifier() {
|
|
1638
|
-
super.disableVolumeClassifier();
|
|
1639
|
-
if (undefined !== this.idsAndZ) {
|
|
1640
|
-
this.idsAndZ = dispose(this.idsAndZ);
|
|
1641
|
-
this.idsAndAltZ = dispose(this.idsAndAltZ);
|
|
1642
|
-
this.idsAndZComposite = dispose(this.idsAndZComposite);
|
|
1643
|
-
this.idsAndAltZComposite = dispose(this.idsAndAltZComposite);
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
enableMultiSampling(textures, depth, depthMS) {
|
|
1647
|
-
super.enableMultiSampling(textures, depth, depthMS);
|
|
1648
|
-
this.opaqueAll = dispose(this.opaqueAll);
|
|
1649
|
-
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
1650
|
-
return this.initPotentialMSMRTFbos(textures, depth, depthMS);
|
|
1651
|
-
}
|
|
1652
|
-
disableMultiSampling(textures, depth) {
|
|
1653
|
-
this.opaqueAll = dispose(this.opaqueAll);
|
|
1654
|
-
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
1655
|
-
if (!this.initPotentialMSMRTFbos(textures, depth, undefined))
|
|
1656
|
-
return false;
|
|
1657
|
-
return super.disableMultiSampling(textures, depth);
|
|
1658
|
-
}
|
|
1659
|
-
get isDisposed() {
|
|
1660
|
-
return super.isDisposed
|
|
1661
|
-
&& undefined === this.opaqueAll
|
|
1662
|
-
&& undefined === this.opaqueAndCompositeAll
|
|
1663
|
-
&& undefined === this.opaqueAndCompositeAllHidden
|
|
1664
|
-
&& undefined === this.pingPong
|
|
1665
|
-
&& undefined === this.pingPongMS
|
|
1666
|
-
&& undefined === this.translucent
|
|
1667
|
-
&& undefined === this.clearTranslucent
|
|
1668
|
-
&& undefined === this.idsAndZ
|
|
1669
|
-
&& undefined === this.idsAndAltZ
|
|
1670
|
-
&& undefined === this.idsAndZComposite
|
|
1671
|
-
&& undefined === this.idsAndAltZComposite
|
|
1672
|
-
&& undefined === this.edlDrawCol;
|
|
1673
|
-
}
|
|
1674
|
-
dispose() {
|
|
1675
|
-
super.dispose();
|
|
1676
|
-
this.opaqueAll = dispose(this.opaqueAll);
|
|
1677
|
-
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAll);
|
|
1678
|
-
this.opaqueAndCompositeAll = dispose(this.opaqueAndCompositeAllHidden);
|
|
1679
|
-
this.pingPong = dispose(this.pingPong);
|
|
1680
|
-
this.pingPongMS = dispose(this.pingPongMS);
|
|
1681
|
-
this.translucent = dispose(this.translucent);
|
|
1682
|
-
this.clearTranslucent = dispose(this.clearTranslucent);
|
|
1683
|
-
this.idsAndZ = dispose(this.idsAndZ);
|
|
1684
|
-
this.idsAndAltZ = dispose(this.idsAndAltZ);
|
|
1685
|
-
this.idsAndZComposite = dispose(this.idsAndZComposite);
|
|
1686
|
-
this.idsAndAltZComposite = dispose(this.idsAndAltZComposite);
|
|
1687
|
-
this.edlDrawCol = dispose(this.edlDrawCol);
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
class MRTGeometry extends Geometry {
|
|
1691
|
-
collectStatistics(stats) {
|
|
1692
|
-
super.collectStatistics(stats);
|
|
1693
|
-
collectGeometryStatistics(this.copyPickBuffers, stats);
|
|
1694
|
-
collectGeometryStatistics(this.clearTranslucent, stats);
|
|
1695
|
-
collectGeometryStatistics(this.clearPickAndColor, stats);
|
|
1696
|
-
}
|
|
1697
|
-
init(textures) {
|
|
1698
|
-
if (!super.init(textures))
|
|
1699
|
-
return false;
|
|
1700
|
-
assert(undefined === this.copyPickBuffers);
|
|
1701
|
-
this.copyPickBuffers = CopyPickBufferGeometry.createGeometry(textures.featureId.getHandle(), textures.depthAndOrder.getHandle());
|
|
1702
|
-
this.clearTranslucent = ViewportQuadGeometry.create(16 /* OITClearTranslucent */);
|
|
1703
|
-
this.clearPickAndColor = ViewportQuadGeometry.create(21 /* ClearPickAndColor */);
|
|
1704
|
-
return undefined !== this.copyPickBuffers && undefined !== this.clearTranslucent && undefined !== this.clearPickAndColor;
|
|
1705
|
-
}
|
|
1706
|
-
get isDisposed() {
|
|
1707
|
-
return super.isDisposed
|
|
1708
|
-
&& undefined === this.copyPickBuffers
|
|
1709
|
-
&& undefined === this.clearTranslucent
|
|
1710
|
-
&& undefined === this.clearPickAndColor;
|
|
1711
|
-
}
|
|
1712
|
-
dispose() {
|
|
1713
|
-
super.dispose();
|
|
1714
|
-
this.copyPickBuffers = dispose(this.copyPickBuffers);
|
|
1715
|
-
this.clearTranslucent = dispose(this.clearTranslucent);
|
|
1716
|
-
this.clearPickAndColor = dispose(this.clearPickAndColor);
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
// SceneCompositor used when multiple render targets are supported (WEBGL_draw_buffers exists and supports at least 4 color attachments).
|
|
1720
|
-
class MRTCompositor extends Compositor {
|
|
1721
|
-
constructor(target) {
|
|
1722
|
-
super(target, new MRTFrameBuffers(), new MRTGeometry());
|
|
1723
|
-
}
|
|
1724
|
-
get currentRenderTargetIndex() {
|
|
1725
|
-
assert(false, "MRT is supported");
|
|
1726
|
-
return 0;
|
|
1727
|
-
}
|
|
1728
|
-
set currentRenderTargetIndex(_index) {
|
|
1729
|
-
assert(false, "MRT is supported");
|
|
1730
|
-
}
|
|
1731
|
-
get featureIds() { return this.getSamplerTexture(this._readPickDataFromPingPong ? 0 : 1); }
|
|
1732
|
-
get depthAndOrder() { return this.getSamplerTexture(this._readPickDataFromPingPong ? 1 : 2); }
|
|
1733
|
-
get _fbos() { return this._frameBuffers; }
|
|
1734
|
-
get _geometry() { return this._geom; }
|
|
1735
|
-
enableVolumeClassifierFbos(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
1736
|
-
this._fbos.enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS);
|
|
1737
|
-
}
|
|
1738
|
-
disableVolumeClassifierFbos() { this._fbos.disableVolumeClassifier(); }
|
|
1739
|
-
enableMultiSampling() {
|
|
1740
|
-
if (!super.enableMultiSampling())
|
|
1741
|
-
return false;
|
|
1742
|
-
assert(undefined !== this._depth && undefined !== this._depthMS);
|
|
1743
|
-
return this._fbos.enableMultiSampling(this._textures, this._depth, this._depthMS);
|
|
1744
|
-
}
|
|
1745
|
-
disableMultiSampling() {
|
|
1746
|
-
assert(undefined !== this._depth);
|
|
1747
|
-
if (!this._fbos.disableMultiSampling(this._textures, this._depth))
|
|
1748
|
-
return false;
|
|
1749
|
-
return super.disableMultiSampling();
|
|
1750
|
-
}
|
|
1751
|
-
clearOpaque(needComposite) {
|
|
1752
|
-
const fbo = needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll;
|
|
1753
|
-
const system = System.instance;
|
|
1754
|
-
system.frameBufferStack.execute(fbo, true, this.useMsBuffers, () => {
|
|
1755
|
-
// Clear pick data buffers to 0's and color buffer to background color
|
|
1756
|
-
// (0,0,0,0) in elementID0 and ElementID1 buffers indicates invalid element id
|
|
1757
|
-
// (0,0,0,0) in DepthAndOrder buffer indicates render order 0 and encoded depth of 0 (= far plane)
|
|
1758
|
-
system.applyRenderState(this._noDepthMaskRenderState);
|
|
1759
|
-
const params = getDrawParams(this.target, this._geometry.clearPickAndColor);
|
|
1760
|
-
this.target.techniques.draw(params);
|
|
1761
|
-
// Clear depth buffer
|
|
1762
|
-
system.applyRenderState(RenderState.defaults); // depthMask == true.
|
|
1763
|
-
system.context.clearDepth(1.0);
|
|
1764
|
-
system.context.clear(GL.BufferBit.Depth);
|
|
1765
|
-
});
|
|
1766
|
-
}
|
|
1767
|
-
renderPointClouds(commands, compositeFlags) {
|
|
1768
|
-
var _a, _b;
|
|
1769
|
-
const is3d = 2 /* Perspective */ === this.target.uniforms.frustum.type;
|
|
1770
|
-
// separate individual point clouds and get their point cloud settings
|
|
1771
|
-
const pointClouds = [];
|
|
1772
|
-
let pcs;
|
|
1773
|
-
const cmds = commands.getCommands(4 /* PointClouds */);
|
|
1774
|
-
let curPC;
|
|
1775
|
-
let pushDepth = 0;
|
|
1776
|
-
for (const cmd of cmds) {
|
|
1777
|
-
if ("pushBranch" === cmd.opcode) { // should be first command
|
|
1778
|
-
++pushDepth;
|
|
1779
|
-
if (pushDepth === 1) {
|
|
1780
|
-
pcs = (_a = cmd.branch.branch.realityModelDisplaySettings) === null || _a === void 0 ? void 0 : _a.pointCloud;
|
|
1781
|
-
this.target.uniforms.realityModel.pointCloud.updateRange(cmd.branch.branch.realityModelRange, this.target, cmd.branch.localToWorldTransform, is3d);
|
|
1782
|
-
pointClouds.push(curPC = { pcs, cmds: [cmd] });
|
|
1783
|
-
}
|
|
1784
|
-
else {
|
|
1785
|
-
assert(undefined !== curPC);
|
|
1786
|
-
curPC.cmds.push(cmd);
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
else {
|
|
1790
|
-
if ("popBranch" === cmd.opcode)
|
|
1791
|
-
--pushDepth;
|
|
1792
|
-
assert(undefined !== curPC);
|
|
1793
|
-
curPC.cmds.push(cmd);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
const needComposite = 0 /* None */ !== compositeFlags;
|
|
1797
|
-
const fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
|
|
1798
|
-
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
1799
|
-
const system = System.instance;
|
|
1800
|
-
const fbStack = system.frameBufferStack;
|
|
1801
|
-
this._readPickDataFromPingPong = false;
|
|
1802
|
-
for (const pc of pointClouds) {
|
|
1803
|
-
pcs = pc.pcs;
|
|
1804
|
-
let edlOn = (pcs === null || pcs === void 0 ? void 0 : pcs.edlMode) !== "off" && is3d;
|
|
1805
|
-
if (edlOn) {
|
|
1806
|
-
if (undefined === this._textures.hilite)
|
|
1807
|
-
edlOn = false;
|
|
1808
|
-
else {
|
|
1809
|
-
// create fbo on fly if not present, or has changed (from MS)
|
|
1810
|
-
// ###TODO consider not drawing point clouds to MS buffers, at least if EDL, it isn't worth the overhead.
|
|
1811
|
-
// would have to blit depth before draw, use depth for draw, then run shader to copy depth back to MSAA
|
|
1812
|
-
// at end, wherever color buf changed (test alpha, else discard)
|
|
1813
|
-
// this would also simplify this code considerably
|
|
1814
|
-
let drawColBufs;
|
|
1815
|
-
if (undefined !== this._fbos.edlDrawCol)
|
|
1816
|
-
drawColBufs = this._fbos.edlDrawCol.getColorTargets(useMsBuffers, 0);
|
|
1817
|
-
if (undefined === this._fbos.edlDrawCol || this._textures.hilite !== (drawColBufs === null || drawColBufs === void 0 ? void 0 : drawColBufs.tex) || this._textures.hiliteMsBuff !== drawColBufs.msBuf) {
|
|
1818
|
-
this._fbos.edlDrawCol = dispose(this._fbos.edlDrawCol);
|
|
1819
|
-
const filters = [GL.MultiSampling.Filter.Linear];
|
|
1820
|
-
if (useMsBuffers)
|
|
1821
|
-
this._fbos.edlDrawCol = FrameBuffer.create([this._textures.hilite], this._depth, useMsBuffers && this._textures.hiliteMsBuff ? [this._textures.hiliteMsBuff] : undefined, filters, this._depthMS);
|
|
1822
|
-
else
|
|
1823
|
-
this._fbos.edlDrawCol = FrameBuffer.create([this._textures.hilite], this._depth);
|
|
1824
|
-
}
|
|
1825
|
-
if (undefined === this._fbos.edlDrawCol)
|
|
1826
|
-
edlOn = false;
|
|
1827
|
-
else { // can draw EDL
|
|
1828
|
-
// first draw pointcloud to borrowed hilite texture(MS) and regular depth(MS) buffers
|
|
1829
|
-
fbStack.execute(this._fbos.edlDrawCol, true, useMsBuffers, () => {
|
|
1830
|
-
system.context.clearColor(0, 0, 0, 0);
|
|
1831
|
-
system.context.clear(GL.BufferBit.Color);
|
|
1832
|
-
system.applyRenderState(this.getRenderState(4 /* PointClouds */));
|
|
1833
|
-
this.target.techniques.execute(this.target, pc.cmds, 4 /* PointClouds */);
|
|
1834
|
-
});
|
|
1835
|
-
if (useMsBuffers)
|
|
1836
|
-
this._fbos.edlDrawCol.blitMsBuffersToTextures(true, 0); // need to read the non-MS depth and hilite buffers
|
|
1837
|
-
// next process buffers to generate EDL (depth buffer is passed during init)
|
|
1838
|
-
this.target.beginPerfMetricRecord("Calc EDL"); // ### todo keep? (probably)
|
|
1839
|
-
const sts = this.eyeDomeLighting.draw({
|
|
1840
|
-
edlMode: ((_b = pc.pcs) === null || _b === void 0 ? void 0 : _b.edlMode) === "full" ? EDLMode.Full : EDLMode.On,
|
|
1841
|
-
edlFilter: !!(pcs === null || pcs === void 0 ? void 0 : pcs.edlFilter),
|
|
1842
|
-
useMsBuffers,
|
|
1843
|
-
inputTex: this._textures.hilite,
|
|
1844
|
-
curFbo: fbo,
|
|
1845
|
-
});
|
|
1846
|
-
this.target.endPerfMetricRecord();
|
|
1847
|
-
if (!sts) {
|
|
1848
|
-
edlOn = false;
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
if (!edlOn) {
|
|
1854
|
-
// draw the regular way
|
|
1855
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1856
|
-
system.applyRenderState(this.getRenderState(4 /* PointClouds */));
|
|
1857
|
-
this.target.techniques.execute(this.target, pc.cmds, 4 /* PointClouds */);
|
|
1858
|
-
});
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
}
|
|
1862
|
-
renderOpaque(commands, compositeFlags, renderForReadPixels) {
|
|
1863
|
-
if (0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */) && !renderForReadPixels) {
|
|
1864
|
-
this.renderOpaqueAO(commands);
|
|
1865
|
-
return;
|
|
1866
|
-
}
|
|
1867
|
-
const needComposite = 0 /* None */ !== compositeFlags;
|
|
1868
|
-
const fbStack = System.instance.frameBufferStack;
|
|
1869
|
-
// Output the first 2 passes to color and pick data buffers. (All 3 in the case of rendering for readPixels() or ambient occlusion).
|
|
1870
|
-
let fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
|
|
1871
|
-
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
1872
|
-
this._readPickDataFromPingPong = !useMsBuffers; // if multisampling then can read pick textures directly.
|
|
1873
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1874
|
-
this.drawPass(commands, 2 /* OpaqueLinear */);
|
|
1875
|
-
this.drawPass(commands, 3 /* OpaquePlanar */, true);
|
|
1876
|
-
if (renderForReadPixels) {
|
|
1877
|
-
this.drawPass(commands, 4 /* PointClouds */, true); // don't need EDL for this
|
|
1878
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, true);
|
|
1879
|
-
if (useMsBuffers)
|
|
1880
|
-
fbo.blitMsBuffersToTextures(true);
|
|
1881
|
-
}
|
|
1882
|
-
});
|
|
1883
|
-
this._readPickDataFromPingPong = false;
|
|
1884
|
-
// The general pass (and following) will not bother to write to pick buffers and so can read from the actual pick buffers.
|
|
1885
|
-
if (!renderForReadPixels) {
|
|
1886
|
-
fbo = (needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor);
|
|
1887
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1888
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
1889
|
-
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
1890
|
-
});
|
|
1891
|
-
// assume we are done with MS at this point, so update the non-MS buffers
|
|
1892
|
-
if (useMsBuffers)
|
|
1893
|
-
fbo.blitMsBuffersToTextures(needComposite);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
renderOpaqueAO(commands) {
|
|
1897
|
-
const fbStack = System.instance.frameBufferStack;
|
|
1898
|
-
const haveHiddenEdges = 0 !== commands.getCommands(9 /* HiddenEdge */).length;
|
|
1899
|
-
// Output the linear, planar, and pickable surfaces to color and pick data buffers.
|
|
1900
|
-
let fbo = this._fbos.opaqueAndCompositeAll;
|
|
1901
|
-
const useMsBuffers = fbo.isMultisampled && this.useMsBuffers;
|
|
1902
|
-
this._readPickDataFromPingPong = !useMsBuffers; // if multisampling then can read pick textures directly.
|
|
1903
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1904
|
-
this.drawPass(commands, 2 /* OpaqueLinear */);
|
|
1905
|
-
this.drawPass(commands, 3 /* OpaquePlanar */, true);
|
|
1906
|
-
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
1907
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, true);
|
|
1908
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
1909
|
-
if (useMsBuffers)
|
|
1910
|
-
fbo.blitMsBuffersToTextures(true);
|
|
1911
|
-
});
|
|
1912
|
-
this._readPickDataFromPingPong = false;
|
|
1913
|
-
// Output the non-pickable surfaces and hidden edges to just the color buffer.
|
|
1914
|
-
fbo = this._fbos.opaqueAndCompositeColor;
|
|
1915
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1916
|
-
this._primitiveDrawState = PrimitiveDrawState.NonPickable;
|
|
1917
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
1918
|
-
if (haveHiddenEdges)
|
|
1919
|
-
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
1920
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
1921
|
-
});
|
|
1922
|
-
if (useMsBuffers)
|
|
1923
|
-
fbo.blitMsBuffersToTextures(true);
|
|
1924
|
-
// If there are no hidden edges, then we're done & can run the AO passes using the normal depthAndOrder texture.
|
|
1925
|
-
if (haveHiddenEdges) {
|
|
1926
|
-
// AO needs the pick data (orderAndDepth) for the hidden edges. We don't want it in with the other pick data though since they are not pickable, so we will use other textures.
|
|
1927
|
-
// If not multisampling we will re-use the ping-pong/transparency textures since we are done with ping-ponging at this point and transparency happens later.
|
|
1928
|
-
// If multisampling then we will use the accumulation texture for featureIDs and a special texture for depthAndOrder since the revealage texture is not the right type for multisampling.
|
|
1929
|
-
// First we will need to copy what's in the pick buffers so far into the hidden pick buffers.
|
|
1930
|
-
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
1931
|
-
fbo = (useMsBuffers ? this._fbos.pingPongMS : this._fbos.pingPong);
|
|
1932
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1933
|
-
const params = getDrawParams(this.target, this._geometry.copyPickBuffers);
|
|
1934
|
-
this.target.techniques.draw(params);
|
|
1935
|
-
});
|
|
1936
|
-
if (useMsBuffers)
|
|
1937
|
-
fbo.blitMsBuffersToTextures(false, 1); // only want to blit the depth/order target
|
|
1938
|
-
// Now draw the hidden edges, using an fbo which places their depth/order into the hidden pick buffers.
|
|
1939
|
-
// Since we are not writing to the actual pick buffers we let this._readPickDataFromPingPong remain false.
|
|
1940
|
-
fbo = this._fbos.opaqueAndCompositeAllHidden;
|
|
1941
|
-
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
1942
|
-
fbStack.execute(fbo, true, useMsBuffers, () => {
|
|
1943
|
-
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
1944
|
-
});
|
|
1945
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
1946
|
-
if (useMsBuffers) {
|
|
1947
|
-
// Only want to blit the color and depth/order targets as the featureId target is not blit-able and will generate a GL error.
|
|
1948
|
-
fbo.blitMsBuffersToTextures(false, 0);
|
|
1949
|
-
fbo.blitMsBuffersToTextures(false, 2);
|
|
1950
|
-
}
|
|
1951
|
-
this._needHiddenEdges = false;
|
|
1952
|
-
}
|
|
1953
|
-
this._needHiddenEdges = haveHiddenEdges; // this will cause the alternate renderAndOrder texture with the hidden edges to be read for the 2nd AO blur pass.
|
|
1954
|
-
this.renderAmbientOcclusion();
|
|
1955
|
-
this._needHiddenEdges = false;
|
|
1956
|
-
}
|
|
1957
|
-
renderLayers(commands, needComposite, pass) {
|
|
1958
|
-
const fbo = (needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll);
|
|
1959
|
-
const useMsBuffers = 1 /* OpaqueLayers */ === pass && fbo.isMultisampled && this.useMsBuffers;
|
|
1960
|
-
this._readPickDataFromPingPong = !useMsBuffers;
|
|
1961
|
-
System.instance.frameBufferStack.execute(fbo, true, useMsBuffers, () => {
|
|
1962
|
-
this.drawPass(commands, pass, true);
|
|
1963
|
-
});
|
|
1964
|
-
this._readPickDataFromPingPong = false;
|
|
1965
|
-
}
|
|
1966
|
-
renderForVolumeClassification(commands, compositeFlags, renderForReadPixels) {
|
|
1967
|
-
const needComposite = 0 /* None */ !== compositeFlags;
|
|
1968
|
-
const needAO = 0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */);
|
|
1969
|
-
const fbStack = System.instance.frameBufferStack;
|
|
1970
|
-
if (renderForReadPixels || needAO) {
|
|
1971
|
-
this._readPickDataFromPingPong = true;
|
|
1972
|
-
fbStack.execute(needComposite ? this._fbos.opaqueAndCompositeAll : this._fbos.opaqueAll, true, this.useMsBuffers, () => {
|
|
1973
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, true, 20 /* VolumeClassifiedRealityData */);
|
|
1765
|
+
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1766
|
+
if (needAltZ) {
|
|
1767
|
+
// If we are using the alternate Z then the stencil that goes with the original Z has not been cleared yet, so clear it here.
|
|
1768
|
+
System.instance.context.clearStencil(0);
|
|
1769
|
+
System.instance.context.clear(GL.BufferBit.Stencil);
|
|
1770
|
+
}
|
|
1771
|
+
this.target.techniques.execute(this.target, cmdsSelected, 6 /* Classification */);
|
|
1772
|
+
this.target.popBranch();
|
|
1974
1773
|
});
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
this.
|
|
1978
|
-
|
|
1979
|
-
this.
|
|
1774
|
+
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers)
|
|
1775
|
+
this._fbos.altZOnly.blitMsBuffersToTextures(true, -1); // make sure that the Z buffer that we are about to read has been blitted
|
|
1776
|
+
fbStack.execute(this._fbos.volClassCreateBlend, false, this.useMsBuffers, () => {
|
|
1777
|
+
this._geom.volClassSetBlend.boundaryType = BoundaryType.Selected;
|
|
1778
|
+
this._geom.volClassSetBlend.texture = this._vcAltDepthStencil.getHandle(); // need to attach the alt depth instead of the real one since it is bound to the frame buffer
|
|
1779
|
+
this.target.pushState(this.target.decorationsState);
|
|
1780
|
+
this._vcColorRenderState.flags.blend = false;
|
|
1781
|
+
System.instance.applyRenderState(this._vcColorRenderState);
|
|
1782
|
+
const params = getDrawParams(this.target, this._geom.volClassSetBlend);
|
|
1783
|
+
this.target.techniques.draw(params);
|
|
1784
|
+
this._vcColorRenderState.flags.blend = true;
|
|
1785
|
+
this.target.popBranch();
|
|
1786
|
+
System.instance.bindTexture2d(TextureUnit.Zero, undefined);
|
|
1980
1787
|
});
|
|
1981
1788
|
}
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
this._readPickDataFromPingPong = false;
|
|
1992
|
-
}
|
|
1993
|
-
clearTranslucent() {
|
|
1994
|
-
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
1995
|
-
System.instance.frameBufferStack.execute(this._fbos.clearTranslucent, true, false, () => {
|
|
1996
|
-
const params = getDrawParams(this.target, this._geometry.clearTranslucent);
|
|
1789
|
+
// Now modify the color of the reality mesh by using the blend texture to blend with it.
|
|
1790
|
+
if (this._antialiasSamples > 1 && undefined !== this._depthMS && this.useMsBuffers) {
|
|
1791
|
+
volClassBlendFbo.blitMsBuffersToTextures(false); // make sure the volClassBlend texture that we are about to read has been blitted
|
|
1792
|
+
}
|
|
1793
|
+
fbStack.execute(fboColorAndZ, false, this.useMsBuffers, () => {
|
|
1794
|
+
this.target.pushState(this.target.decorationsState);
|
|
1795
|
+
this._vcBlendRenderState.blend.setBlendFuncSeparate(GL.BlendFactor.SrcAlpha, GL.BlendFactor.Zero, GL.BlendFactor.OneMinusSrcAlpha, GL.BlendFactor.One);
|
|
1796
|
+
System.instance.applyRenderState(this._vcBlendRenderState);
|
|
1797
|
+
const params = getDrawParams(this.target, this._geom.volClassBlend);
|
|
1997
1798
|
this.target.techniques.draw(params);
|
|
1799
|
+
this.target.popBranch();
|
|
1800
|
+
System.instance.bindTexture2d(TextureUnit.Zero, undefined);
|
|
1998
1801
|
});
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
1802
|
+
// Process the flashed classifier if there is one.
|
|
1803
|
+
// Like the selected volumes, we do not need to do this step if we used by-element-color since the flashing is included in the element color.
|
|
1804
|
+
const flashedClassifierCmds = extractFlashedVolumeClassifierCommands(this.target.flashedId, cmdsByIndex, numCmdsPerClassifier);
|
|
1805
|
+
if (undefined !== flashedClassifierCmds && !doColorByElement) {
|
|
1806
|
+
// Set the stencil for this one classifier.
|
|
1807
|
+
fbStack.execute(this._fbos.stencilSet, false, this.useMsBuffers, () => {
|
|
1808
|
+
this.target.pushState(this._vcBranchState);
|
|
1809
|
+
System.instance.applyRenderState(this._vcSetStencilRenderState);
|
|
1810
|
+
this.target.techniques.executeForIndexedClassifier(this.target, flashedClassifierCmds, 5 /* OpaqueGeneral */);
|
|
1811
|
+
this.target.popBranch();
|
|
1812
|
+
});
|
|
1813
|
+
// Process the stencil to flash the contents.
|
|
1814
|
+
fbStack.execute(fboColorAndZ, true, this.useMsBuffers, () => {
|
|
1815
|
+
this.target.pushState(this.target.decorationsState);
|
|
1816
|
+
this._vcColorRenderState.blend.color = [1.0, 1.0, 1.0, this.target.flashIntensity * 0.2];
|
|
1817
|
+
this._vcColorRenderState.blend.setBlendFuncSeparate(GL.BlendFactor.ConstAlpha, GL.BlendFactor.Zero, GL.BlendFactor.One, GL.BlendFactor.One);
|
|
1818
|
+
System.instance.applyRenderState(this._vcColorRenderState);
|
|
1819
|
+
const params = getDrawParams(this.target, this._geom.volClassColorStencil);
|
|
2015
1820
|
this.target.techniques.draw(params);
|
|
1821
|
+
this.target.popBranch();
|
|
2016
1822
|
});
|
|
2017
1823
|
}
|
|
2018
1824
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
if (undefined !== this.featureId) {
|
|
2036
|
-
this.featureIdWithDepth = FrameBuffer.create([this.featureId.getColor(0)], depth);
|
|
2037
|
-
this.featureIdWithDepthAltZ = FrameBuffer.create([this.featureId.getColor(0)], volClassDepth);
|
|
1825
|
+
renderHilite(commands) {
|
|
1826
|
+
const system = System.instance;
|
|
1827
|
+
system.frameBufferStack.execute(this._fbos.hilite, true, false, () => {
|
|
1828
|
+
// Clear the hilite buffer.
|
|
1829
|
+
system.context.clearColor(0, 0, 0, 0);
|
|
1830
|
+
system.context.clear(GL.BufferBit.Color);
|
|
1831
|
+
// Draw the normal hilite geometry.
|
|
1832
|
+
this.drawPass(commands, 10 /* Hilite */);
|
|
1833
|
+
});
|
|
1834
|
+
// Process planar classifiers
|
|
1835
|
+
const planarClassifierCmds = commands.getCommands(18 /* HilitePlanarClassification */);
|
|
1836
|
+
if (0 !== planarClassifierCmds.length) {
|
|
1837
|
+
system.frameBufferStack.execute(this._fbos.hiliteUsingStencil, true, false, () => {
|
|
1838
|
+
system.applyRenderState(this._opaqueRenderState);
|
|
1839
|
+
this.target.techniques.execute(this.target, planarClassifierCmds, 18 /* HilitePlanarClassification */);
|
|
1840
|
+
});
|
|
2038
1841
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
this.
|
|
2044
|
-
|
|
1842
|
+
// Process the volume classifiers.
|
|
1843
|
+
const vcHiliteCmds = commands.getCommands(16 /* HiliteClassification */);
|
|
1844
|
+
if (0 !== vcHiliteCmds.length && undefined !== this._vcBranchState) {
|
|
1845
|
+
// Set the stencil for the given classifier stencil volume.
|
|
1846
|
+
system.frameBufferStack.execute(this._fbos.stencilSet, false, false, () => {
|
|
1847
|
+
this.target.pushState(this._vcBranchState);
|
|
1848
|
+
system.applyRenderState(this._vcSetStencilRenderState);
|
|
1849
|
+
this.target.techniques.execute(this.target, vcHiliteCmds, 10 /* Hilite */);
|
|
1850
|
+
this.target.popBranch();
|
|
1851
|
+
});
|
|
1852
|
+
// Process the stencil for the hilite data.
|
|
1853
|
+
system.frameBufferStack.execute(this._fbos.hiliteUsingStencil, true, false, () => {
|
|
1854
|
+
system.applyRenderState(this._vcPickDataRenderState);
|
|
1855
|
+
this.target.techniques.execute(this.target, vcHiliteCmds, 10 /* Hilite */);
|
|
1856
|
+
});
|
|
2045
1857
|
}
|
|
2046
1858
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
&& undefined === this.featureId
|
|
2052
|
-
&& undefined === this.featureIdWithDepth
|
|
2053
|
-
&& undefined === this.featureIdWithDepthAltZ;
|
|
2054
|
-
}
|
|
2055
|
-
dispose() {
|
|
2056
|
-
super.dispose();
|
|
2057
|
-
this.accumulation = dispose(this.accumulation);
|
|
2058
|
-
this.revealage = dispose(this.revealage);
|
|
2059
|
-
this.featureId = dispose(this.featureId);
|
|
2060
|
-
this.disableVolumeClassifier();
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
class MPGeometry extends Geometry {
|
|
2064
|
-
collectStatistics(stats) {
|
|
2065
|
-
super.collectStatistics(stats);
|
|
2066
|
-
collectGeometryStatistics(this.copyColor, stats);
|
|
2067
|
-
}
|
|
2068
|
-
init(textures) {
|
|
2069
|
-
if (!super.init(textures))
|
|
2070
|
-
return false;
|
|
2071
|
-
assert(undefined === this.copyColor);
|
|
2072
|
-
this.copyColor = SingleTexturedViewportQuadGeometry.createGeometry(textures.featureId.getHandle(), 18 /* CopyColor */);
|
|
2073
|
-
return undefined !== this.copyColor;
|
|
2074
|
-
}
|
|
2075
|
-
get isDisposed() { return super.isDisposed && undefined === this.copyColor; }
|
|
2076
|
-
dispose() {
|
|
2077
|
-
super.dispose();
|
|
2078
|
-
this.copyColor = dispose(this.copyColor);
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
// Compositor used when multiple render targets are not supported (WEBGL_draw_buffers not available or fewer than 4 color attachments supported).
|
|
2082
|
-
// This falls back to multi-pass rendering in place of MRT rendering, which has obvious performance implications.
|
|
2083
|
-
// The chief use case is iOS.
|
|
2084
|
-
class MPCompositor extends Compositor {
|
|
2085
|
-
constructor(target) {
|
|
2086
|
-
super(target, new MPFrameBuffers(), new MPGeometry());
|
|
2087
|
-
this._currentRenderTargetIndex = 0;
|
|
2088
|
-
this._drawMultiPassDepth = true;
|
|
2089
|
-
this._opaqueRenderStateNoZWt = new RenderState();
|
|
2090
|
-
this._scratchBgColor = new FloatRgba();
|
|
2091
|
-
this._opaqueRenderStateNoZWt.flags.depthTest = true;
|
|
2092
|
-
this._opaqueRenderStateNoZWt.flags.depthMask = false;
|
|
1859
|
+
composite() {
|
|
1860
|
+
System.instance.applyRenderState(RenderState.defaults);
|
|
1861
|
+
const params = getDrawParams(this.target, this._geom.composite);
|
|
1862
|
+
this.target.techniques.draw(params);
|
|
2093
1863
|
}
|
|
2094
1864
|
getRenderState(pass) {
|
|
2095
1865
|
switch (pass) {
|
|
1866
|
+
case 1 /* OpaqueLayers */:
|
|
1867
|
+
case 7 /* TranslucentLayers */:
|
|
1868
|
+
case 11 /* OverlayLayers */:
|
|
1869
|
+
// NB: During pick, we don't want blending - it will mess up our pick buffer data and we don't care about the color data.
|
|
1870
|
+
// During normal draw, we don't use the pick buffers for anything, and we want color blending.
|
|
1871
|
+
// (We get away with this because surfaces always draw before their edges, and we're not depth-testing, so edges always draw atop surfaces without pick buffer testing).
|
|
1872
|
+
this._layerRenderState.flags.blend = !this.target.isReadPixelsInProgress;
|
|
1873
|
+
// Transparent non-overlay Layers are drawn between opaque and translucent passes. Test depth, don't write it, so that they blend with opaque.
|
|
1874
|
+
this._layerRenderState.flags.depthMask = 7 /* TranslucentLayers */ !== pass;
|
|
1875
|
+
this._layerRenderState.depthFunc = (7 /* TranslucentLayers */ === pass) ? GL.DepthFunc.Default : GL.DepthFunc.Always;
|
|
1876
|
+
return this._layerRenderState;
|
|
2096
1877
|
case 2 /* OpaqueLinear */:
|
|
2097
1878
|
case 3 /* OpaquePlanar */:
|
|
2098
1879
|
case 5 /* OpaqueGeneral */:
|
|
2099
|
-
|
|
1880
|
+
case 18 /* HilitePlanarClassification */:
|
|
1881
|
+
return this._opaqueRenderState;
|
|
1882
|
+
case 8 /* Translucent */:
|
|
1883
|
+
return this._translucentRenderState;
|
|
1884
|
+
case 10 /* Hilite */:
|
|
1885
|
+
return this._hiliteRenderState;
|
|
1886
|
+
case 15 /* BackgroundMap */:
|
|
1887
|
+
return this._backgroundMapRenderState;
|
|
1888
|
+
case 4 /* PointClouds */:
|
|
1889
|
+
return this._pointCloudRenderState;
|
|
1890
|
+
default:
|
|
1891
|
+
return this._noDepthMaskRenderState;
|
|
2100
1892
|
}
|
|
2101
|
-
return super.getRenderState(pass);
|
|
2102
|
-
}
|
|
2103
|
-
get _fbos() { return this._frameBuffers; }
|
|
2104
|
-
get _geometry() { return this._geom; }
|
|
2105
|
-
get currentRenderTargetIndex() { return this._currentRenderTargetIndex; }
|
|
2106
|
-
set currentRenderTargetIndex(index) { this._currentRenderTargetIndex = index; }
|
|
2107
|
-
get featureIds() { return this._readPickDataFromPingPong ? this._textures.accumulation : this._textures.featureId; }
|
|
2108
|
-
get depthAndOrder() { return this._readPickDataFromPingPong ? this._textures.revealage : this._textures.depthAndOrder; }
|
|
2109
|
-
getBackgroundFbo(needComposite) { return needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor; }
|
|
2110
|
-
enableVolumeClassifierFbos(textures, depth, volClassDepth, depthMS, volClassDepthMS) {
|
|
2111
|
-
this._fbos.enableVolumeClassifier(textures, depth, volClassDepth, depthMS, volClassDepthMS);
|
|
2112
|
-
}
|
|
2113
|
-
disableVolumeClassifierFbos() { this._fbos.disableVolumeClassifier(); }
|
|
2114
|
-
clearOpaque(needComposite) {
|
|
2115
|
-
const bg = this._scratchBgColor;
|
|
2116
|
-
this.target.uniforms.style.cloneBackgroundRgba(bg);
|
|
2117
|
-
this.clearFbo(needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor, bg.red, bg.green, bg.blue, bg.alpha, true);
|
|
2118
|
-
this.clearFbo(this._fbos.depthAndOrder, 0, 0, 0, 0, false);
|
|
2119
|
-
this.clearFbo(this._fbos.featureId, 0, 0, 0, 0, false);
|
|
2120
|
-
}
|
|
2121
|
-
clearHiddenPick() {
|
|
2122
1893
|
}
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
if (0
|
|
2126
|
-
this.renderOpaqueAO(commands);
|
|
1894
|
+
drawPass(commands, pass, pingPong = false, cmdPass = 255 /* None */) {
|
|
1895
|
+
const cmds = commands.getCommands(255 /* None */ !== cmdPass ? cmdPass : pass);
|
|
1896
|
+
if (0 === cmds.length) {
|
|
2127
1897
|
return;
|
|
2128
1898
|
}
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
const needComposite = 0 /* None */ !== compositeFlags;
|
|
2132
|
-
const needAO = 0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */);
|
|
2133
|
-
const colorFbo = needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor;
|
|
2134
|
-
this.drawOpaquePass(colorFbo, commands, 2 /* OpaqueLinear */, false);
|
|
2135
|
-
this.drawOpaquePass(colorFbo, commands, 3 /* OpaquePlanar */, true);
|
|
2136
|
-
if (renderForReadPixels || needAO)
|
|
2137
|
-
this.drawOpaquePass(colorFbo, commands, 5 /* OpaqueGeneral */, true);
|
|
2138
|
-
this._readPickDataFromPingPong = false;
|
|
2139
|
-
// The general pass (and following) will not bother to write to pick buffers and so can read from the actual pick buffers.
|
|
2140
|
-
if (!renderForReadPixels) {
|
|
2141
|
-
System.instance.frameBufferStack.execute(colorFbo, true, false, () => {
|
|
2142
|
-
this._drawMultiPassDepth = true; // for OpaqueGeneral
|
|
2143
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
2144
|
-
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
2145
|
-
});
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
renderOpaqueAO(commands) {
|
|
2149
|
-
const fbStack = System.instance.frameBufferStack;
|
|
2150
|
-
const haveHiddenEdges = 0 !== commands.getCommands(9 /* HiddenEdge */).length;
|
|
2151
|
-
// Output the linear, planar, and pickable surfaces to color and pick data buffers.
|
|
2152
|
-
this._readPickDataFromPingPong = true;
|
|
2153
|
-
const colorFbo = this._fbos.opaqueAndCompositeColor;
|
|
2154
|
-
this.drawOpaquePass(colorFbo, commands, 2 /* OpaqueLinear */, false);
|
|
2155
|
-
this.drawOpaquePass(colorFbo, commands, 3 /* OpaquePlanar */, true);
|
|
2156
|
-
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
2157
|
-
this.drawOpaquePass(colorFbo, commands, 5 /* OpaqueGeneral */, true);
|
|
2158
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
2159
|
-
this._readPickDataFromPingPong = false;
|
|
2160
|
-
// Output the non-pickable surfaces and hidden edges to just the color buffer.
|
|
2161
|
-
fbStack.execute(colorFbo, true, false, () => {
|
|
2162
|
-
this._drawMultiPassDepth = true; // for OpaqueGeneral
|
|
2163
|
-
this._primitiveDrawState = PrimitiveDrawState.NonPickable;
|
|
2164
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, false);
|
|
2165
|
-
if (haveHiddenEdges)
|
|
2166
|
-
this.drawPass(commands, 9 /* HiddenEdge */, false);
|
|
2167
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
2168
|
-
});
|
|
2169
|
-
if (haveHiddenEdges) {
|
|
2170
|
-
// First copy the depthAndOrder texture to the revealage texture which we will use for the hidden edge pick data (don't need full pick with featureIds).
|
|
2171
|
-
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
2172
|
-
this.copyFbo(this._textures.depthAndOrder, this._fbos.revealage);
|
|
2173
|
-
// So far only the non-pickable hidden edges have been drawn for AO, so we need to draw the pickable ones to the hidden depthAndOrder (revealage).
|
|
2174
|
-
this._primitiveDrawState = PrimitiveDrawState.Pickable;
|
|
2175
|
-
// Since we only need to draw color and depthAndOrder instead of calling drawOpaquePass just do what we need here.
|
|
2176
|
-
this._drawMultiPassDepth = true;
|
|
2177
|
-
fbStack.execute(colorFbo, true, false, () => this.drawPass(commands, 9 /* HiddenEdge */, false));
|
|
2178
|
-
this._drawMultiPassDepth = false;
|
|
2179
|
-
this._currentRenderTargetIndex = 2;
|
|
2180
|
-
fbStack.execute(this._fbos.revealage, true, false, () => this.drawPass(commands, 9 /* HiddenEdge */, false));
|
|
2181
|
-
this._currentRenderTargetIndex = 0;
|
|
2182
|
-
this._readPickDataFromPingPong = false;
|
|
2183
|
-
this._primitiveDrawState = PrimitiveDrawState.Both;
|
|
2184
|
-
}
|
|
2185
|
-
this._needHiddenEdges = haveHiddenEdges; // this will cause the alternate renderAndOrder texture to be read for the 2nd AO blur pass.
|
|
2186
|
-
this.renderAmbientOcclusion();
|
|
2187
|
-
this._needHiddenEdges = false;
|
|
2188
|
-
}
|
|
2189
|
-
renderLayers(commands, needComposite, pass) {
|
|
2190
|
-
this._readPickDataFromPingPong = true;
|
|
2191
|
-
const colorFbo = needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor;
|
|
2192
|
-
this.drawOpaquePass(colorFbo, commands, pass, true);
|
|
2193
|
-
this._readPickDataFromPingPong = false;
|
|
2194
|
-
}
|
|
2195
|
-
renderForVolumeClassification(commands, compositeFlags, renderForReadPixels) {
|
|
2196
|
-
const needComposite = 0 /* None */ !== compositeFlags;
|
|
2197
|
-
const needAO = 0 /* None */ !== (compositeFlags & 4 /* AmbientOcclusion */);
|
|
2198
|
-
const colorFbo = needComposite ? this._fbos.opaqueAndCompositeColor : this._fbos.opaqueColor;
|
|
2199
|
-
if (renderForReadPixels || needAO) {
|
|
2200
|
-
this._readPickDataFromPingPong = true;
|
|
2201
|
-
this.drawOpaquePass(colorFbo, commands, 5 /* OpaqueGeneral */, true, 20 /* VolumeClassifiedRealityData */);
|
|
2202
|
-
if (needAO)
|
|
2203
|
-
this.renderAmbientOcclusion();
|
|
2204
|
-
}
|
|
2205
|
-
else {
|
|
2206
|
-
this._readPickDataFromPingPong = false;
|
|
2207
|
-
System.instance.frameBufferStack.execute(colorFbo, true, false, () => {
|
|
2208
|
-
this._drawMultiPassDepth = true; // for OpaqueGeneral
|
|
2209
|
-
this.drawPass(commands, 5 /* OpaqueGeneral */, false, 20 /* VolumeClassifiedRealityData */);
|
|
2210
|
-
});
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
renderIndexedClassifierForReadPixels(cmds, state, renderForIntersectingVolumes, _needComposite) {
|
|
2214
|
-
// Note that we only need to render to the Id textures here, no color, since the color buffer is not used in readPixels.
|
|
2215
|
-
this._readPickDataFromPingPong = true;
|
|
2216
|
-
this._currentRenderTargetIndex = 1;
|
|
2217
|
-
const fbo = (renderForIntersectingVolumes ? this._fbos.featureIdWithDepth : this._fbos.featureIdWithDepthAltZ);
|
|
2218
|
-
System.instance.frameBufferStack.execute(fbo, true, false, () => {
|
|
2219
|
-
System.instance.applyRenderState(state);
|
|
2220
|
-
this.target.techniques.execute(this.target, cmds, 5 /* OpaqueGeneral */);
|
|
2221
|
-
});
|
|
2222
|
-
this._currentRenderTargetIndex = 0;
|
|
2223
|
-
this._readPickDataFromPingPong = false;
|
|
2224
|
-
}
|
|
2225
|
-
// ###TODO: For readPixels(), could skip rendering color...also could skip rendering depth and/or element ID depending upon selector...
|
|
2226
|
-
drawOpaquePass(colorFbo, commands, pass, pingPong, cmdPass = 255 /* None */) {
|
|
2227
|
-
const commandPass = 255 /* None */ === cmdPass ? pass : cmdPass;
|
|
2228
|
-
const stack = System.instance.frameBufferStack;
|
|
2229
|
-
this._drawMultiPassDepth = true;
|
|
2230
|
-
if (!this.target.isReadPixelsInProgress) {
|
|
2231
|
-
stack.execute(colorFbo, true, false, () => this.drawPass(commands, pass, pingPong, commandPass));
|
|
2232
|
-
this._drawMultiPassDepth = false;
|
|
2233
|
-
}
|
|
2234
|
-
this._currentRenderTargetIndex++;
|
|
2235
|
-
if (!this.target.isReadPixelsInProgress || Pixel.Selector.None !== (this.target.readPixelsSelector & Pixel.Selector.Feature)) {
|
|
2236
|
-
stack.execute(this._fbos.featureId, true, false, () => this.drawPass(commands, pass, pingPong && this._drawMultiPassDepth, commandPass));
|
|
2237
|
-
this._drawMultiPassDepth = false;
|
|
2238
|
-
}
|
|
2239
|
-
this._currentRenderTargetIndex++;
|
|
2240
|
-
if (!this.target.isReadPixelsInProgress || Pixel.Selector.None !== (this.target.readPixelsSelector & Pixel.Selector.GeometryAndDistance)) {
|
|
2241
|
-
stack.execute(this._fbos.depthAndOrder, true, false, () => this.drawPass(commands, pass, pingPong && this._drawMultiPassDepth, commandPass));
|
|
1899
|
+
else if (pingPong) {
|
|
1900
|
+
this.pingPong();
|
|
2242
1901
|
}
|
|
2243
|
-
this.
|
|
2244
|
-
|
|
2245
|
-
clearTranslucent() {
|
|
2246
|
-
this.clearFbo(this._fbos.accumulation, 0, 0, 0, 1, false);
|
|
2247
|
-
this.clearFbo(this._fbos.revealage, 1, 0, 0, 1, false);
|
|
2248
|
-
}
|
|
2249
|
-
renderTranslucent(commands) {
|
|
2250
|
-
System.instance.frameBufferStack.execute(this._fbos.accumulation, true, false, () => {
|
|
2251
|
-
this.drawPass(commands, 8 /* Translucent */);
|
|
2252
|
-
});
|
|
2253
|
-
this._currentRenderTargetIndex = 1;
|
|
2254
|
-
System.instance.frameBufferStack.execute(this._fbos.revealage, true, false, () => {
|
|
2255
|
-
this.drawPass(commands, 8 /* Translucent */);
|
|
2256
|
-
});
|
|
2257
|
-
this._currentRenderTargetIndex = 0;
|
|
2258
|
-
}
|
|
2259
|
-
pingPong() {
|
|
2260
|
-
System.instance.applyRenderState(this._noDepthMaskRenderState);
|
|
2261
|
-
this.copyFbo(this._textures.featureId, this._fbos.accumulation);
|
|
2262
|
-
this.copyFbo(this._textures.depthAndOrder, this._fbos.revealage);
|
|
2263
|
-
}
|
|
2264
|
-
copyFbo(src, dst) {
|
|
2265
|
-
const geom = this._geometry.copyColor;
|
|
2266
|
-
geom.texture = src.getHandle();
|
|
2267
|
-
System.instance.frameBufferStack.execute(dst, true, false, () => {
|
|
2268
|
-
const params = getDrawParams(this.target, geom);
|
|
2269
|
-
this.target.techniques.draw(params);
|
|
2270
|
-
});
|
|
2271
|
-
}
|
|
2272
|
-
clearFbo(fbo, red, green, blue, alpha, andDepth) {
|
|
2273
|
-
const system = System.instance;
|
|
2274
|
-
const gl = system.context;
|
|
2275
|
-
system.frameBufferStack.execute(fbo, true, false, () => {
|
|
2276
|
-
system.applyRenderState(andDepth ? RenderState.defaults : this._noDepthMaskRenderState);
|
|
2277
|
-
gl.clearColor(red, green, blue, alpha);
|
|
2278
|
-
let bit = GL.BufferBit.Color;
|
|
2279
|
-
if (andDepth) {
|
|
2280
|
-
gl.clearDepth(1.0);
|
|
2281
|
-
bit |= GL.BufferBit.Depth;
|
|
2282
|
-
}
|
|
2283
|
-
gl.clear(bit);
|
|
2284
|
-
});
|
|
1902
|
+
System.instance.applyRenderState(this.getRenderState(pass));
|
|
1903
|
+
this.target.techniques.execute(this.target, cmds, pass);
|
|
2285
1904
|
}
|
|
2286
1905
|
}
|
|
2287
1906
|
//# sourceMappingURL=SceneCompositor.js.map
|