@itwin/core-frontend 5.3.0-dev.7 → 5.3.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -1
- package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
- package/lib/cjs/ElementLocateManager.js +2 -5
- package/lib/cjs/ElementLocateManager.js.map +1 -1
- package/lib/cjs/HitDetail.d.ts +1 -24
- package/lib/cjs/HitDetail.d.ts.map +1 -1
- package/lib/cjs/HitDetail.js +0 -5
- package/lib/cjs/HitDetail.js.map +1 -1
- package/lib/cjs/IModeljs-css.js +1 -1
- package/lib/cjs/IModeljs-css.js.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts +0 -2
- package/lib/cjs/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/FrustumUniforms.js +0 -7
- package/lib/cjs/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts +0 -9
- package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/SceneCompositor.js +4 -67
- package/lib/cjs/internal/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts +3 -4
- package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/ShaderBuilder.js +3 -3
- package/lib/cjs/internal/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Atmosphere.js +1 -1
- package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.js +1 -2
- package/lib/cjs/internal/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Contours.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Contours.js +1 -30
- package/lib/cjs/internal/render/webgl/glsl/Contours.js.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Fragment.d.ts.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Fragment.js +2 -7
- package/lib/cjs/internal/render/webgl/glsl/Fragment.js.map +1 -1
- package/lib/cjs/internal/render/webgl/glsl/RealityMesh.js +1 -1
- package/lib/cjs/internal/render/webgl/glsl/Surface.js +1 -1
- package/lib/cjs/render/Pixel.d.ts +2 -13
- package/lib/cjs/render/Pixel.d.ts.map +1 -1
- package/lib/cjs/render/Pixel.js +1 -9
- package/lib/cjs/render/Pixel.js.map +1 -1
- package/lib/esm/ElementLocateManager.d.ts.map +1 -1
- package/lib/esm/ElementLocateManager.js +2 -5
- package/lib/esm/ElementLocateManager.js.map +1 -1
- package/lib/esm/HitDetail.d.ts +1 -24
- package/lib/esm/HitDetail.d.ts.map +1 -1
- package/lib/esm/HitDetail.js +0 -5
- package/lib/esm/HitDetail.js.map +1 -1
- package/lib/esm/IModeljs-css.js +1 -1
- package/lib/esm/IModeljs-css.js.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts +0 -2
- package/lib/esm/internal/render/webgl/FrustumUniforms.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/FrustumUniforms.js +1 -8
- package/lib/esm/internal/render/webgl/FrustumUniforms.js.map +1 -1
- package/lib/esm/internal/render/webgl/SceneCompositor.d.ts +0 -9
- package/lib/esm/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/SceneCompositor.js +4 -67
- package/lib/esm/internal/render/webgl/SceneCompositor.js.map +1 -1
- package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts +3 -4
- package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/ShaderBuilder.js +3 -3
- package/lib/esm/internal/render/webgl/ShaderBuilder.js.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/Atmosphere.js +1 -1
- package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.js +1 -2
- package/lib/esm/internal/render/webgl/glsl/ClearPickAndColor.js.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/Contours.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/Contours.js +1 -30
- package/lib/esm/internal/render/webgl/glsl/Contours.js.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/Fragment.d.ts.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/Fragment.js +2 -7
- package/lib/esm/internal/render/webgl/glsl/Fragment.js.map +1 -1
- package/lib/esm/internal/render/webgl/glsl/RealityMesh.js +1 -1
- package/lib/esm/internal/render/webgl/glsl/Surface.js +1 -1
- package/lib/esm/render/Pixel.d.ts +2 -13
- package/lib/esm/render/Pixel.d.ts.map +1 -1
- package/lib/esm/render/Pixel.js +1 -9
- package/lib/esm/render/Pixel.js.map +1 -1
- package/package.json +21 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contours.js","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Contours.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;CAazB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;CAOxB,CAAC;AAEF,MAAM,4BAA4B,GAAG;;;;CAIpC,CAAC;AAEF,MAAM,qBAAqB,GAAG;;;;;;;;;;;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IAC5E,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAEhD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,GAAG,iDAAwC,aAAa,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,GAAG,0DAAiD,2BAA2B,CAAC,CAAC;AAChG,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\nimport { ContourDisplay } from \"@itwin/core-common\";\nimport { TextureUnit } from \"../RenderFlags\";\nimport {\n FragmentShaderComponent, ProgramBuilder, VariableType,\n} from \"../ShaderBuilder\";\nimport { addFeatureIndex } from \"./FeatureSymbology\";\nimport { addInstancedRtcMatrix } from \"./Vertex\";\nimport { encodeDepthRgb } from \"./Decode\";\n\nconst computeContourNdx = `\n if (u_contourLUTWidth == 0u)\n return 15.0;\n uint lutIndex = uint(getFeatureIndex());\n bool odd = bool(lutIndex & 1u);\n lutIndex /= 2u;\n uint byteSel = lutIndex & 0x3u;\n lutIndex /= 4u;\n ivec2 coords = ivec2(lutIndex % u_contourLUTWidth, lutIndex / u_contourLUTWidth);\n uvec4 contourNdx4 = uvec4(texelFetch(u_contourLUT, coords, 0) * 255.0 + 0.5);\n uvec2 contourNdx2 = bool(byteSel & 2u) ? contourNdx4.ba : contourNdx4.rg;\n uint contourNdx = bool(byteSel & 1u) ? contourNdx2.g : contourNdx2.r;\n return float(odd ? contourNdx >> 4u : contourNdx & 0xFu);\n`;\n\nconst unpack2BytesVec4 = `\nvec4 unpack2BytesVec4(vec4 f, bool upper) {\n f = floor(f + 0.5);\n vec4 outUpper = floor(f / 256.0);\n vec4 outLower = floor(f - outUpper * 256.0);\n return upper ? outUpper : outLower;\n}\n`;\n\nconst unpackAndNormalize2BytesVec4 = `\nvec4 unpackAndNormalize2BytesVec4(vec4 f, bool upper) {\n return unpack2BytesVec4(f, upper) / 255.0;\n}\n`;\n\nconst encodeContourLineInfo = `\n void encodeContourLineInfo(int groupIndex, bool isMajor, float interval) {\n // ContourDisplay.maxContourGroups is currently 5. Must change this code if that changes.\n float groupIndexAndType = float(groupIndex + (isMajor ? 16 : 8));\n\n // Find nearest multiple of interval to pixel world height.\n float elevation = (v_height >= 0.0 ? floor((v_height + interval / 2.0) / interval) : ceil((v_height - interval / 2.0) / interval)) * interval;\n\n // Convert elevation to a fraction of the frustum's world Z extents\n elevation = clamp((elevation - u_worldFrustumZRange.x) / (u_worldFrustumZRange.y - u_worldFrustumZRange.x), 0.0, 1.0);\n\n // Encode elevation in RGB and the rest of the info in A\n g_contourLineInfo = vec4(groupIndexAndType * 0.03125, encodeDepthRgb(elevation));\n }\n`;\n\nconst applyContours = `\n int contourNdx = int(v_contourNdx + 0.5);\n if (contourNdx > 14) // 15 => no contours\n return baseColor;\n\n const int maxDefs = ${ContourDisplay.maxContourGroups}; // max number of contour definitions allowed, have to change index arrays if this changes\n int contourNdxC = clamp(contourNdx, 0, maxDefs - 1);\n\n bool even = (contourNdxC & 1) == 0;\n vec4 rgbfp = u_contourDefs[even ? contourNdxC * 3 / 2 : (contourNdxC - 1) * 3 / 2 + 2];\n vec4 intervalsPair = u_contourDefs[(contourNdxC / 2) * 3 + 1];\n // intervals.r => minor interval distance, intervals.g => major index count\n vec2 intervals = even ? intervalsPair.rg : intervalsPair.ba;\n\n float coord = v_height / intervals.r;\n // determine if this is in the vicinity of a major contour line (1/2 an interval either way, which is one limit of drawing width)\n bool maj = (fract((abs(coord) + 0.5) / intervals.g) < (1.0 / intervals.g));\n vec4 rgbf = unpackAndNormalize2BytesVec4(rgbfp, maj);\n // rgbf.a => (4-bit linecode / 4-bit weight) maj/min, where the 4-bit weight is a 3-bit weight value with one fraction bit and a 1.5 offset.\n // This gives a weight range of 1.5 to 9 in 0.5 increments.\n // NB: the showGeometry bit flag is stuck in at bit 16 of this, so the major line code has an extra bit in it that needs to be masked out\n int lineCodeWt = int((rgbf.a * 255.0) + 0.5);\n // first * 0.5 is for fractional part of width, then have to add 1.0 for offset, then another 1.0 for actual width bias\n float lineRadius = (float(lineCodeWt & 0xf) * 0.5 + 2.0) * 0.5;\n\n // abs(fract(coord - 0.5) - 0.5) will produce 0.0 at the contour line, and 0.5 at the mid-point between contour lines\n // fwidth(coord) is sum of absolute diffs in coord in adjacent pixels\n float line = abs(fract(coord - 0.5) - 0.5) / fwidth(coord);\n // If line is 0 (like at contour line), contourAlpha = lineRadius, so will use draw in contour color\n\t// If line >= lineRadius, contourAlpha = 0, so won't show contour\n float contourAlpha = lineRadius - min(line, lineRadius);\n\n // figure out which direction line is going, to know which screen pattern offset to use\n float dx = dFdx(contourAlpha);\n float dy = dFdy(contourAlpha);\n\n const float patLength = 32.0;\n uint patterns[10] = uint[](0xffffffffu, 0x80808080u, 0xf8f8f8f8u, 0xffe0ffe0u, 0xfe10fe10u, 0xe0e0e0e0u, 0xf888f888u, 0xff18ff18u, 0xccccccccu, 0x00000001u);\n\n float offset = trunc((abs(dx) > abs(dy)) ? gl_FragCoord.y : gl_FragCoord.x);\n offset = mod(offset, patLength);\n uint msk = 1u << uint(offset);\n contourAlpha *= (patterns[(lineCodeWt / 16) & 0xf] & msk) > 0u ? 1.0 : 0.0;\n contourAlpha = min(contourAlpha, 1.0);\n\n bool isContourLine = contourAlpha >= 0.5;\n if (isContourLine)\n encodeContourLineInfo(contourNdxC, maj, intervals.r);\n\n if (rgbfp.a / 65536.0 < 0.5) { // showGeometry == 0\n if (!isContourLine)\n discard;\n return vec4(rgbf.rgb, 1.0);\n }\n // set contour opaque even if base color is transparent\n float alpha = contourAlpha >= 0.5 ? 1.0 : baseColor.a;\n return vec4(mix(baseColor.rgb, rgbf.rgb, contourAlpha), alpha);\n`;\n\n/** @internal */\nexport function addApplyContours(builder: ProgramBuilder) {\n const modelPos = builder.vert.usesInstancedGeometry ? \"(g_instancedRtcMatrix * rawPosition)\" : \"rawPosition\";\n\n const computeWorldHeight = `\nfloat computeWorldHeight(vec4 rawPosition) {\n float height = (u_modelToWorldC * ${modelPos}).z;\n // TODO: apply ECEF correction to height\n return height;\n}\n`;\n\n addFeatureIndex(builder.vert);\n\n builder.addFunctionComputedVarying(\"v_contourNdx\", VariableType.Float, \"computeContourNdx\", computeContourNdx);\n builder.addFunctionComputedVaryingWithArgs(\"v_height\", VariableType.Float, \"computeWorldHeight(rawPosition)\", computeWorldHeight);\n\n if (builder.vert.usesInstancedGeometry)\n addInstancedRtcMatrix(builder.vert);\n\n builder.vert.addUniform(\"u_contourLUT\", VariableType.Sampler2D, (prog) => {\n prog.addGraphicUniform(\"u_contourLUT\", (uniform, params) => {\n // set this uniform here so that it won't cause problems (e.g.: loopback) if it does not end up being set by bindContourLUT call\n uniform.setUniform1i(TextureUnit.Contours - TextureUnit.Zero);\n params.target.uniforms.batch.bindContourLUT(uniform);\n });\n });\n\n builder.vert.addUniform(\"u_contourLUTWidth\", VariableType.Uint, (prog) => {\n prog.addGraphicUniform(\"u_contourLUTWidth\", (uniform, params) => {\n params.target.uniforms.batch.bindContourLUTWidth(uniform);\n });\n });\n\n builder.vert.addUniform(\"u_modelToWorldC\", VariableType.Mat4, (prog) => {\n prog.addGraphicUniform(\"u_modelToWorldC\", (uniform, params) => {\n params.target.uniforms.branch.bindModelToWorldTransform(uniform, params.geometry, false);\n });\n });\n\n builder.frag.addUniform(\"u_worldFrustumZRange\", VariableType.Vec2, (prog) => {\n prog.addProgramUniform(\"u_worldFrustumZRange\", (uniform, params) => {\n uniform.setUniform2fv(params.target.uniforms.frustum.worldFrustumZRange);\n });\n });\n\n const contourDefsSize = 8;\n builder.frag.addUniformArray(\"u_contourDefs\", VariableType.Vec4, contourDefsSize, (prog) => {\n prog.addGraphicUniform(\"u_contourDefs\", (uniform, params) => {\n params.target.uniforms.contours.bindcontourDefs(uniform);\n });\n });\n\n builder.frag.addGlobal(\"g_contourLineInfo\", VariableType.Vec4, \"vec4(0.0)\");\n builder.frag.addFunction(encodeDepthRgb);\n builder.frag.addFunction(encodeContourLineInfo);\n \n builder.frag.addFunction(unpack2BytesVec4);\n builder.frag.addFunction(unpackAndNormalize2BytesVec4);\n builder.frag.set(FragmentShaderComponent.ApplyContours, applyContours);\n builder.frag.set(FragmentShaderComponent.ComputeContourLineInfo, \"return g_contourLineInfo;\");\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Contours.js","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Contours.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;CAazB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;CAOxB,CAAC;AAEF,MAAM,4BAA4B,GAAG;;;;CAIpC,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;wBAKE,cAAc,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDtD,CAAC;AAEF,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,aAAa,CAAC;IAE7G,MAAM,kBAAkB,GAAG;;sCAES,QAAQ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CAAC,MAAM,CAAC,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,CAAC,CAAC;IAC1B,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,eAAe,6BAAqB,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACzF,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,GAAG,iDAAwC,aAAa,CAAC,CAAC;AACzE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\nimport { ContourDisplay } from \"@itwin/core-common\";\nimport { TextureUnit } from \"../RenderFlags\";\nimport {\n FragmentShaderComponent, ProgramBuilder, VariableType,\n} from \"../ShaderBuilder\";\nimport { addFeatureIndex } from \"./FeatureSymbology\";\nimport { addInstancedRtcMatrix } from \"./Vertex\";\n\nconst computeContourNdx = `\n if (u_contourLUTWidth == 0u)\n return 15.0;\n uint lutIndex = uint(getFeatureIndex());\n bool odd = bool(lutIndex & 1u);\n lutIndex /= 2u;\n uint byteSel = lutIndex & 0x3u;\n lutIndex /= 4u;\n ivec2 coords = ivec2(lutIndex % u_contourLUTWidth, lutIndex / u_contourLUTWidth);\n uvec4 contourNdx4 = uvec4(texelFetch(u_contourLUT, coords, 0) * 255.0 + 0.5);\n uvec2 contourNdx2 = bool(byteSel & 2u) ? contourNdx4.ba : contourNdx4.rg;\n uint contourNdx = bool(byteSel & 1u) ? contourNdx2.g : contourNdx2.r;\n return float(odd ? contourNdx >> 4u : contourNdx & 0xFu);\n`;\n\nconst unpack2BytesVec4 = `\nvec4 unpack2BytesVec4(vec4 f, bool upper) {\n f = floor(f + 0.5);\n vec4 outUpper = floor(f / 256.0);\n vec4 outLower = floor(f - outUpper * 256.0);\n return upper ? outUpper : outLower;\n}\n`;\n\nconst unpackAndNormalize2BytesVec4 = `\nvec4 unpackAndNormalize2BytesVec4(vec4 f, bool upper) {\n return unpack2BytesVec4(f, upper) / 255.0;\n}\n`;\n\nconst applyContours = `\n int contourNdx = int(v_contourNdx + 0.5);\n if (contourNdx > 14) // 15 => no contours\n return baseColor;\n\n const int maxDefs = ${ContourDisplay.maxContourGroups}; // max number of contour definitions allowed, have to change index arrays if this changes\n int contourNdxC = clamp(contourNdx, 0, maxDefs - 1);\n\n bool even = (contourNdxC & 1) == 0;\n vec4 rgbfp = u_contourDefs[even ? contourNdxC * 3 / 2 : (contourNdxC - 1) * 3 / 2 + 2];\n vec4 intervalsPair = u_contourDefs[(contourNdxC / 2) * 3 + 1];\n // intervals.r => minor interval distance, intervals.g => major index count\n vec2 intervals = even ? intervalsPair.rg : intervalsPair.ba;\n\n float coord = v_height / intervals.r;\n // determine if this is in the vicinity of a major contour line (1/2 an interval either way, which is one limit of drawing width)\n bool maj = (fract((abs(coord) + 0.5) / intervals.g) < (1.0 / intervals.g));\n vec4 rgbf = unpackAndNormalize2BytesVec4(rgbfp, maj);\n // rgbf.a => (4-bit linecode / 4-bit weight) maj/min, where the 4-bit weight is a 3-bit weight value with one fraction bit and a 1.5 offset.\n // This gives a weight range of 1.5 to 9 in 0.5 increments.\n // NB: the showGeometry bit flag is stuck in at bit 16 of this, so the major line code has an extra bit in it that needs to be masked out\n int lineCodeWt = int((rgbf.a * 255.0) + 0.5);\n // first * 0.5 is for fractional part of width, then have to add 1.0 for offset, then another 1.0 for actual width bias\n float lineRadius = (float(lineCodeWt & 0xf) * 0.5 + 2.0) * 0.5;\n\n // abs(fract(coord - 0.5) - 0.5) will produce 0.0 at the contour line, and 0.5 at the mid-point between contour lines\n // fwidth(coord) is sum of absolute diffs in coord in adjacent pixels\n float line = abs(fract(coord - 0.5) - 0.5) / fwidth(coord);\n // If line is 0 (like at contour line), contourAlpha = lineRadius, so will use draw in contour color\n\t// If line >= lineRadius, contourAlpha = 0, so won't show contour\n float contourAlpha = lineRadius - min(line, lineRadius);\n\n // figure out which direction line is going, to know which screen pattern offset to use\n float dx = dFdx(contourAlpha);\n float dy = dFdy(contourAlpha);\n\n const float patLength = 32.0;\n uint patterns[10] = uint[](0xffffffffu, 0x80808080u, 0xf8f8f8f8u, 0xffe0ffe0u, 0xfe10fe10u, 0xe0e0e0e0u, 0xf888f888u, 0xff18ff18u, 0xccccccccu, 0x00000001u);\n\n float offset = trunc((abs(dx) > abs(dy)) ? gl_FragCoord.y : gl_FragCoord.x);\n offset = mod(offset, patLength);\n uint msk = 1u << uint(offset);\n contourAlpha *= (patterns[(lineCodeWt / 16) & 0xf] & msk) > 0u ? 1.0 : 0.0;\n contourAlpha = min(contourAlpha, 1.0);\n\n if (rgbfp.a / 65536.0 < 0.5) { // showGeometry == 0\n if (contourAlpha < 0.5) // not a contour line\n discard;\n return vec4(rgbf.rgb, 1.0);\n }\n // set contour opaque even if base color is transparent\n float alpha = contourAlpha >= 0.5 ? 1.0 : baseColor.a;\n return vec4(mix(baseColor.rgb, rgbf.rgb, contourAlpha), alpha);\n`;\n\n/** @internal */\nexport function addApplyContours(builder: ProgramBuilder) {\n const modelPos = builder.vert.usesInstancedGeometry ? \"(g_instancedRtcMatrix * rawPosition)\" : \"rawPosition\";\n\n const computeWorldHeight = `\nfloat computeWorldHeight(vec4 rawPosition) {\n float height = (u_modelToWorldC * ${modelPos}).z;\n // TODO: apply ECEF correction to height\n return height;\n}\n`;\n\n addFeatureIndex(builder.vert);\n\n builder.addFunctionComputedVarying(\"v_contourNdx\", VariableType.Float, \"computeContourNdx\", computeContourNdx);\n builder.addFunctionComputedVaryingWithArgs(\"v_height\", VariableType.Float, \"computeWorldHeight(rawPosition)\", computeWorldHeight);\n\n if (builder.vert.usesInstancedGeometry)\n addInstancedRtcMatrix(builder.vert);\n\n builder.vert.addUniform(\"u_contourLUT\", VariableType.Sampler2D, (prog) => {\n prog.addGraphicUniform(\"u_contourLUT\", (uniform, params) => {\n // set this uniform here so that it won't cause problems (e.g.: loopback) if it does not end up being set by bindContourLUT call\n uniform.setUniform1i(TextureUnit.Contours - TextureUnit.Zero);\n params.target.uniforms.batch.bindContourLUT(uniform);\n });\n });\n\n builder.vert.addUniform(\"u_contourLUTWidth\", VariableType.Uint, (prog) => {\n prog.addGraphicUniform(\"u_contourLUTWidth\", (uniform, params) => {\n params.target.uniforms.batch.bindContourLUTWidth(uniform);\n });\n });\n\n builder.vert.addUniform(\"u_modelToWorldC\", VariableType.Mat4, (prog) => {\n prog.addGraphicUniform(\"u_modelToWorldC\", (uniform, params) => {\n params.target.uniforms.branch.bindModelToWorldTransform(uniform, params.geometry, false);\n });\n });\n\n const contourDefsSize = 8;\n builder.frag.addUniformArray(\"u_contourDefs\", VariableType.Vec4, contourDefsSize, (prog) => {\n prog.addGraphicUniform(\"u_contourDefs\", (uniform, params) => {\n params.target.uniforms.contours.bindcontourDefs(uniform);\n });\n });\n\n builder.frag.addFunction(unpack2BytesVec4);\n builder.frag.addFunction(unpackAndNormalize2BytesVec4);\n builder.frag.set(FragmentShaderComponent.ApplyContours, applyContours);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fragment.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Fragment.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAwD,MAAM,kBAAkB,CAAC;AAI/G,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,QAQ/D;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,QASlE;
|
|
1
|
+
{"version":3,"file":"Fragment.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Fragment.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAwD,MAAM,kBAAkB,CAAC;AAI/G,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,QAQ/D;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,QASlE;AA0CD,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CA8BtE;AAED,gBAAgB;AAChB,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAazE;AAED,gBAAgB;AAChB,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CASpF;AAED,gBAAgB;AAChB,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAWxD,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,qPAQ9B,CAAC"}
|
|
@@ -56,13 +56,11 @@ const computeAltPickBufferOutputs = `${multiplyAlpha}
|
|
|
56
56
|
vec4 output0 = baseColor;
|
|
57
57
|
vec4 output1 = vec4(0.0);
|
|
58
58
|
vec4 output2 = vec4(0.0);
|
|
59
|
-
vec4 output3 = vec4(0.0);
|
|
60
59
|
`;
|
|
61
60
|
const assignPickBufferOutputsMRT = `
|
|
62
61
|
FragColor0 = output0;
|
|
63
62
|
FragColor1 = output1;
|
|
64
63
|
FragColor2 = output2;
|
|
65
|
-
FragColor3 = output3;
|
|
66
64
|
`;
|
|
67
65
|
const reassignFeatureId = " output1 = overrideFeatureId(output1);";
|
|
68
66
|
/** @internal */
|
|
@@ -79,9 +77,6 @@ export function addPickBufferOutputs(frag) {
|
|
|
79
77
|
prelude.addline(" float renderOrder = u_renderOrder;");
|
|
80
78
|
}
|
|
81
79
|
prelude.add(computePickBufferOutputs);
|
|
82
|
-
const computeContourLineInfo = frag.get(23 /* FragmentShaderComponent.ComputeContourLineInfo */) ?? "return vec4(0.0);";
|
|
83
|
-
frag.addFunction("vec4 computeContourLineInfo()", computeContourLineInfo);
|
|
84
|
-
prelude.addline(" vec4 output3 = computeContourLineInfo();");
|
|
85
80
|
const overrideColor = frag.get(21 /* FragmentShaderComponent.OverrideColor */);
|
|
86
81
|
if (undefined !== overrideColor) {
|
|
87
82
|
frag.addFunction("vec4 overrideColor(vec4 currentColor)", overrideColor);
|
|
@@ -93,7 +88,7 @@ export function addPickBufferOutputs(frag) {
|
|
|
93
88
|
prelude.addline(reassignFeatureId);
|
|
94
89
|
}
|
|
95
90
|
addRenderPass(frag);
|
|
96
|
-
frag.addDrawBuffersExtension(
|
|
91
|
+
frag.addDrawBuffersExtension(3);
|
|
97
92
|
frag.set(18 /* FragmentShaderComponent.AssignFragData */, prelude.source + assignPickBufferOutputsMRT);
|
|
98
93
|
}
|
|
99
94
|
/** @internal */
|
|
@@ -106,7 +101,7 @@ export function addAltPickBufferOutputs(frag) {
|
|
|
106
101
|
prelude.addline(" output0 = overrideColor(output0);");
|
|
107
102
|
}
|
|
108
103
|
addRenderPass(frag);
|
|
109
|
-
frag.addDrawBuffersExtension(
|
|
104
|
+
frag.addDrawBuffersExtension(3);
|
|
110
105
|
frag.set(18 /* FragmentShaderComponent.AssignFragData */, prelude.source + assignPickBufferOutputsMRT);
|
|
111
106
|
}
|
|
112
107
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fragment.js","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Fragment.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAE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AC;QACN,IAAI,CAAC,WAAW,CAAC,uCAAuC,EAAE,aAAa,CAAC,CAAC;QACzE,IAAI,CAAC,GAAG,kDAAyC,gDAAgD,CAAC,CAAC;IACrG,CAAC;AACH,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAExD,MAAM,qCAAqC,GAAG,GAAG,aAAa;;CAE7D,CAAC;AAEF,MAAM,gDAAgD,GAAG,GAAG,aAAa;;;CAGxE,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;CAQjC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { FragmentShaderBuilder, FragmentShaderComponent, SourceBuilder, VariableType } from \"../ShaderBuilder\";\nimport { encodeDepthRgb } from \"./Decode\";\nimport { addRenderPass } from \"./RenderPass\";\n\n/** @internal */\nexport function addWindowToTexCoords(frag: FragmentShaderBuilder) {\n const windowCoordsToTexCoords = `\\nvec2 windowCoordsToTexCoords(vec2 wc) { return wc * u_invScreenSize; }\\n`;\n frag.addFunction(windowCoordsToTexCoords);\n frag.addUniform(\"u_invScreenSize\", VariableType.Vec2, (prog) => {\n prog.addProgramUniform(\"u_invScreenSize\", (uniform, params) => {\n params.target.uniforms.viewRect.bindInverseDimensions(uniform);\n });\n });\n}\n\n/** @internal */\nexport function addWhiteOnWhiteReversal(frag: FragmentShaderBuilder) {\n frag.addUniform(\"u_reverseWhiteOnWhite\", VariableType.Boolean, (prog) => {\n prog.addGraphicUniform(\"u_reverseWhiteOnWhite\", (uniform, params) => {\n const wantWoW = params.target.uniforms.style.wantWoWReversal;\n const doReversal = (wantWoW && params.geometry.wantWoWReversal(params.programParams)) ? 1 : 0;\n uniform.setUniform1i(doReversal);\n });\n });\n frag.set(FragmentShaderComponent.ReverseWhiteOnWhite, reverseWhiteOnWhite);\n}\n\nconst reverseWhiteOnWhite = `\n const vec3 white = vec3(1.0);\n const vec3 epsilon = vec3(0.0001);\n vec3 color = baseColor.rgb;\n vec3 delta = (color + epsilon) - white;\n vec4 wowColor = vec4(baseColor.rgb * vec3(float(delta.x <= 0.0 || delta.y <= 0.0 || delta.z <= 0.0)), baseColor.a); // set to black if almost white\n return u_reverseWhiteOnWhite ? wowColor : baseColor;\n`;\n\nconst multiplyAlpha = `\n if (u_renderPass >= kRenderPass_OpaqueLinear && u_renderPass <= kRenderPass_OpaqueGeneral)\n baseColor.a = 1.0;\n else\n baseColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n`;\n\nconst computePickBufferOutputs = `${multiplyAlpha}\n vec4 output0 = baseColor;\n\n // Fix interpolation errors despite all vertices sending exact same feature_id...\n ivec4 feature_id_i = ivec4(feature_id * 255.0 + 0.5);\n vec4 output1 = vec4(feature_id_i) / 255.0;\n float linearDepth = computeLinearDepth(v_eyeSpace.z);\n vec4 output2 = vec4(renderOrder * 0.0625, encodeDepthRgb(linearDepth)); // near=1, far=0\n`;\n\nconst computeAltPickBufferOutputs = `${multiplyAlpha}\n vec4 output0 = baseColor;\n vec4 output1 = vec4(0.0);\n vec4 output2 = vec4(0.0);\n vec4 output3 = vec4(0.0);\n`;\n\nconst assignPickBufferOutputsMRT = `\n FragColor0 = output0;\n FragColor1 = output1;\n FragColor2 = output2;\n FragColor3 = output3;\n`;\n\nconst reassignFeatureId = \" output1 = overrideFeatureId(output1);\";\n\n/** @internal */\nexport function addPickBufferOutputs(frag: FragmentShaderBuilder): void {\n frag.addFunction(encodeDepthRgb);\n frag.addFunction(computeLinearDepth);\n\n const prelude = new SourceBuilder();\n const overrideOrder = frag.get(FragmentShaderComponent.OverrideRenderOrder);\n if (overrideOrder) {\n frag.addFunction(\"float overrideRenderOrder(float currentOrder)\", overrideOrder);\n prelude.addline(\" float renderOrder = overrideRenderOrder(u_renderOrder);\");\n } else {\n prelude.addline(\" float renderOrder = u_renderOrder;\");\n }\n\n prelude.add(computePickBufferOutputs);\n\n const computeContourLineInfo = frag.get(FragmentShaderComponent.ComputeContourLineInfo) ?? \"return vec4(0.0);\";\n frag.addFunction(\"vec4 computeContourLineInfo()\", computeContourLineInfo);\n prelude.addline(\" vec4 output3 = computeContourLineInfo();\");\n\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined !== overrideColor) {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n prelude.addline(\" output0 = overrideColor(output0);\");\n }\n\n const overrideFeatureId = frag.get(FragmentShaderComponent.OverrideFeatureId);\n if (undefined !== overrideFeatureId) {\n frag.addFunction(\"vec4 overrideFeatureId(vec4 currentId)\", overrideFeatureId);\n prelude.addline(reassignFeatureId);\n }\n\n addRenderPass(frag);\n frag.addDrawBuffersExtension(4);\n frag.set(FragmentShaderComponent.AssignFragData, prelude.source + assignPickBufferOutputsMRT);\n}\n\n/** @internal */\nexport function addAltPickBufferOutputs(frag: FragmentShaderBuilder): void {\n const prelude = new SourceBuilder();\n prelude.add(computeAltPickBufferOutputs);\n\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined !== overrideColor) {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n prelude.addline(\" output0 = overrideColor(output0);\");\n }\n\n addRenderPass(frag);\n frag.addDrawBuffersExtension(4);\n frag.set(FragmentShaderComponent.AssignFragData, prelude.source + assignPickBufferOutputsMRT);\n}\n\n/** @internal */\nexport function addFragColorWithPreMultipliedAlpha(frag: FragmentShaderBuilder): void {\n addRenderPass(frag);\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined === overrideColor) {\n frag.set(FragmentShaderComponent.AssignFragData, assignFragColorWithPreMultipliedAlpha);\n } else {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n frag.set(FragmentShaderComponent.AssignFragData, overrideAndAssignFragColorWithPreMultipliedAlpha);\n }\n}\n\n/** @internal */\nexport const assignFragColor = \"FragColor = baseColor;\";\n\nconst assignFragColorWithPreMultipliedAlpha = `${multiplyAlpha}\n FragColor = baseColor;\n`;\n\nconst overrideAndAssignFragColorWithPreMultipliedAlpha = `${multiplyAlpha}\n vec4 fragColor = overrideColor(baseColor);\n FragColor = fragColor;\n`;\n\n/** @internal */\nexport const computeLinearDepth = `\nfloat computeLinearDepth(float eyeSpaceZ) {\n float eyeZ = -eyeSpaceZ;\n float near = u_frustum.x, far = u_frustum.y;\n float depthRange = far - near;\n float linearDepth = (eyeZ - near) / depthRange;\n return 1.0 - linearDepth;\n}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"Fragment.js","sourceRoot":"","sources":["../../../../../../src/internal/render/webgl/glsl/Fragment.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAkD,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,IAA2B;IAC9D,MAAM,uBAAuB,GAAG,4EAA4E,CAAC;IAC7G,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAC1C,IAAI,CAAC,UAAU,CAAC,iBAAiB,6BAAqB,CAAC,IAAI,EAAE,EAAE;QAC7D,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC5D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CAAC,IAA2B;IACj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,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG,kDAAyC,OAAO,CAAC,MAAM,GAAG,0BAA0B,CAAC,CAAC;AAChG,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,kCAAkC,CAAC,IAA2B;IAC5E,aAAa,CAAC,IAAI,CAAC,CAAC;IACpB,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,gDAAuC,CAAC;IACtE,IAAI,SAAS,KAAK,aAAa,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,kDAAyC,qCAAqC,CAAC,CAAC;IAC1F,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,WAAW,CAAC,uCAAuC,EAAE,aAAa,CAAC,CAAC;QACzE,IAAI,CAAC,GAAG,kDAAyC,gDAAgD,CAAC,CAAC;IACrG,CAAC;AACH,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAExD,MAAM,qCAAqC,GAAG,GAAG,aAAa;;CAE7D,CAAC;AAEF,MAAM,gDAAgD,GAAG,GAAG,aAAa;;;CAGxE,CAAC;AAEF,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;CAQjC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { FragmentShaderBuilder, FragmentShaderComponent, SourceBuilder, VariableType } from \"../ShaderBuilder\";\nimport { encodeDepthRgb } from \"./Decode\";\nimport { addRenderPass } from \"./RenderPass\";\n\n/** @internal */\nexport function addWindowToTexCoords(frag: FragmentShaderBuilder) {\n const windowCoordsToTexCoords = `\\nvec2 windowCoordsToTexCoords(vec2 wc) { return wc * u_invScreenSize; }\\n`;\n frag.addFunction(windowCoordsToTexCoords);\n frag.addUniform(\"u_invScreenSize\", VariableType.Vec2, (prog) => {\n prog.addProgramUniform(\"u_invScreenSize\", (uniform, params) => {\n params.target.uniforms.viewRect.bindInverseDimensions(uniform);\n });\n });\n}\n\n/** @internal */\nexport function addWhiteOnWhiteReversal(frag: FragmentShaderBuilder) {\n frag.addUniform(\"u_reverseWhiteOnWhite\", VariableType.Boolean, (prog) => {\n prog.addGraphicUniform(\"u_reverseWhiteOnWhite\", (uniform, params) => {\n const wantWoW = params.target.uniforms.style.wantWoWReversal;\n const doReversal = (wantWoW && params.geometry.wantWoWReversal(params.programParams)) ? 1 : 0;\n uniform.setUniform1i(doReversal);\n });\n });\n frag.set(FragmentShaderComponent.ReverseWhiteOnWhite, reverseWhiteOnWhite);\n}\n\nconst reverseWhiteOnWhite = `\n const vec3 white = vec3(1.0);\n const vec3 epsilon = vec3(0.0001);\n vec3 color = baseColor.rgb;\n vec3 delta = (color + epsilon) - white;\n vec4 wowColor = vec4(baseColor.rgb * vec3(float(delta.x <= 0.0 || delta.y <= 0.0 || delta.z <= 0.0)), baseColor.a); // set to black if almost white\n return u_reverseWhiteOnWhite ? wowColor : baseColor;\n`;\n\nconst multiplyAlpha = `\n if (u_renderPass >= kRenderPass_OpaqueLinear && u_renderPass <= kRenderPass_OpaqueGeneral)\n baseColor.a = 1.0;\n else\n baseColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n`;\n\nconst computePickBufferOutputs = `${multiplyAlpha}\n vec4 output0 = baseColor;\n\n // Fix interpolation errors despite all vertices sending exact same feature_id...\n ivec4 feature_id_i = ivec4(feature_id * 255.0 + 0.5);\n vec4 output1 = vec4(feature_id_i) / 255.0;\n float linearDepth = computeLinearDepth(v_eyeSpace.z);\n vec4 output2 = vec4(renderOrder * 0.0625, encodeDepthRgb(linearDepth)); // near=1, far=0\n`;\n\nconst computeAltPickBufferOutputs = `${multiplyAlpha}\n vec4 output0 = baseColor;\n vec4 output1 = vec4(0.0);\n vec4 output2 = vec4(0.0);\n`;\n\nconst assignPickBufferOutputsMRT = `\n FragColor0 = output0;\n FragColor1 = output1;\n FragColor2 = output2;\n`;\n\nconst reassignFeatureId = \" output1 = overrideFeatureId(output1);\";\n\n/** @internal */\nexport function addPickBufferOutputs(frag: FragmentShaderBuilder): void {\n frag.addFunction(encodeDepthRgb);\n frag.addFunction(computeLinearDepth);\n\n const prelude = new SourceBuilder();\n const overrideOrder = frag.get(FragmentShaderComponent.OverrideRenderOrder);\n if (overrideOrder) {\n frag.addFunction(\"float overrideRenderOrder(float currentOrder)\", overrideOrder);\n prelude.addline(\" float renderOrder = overrideRenderOrder(u_renderOrder);\");\n } else {\n prelude.addline(\" float renderOrder = u_renderOrder;\");\n }\n\n prelude.add(computePickBufferOutputs);\n\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined !== overrideColor) {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n prelude.addline(\" output0 = overrideColor(output0);\");\n }\n\n const overrideFeatureId = frag.get(FragmentShaderComponent.OverrideFeatureId);\n if (undefined !== overrideFeatureId) {\n frag.addFunction(\"vec4 overrideFeatureId(vec4 currentId)\", overrideFeatureId);\n prelude.addline(reassignFeatureId);\n }\n\n addRenderPass(frag);\n frag.addDrawBuffersExtension(3);\n frag.set(FragmentShaderComponent.AssignFragData, prelude.source + assignPickBufferOutputsMRT);\n}\n\n/** @internal */\nexport function addAltPickBufferOutputs(frag: FragmentShaderBuilder): void {\n const prelude = new SourceBuilder();\n prelude.add(computeAltPickBufferOutputs);\n\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined !== overrideColor) {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n prelude.addline(\" output0 = overrideColor(output0);\");\n }\n\n addRenderPass(frag);\n frag.addDrawBuffersExtension(3);\n frag.set(FragmentShaderComponent.AssignFragData, prelude.source + assignPickBufferOutputsMRT);\n}\n\n/** @internal */\nexport function addFragColorWithPreMultipliedAlpha(frag: FragmentShaderBuilder): void {\n addRenderPass(frag);\n const overrideColor = frag.get(FragmentShaderComponent.OverrideColor);\n if (undefined === overrideColor) {\n frag.set(FragmentShaderComponent.AssignFragData, assignFragColorWithPreMultipliedAlpha);\n } else {\n frag.addFunction(\"vec4 overrideColor(vec4 currentColor)\", overrideColor);\n frag.set(FragmentShaderComponent.AssignFragData, overrideAndAssignFragColorWithPreMultipliedAlpha);\n }\n}\n\n/** @internal */\nexport const assignFragColor = \"FragColor = baseColor;\";\n\nconst assignFragColorWithPreMultipliedAlpha = `${multiplyAlpha}\n FragColor = baseColor;\n`;\n\nconst overrideAndAssignFragColorWithPreMultipliedAlpha = `${multiplyAlpha}\n vec4 fragColor = overrideColor(baseColor);\n FragColor = fragColor;\n`;\n\n/** @internal */\nexport const computeLinearDepth = `\nfloat computeLinearDepth(float eyeSpaceZ) {\n float eyeZ = -eyeSpaceZ;\n float near = u_frustum.x, far = u_frustum.y;\n float depthRange = far - near;\n float linearDepth = (eyeZ - near) / depthRange;\n return 1.0 - linearDepth;\n}\n`;\n"]}
|
|
@@ -135,7 +135,7 @@ function addThematicToRealityMesh(builder, gradientTextureUnit) {
|
|
|
135
135
|
builder.vert.addGlobal("g_hillshadeIndex", 2 /* VariableType.Float */);
|
|
136
136
|
builder.addFunctionComputedVarying("v_n", 4 /* VariableType.Vec3 */, "computeLightingNormal", computeNormal);
|
|
137
137
|
builder.frag.addGlobal("g_normal", 4 /* VariableType.Vec3 */);
|
|
138
|
-
builder.frag.set(
|
|
138
|
+
builder.frag.set(24 /* FragmentShaderComponent.FinalizeNormal */, finalizeNormal);
|
|
139
139
|
addThematicDisplay(builder, false, true);
|
|
140
140
|
builder.addInlineComputedVarying("v_thematicIndex", 2 /* VariableType.Float */, getComputeThematicIndex(builder.vert.usesInstancedGeometry, false, false));
|
|
141
141
|
builder.vert.addUniform("u_worldToViewN", 6 /* VariableType.Mat3 */, (prog) => {
|
|
@@ -481,7 +481,7 @@ function addNormal(builder, animated) {
|
|
|
481
481
|
});
|
|
482
482
|
});
|
|
483
483
|
finalizeNormal += finalizeNormalPostlude;
|
|
484
|
-
builder.frag.set(
|
|
484
|
+
builder.frag.set(24 /* FragmentShaderComponent.FinalizeNormal */, finalizeNormal);
|
|
485
485
|
// Set to true to colorize surfaces based on normals (in world space).
|
|
486
486
|
// You must also set checkMaxVarying to false in ProgramBuilder.buildProgram to avoid assertions, if using a non-optimized build.
|
|
487
487
|
const debugNormals = false;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Id64String } from "@itwin/core-bentley";
|
|
5
5
|
import { BatchType, Feature, GeometryClass, ModelFeature } from "@itwin/core-common";
|
|
6
|
-
import {
|
|
6
|
+
import { HitPath, HitPriority } from "../HitDetail";
|
|
7
7
|
import { IModelConnection } from "../IModelConnection";
|
|
8
8
|
import type { Viewport } from "../Viewport";
|
|
9
9
|
import { Transform } from "@itwin/core-geometry";
|
|
@@ -28,10 +28,6 @@ export declare namespace Pixel {
|
|
|
28
28
|
readonly batchType?: BatchType;
|
|
29
29
|
/** The iModel from which the geometry producing the pixel originated. */
|
|
30
30
|
readonly iModel?: IModelConnection;
|
|
31
|
-
/** Information about the [contour line]($docs/learning/display/ContourDisplay.md), if any, that generated this pixel.
|
|
32
|
-
* @beta
|
|
33
|
-
*/
|
|
34
|
-
readonly contour?: ContourHit;
|
|
35
31
|
/** @internal */
|
|
36
32
|
readonly transformFromIModel?: Transform;
|
|
37
33
|
/** @internal */
|
|
@@ -58,7 +54,6 @@ export declare namespace Pixel {
|
|
|
58
54
|
viewAttachmentId?: string;
|
|
59
55
|
inSectionDrawingAttachment?: boolean;
|
|
60
56
|
transformFromIModel?: Transform;
|
|
61
|
-
contour?: ContourHit;
|
|
62
57
|
});
|
|
63
58
|
/** The Id of the element that produced the pixel. */
|
|
64
59
|
get elementId(): Id64String | undefined;
|
|
@@ -117,10 +112,6 @@ export declare namespace Pixel {
|
|
|
117
112
|
* @beta
|
|
118
113
|
*/
|
|
119
114
|
path?: HitPath;
|
|
120
|
-
/** Information about the [contour line]($docs/learning/display/ContourDisplay.md), if any, from which the hit originated.
|
|
121
|
-
* @beta
|
|
122
|
-
*/
|
|
123
|
-
contour?: ContourHit;
|
|
124
115
|
}
|
|
125
116
|
/** Describes the type of geometry that produced the [[Pixel.Data]]. */
|
|
126
117
|
enum GeometryType {
|
|
@@ -158,10 +149,8 @@ export declare namespace Pixel {
|
|
|
158
149
|
Feature = 1,// eslint-disable-line @typescript-eslint/no-shadow
|
|
159
150
|
/** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */
|
|
160
151
|
GeometryAndDistance = 4,
|
|
161
|
-
/** Select the [[ContourHit]]s describing which if any contour line produced each pixel. */
|
|
162
|
-
Contours = 8,
|
|
163
152
|
/** Select all aspects of each pixel. */
|
|
164
|
-
All =
|
|
153
|
+
All = 5
|
|
165
154
|
}
|
|
166
155
|
/** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.
|
|
167
156
|
* The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE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AI,IAAA;QACJ,wEAAwE;QACxE,UAAU,IAAA;KACX;IAED,iFAAiF;IACjF,KAAY,SAAS;QACnB,0GAA0G;QAC1G,OAAO,IAAA;QACP,8CAA8C;QAC9C,IAAI,IAAA;QACJ,2CAA2C;QAC3C,MAAM,IAAA;QACN,+CAA+C;QAC/C,SAAS,IAAA;KACV;IAED;;;OAGG;IACH,KAAY,QAAQ;QAClB,IAAI,IAAI;QACR,wDAAwD;QACxD,OAAO,IAAS,CAAE,mDAAmD;QACrE,mJAAmJ;QACnJ,mBAAmB,IAAS;QAC5B,wCAAwC;QACxC,GAAG,IAAgC;KACpC;IAED;;;OAGG;IACH,UAAiB,MAAM;QACrB,gFAAgF;QAChF,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACtC;IAED;;OAEG;IACH,KAAY,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC7D"}
|
package/lib/esm/render/Pixel.js
CHANGED
|
@@ -30,10 +30,6 @@ export var Pixel;
|
|
|
30
30
|
batchType;
|
|
31
31
|
/** The iModel from which the geometry producing the pixel originated. */
|
|
32
32
|
iModel;
|
|
33
|
-
/** Information about the [contour line]($docs/learning/display/ContourDisplay.md), if any, that generated this pixel.
|
|
34
|
-
* @beta
|
|
35
|
-
*/
|
|
36
|
-
contour;
|
|
37
33
|
/** @internal */
|
|
38
34
|
transformFromIModel;
|
|
39
35
|
/** @internal */
|
|
@@ -67,7 +63,6 @@ export var Pixel;
|
|
|
67
63
|
this.tileId = args.tileId;
|
|
68
64
|
this.viewAttachmentId = args.viewAttachmentId;
|
|
69
65
|
this.transformFromIModel = args.transformFromIModel;
|
|
70
|
-
this.contour = args.contour;
|
|
71
66
|
}
|
|
72
67
|
/** The Id of the element that produced the pixel. */
|
|
73
68
|
get elementId() {
|
|
@@ -132,7 +127,6 @@ export var Pixel;
|
|
|
132
127
|
sourceIModel: this.iModel,
|
|
133
128
|
transformFromSourceIModel: this.transformFromIModel,
|
|
134
129
|
path,
|
|
135
|
-
contour: this.contour,
|
|
136
130
|
};
|
|
137
131
|
}
|
|
138
132
|
}
|
|
@@ -176,10 +170,8 @@ export var Pixel;
|
|
|
176
170
|
Selector[Selector["Feature"] = 1] = "Feature";
|
|
177
171
|
/** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */
|
|
178
172
|
Selector[Selector["GeometryAndDistance"] = 4] = "GeometryAndDistance";
|
|
179
|
-
/** Select the [[ContourHit]]s describing which if any contour line produced each pixel. */
|
|
180
|
-
Selector[Selector["Contours"] = 8] = "Contours";
|
|
181
173
|
/** Select all aspects of each pixel. */
|
|
182
|
-
Selector[Selector["All"] =
|
|
174
|
+
Selector[Selector["All"] = 5] = "All";
|
|
183
175
|
})(Selector = Pixel.Selector || (Pixel.Selector = {}));
|
|
184
176
|
})(Pixel || (Pixel = {}));
|
|
185
177
|
//# sourceMappingURL=Pixel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pixel.js","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAA+B,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAuB,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhE;;;;GAIG;AACH,MAAM,KAAW,KAAK,CA6PrB;AA7PD,WAAiB,KAAK;IACpB,0DAA0D;IAC1D,MAAa,IAAI;QACf,2CAA2C;QAC3B,OAAO,CAAW;QAClB,OAAO,CAAc;QACrC,sHAAsH;QACtG,gBAAgB,CAAS;QACzC,oDAAoD;QACpC,IAAI,CAAe;QACnC,6DAA6D;QAC7C,SAAS,CAAY;QACrC,gBAAgB;QACA,SAAS,CAAa;QACtC,yEAAyE;QACzD,MAAM,CA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AA8C;QAC9C,+CAAI,CAAA;QACJ,qCAAqC;QACrC,qDAAO,CAAA;QACP,yDAAyD;QACzD,mDAAM,CAAA;QACN,uDAAuD;QACvD,+CAAI,CAAA;QACJ,wEAAwE;QACxE,2DAAU,CAAA;IACZ,CAAC,EAbW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAavB;IAED,iFAAiF;IACjF,IAAY,SASX;IATD,WAAY,SAAS;QACnB,0GAA0G;QAC1G,+CAAO,CAAA;QACP,8CAA8C;QAC9C,yCAAI,CAAA;QACJ,2CAA2C;QAC3C,6CAAM,CAAA;QACN,+CAA+C;QAC/C,mDAAS,CAAA;IACX,CAAC,EATW,SAAS,GAAT,eAAS,KAAT,eAAS,QASpB;IAED;;;OAGG;IACH,IAAY,QAUX;IAVD,WAAY,QAAQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,2FAA2F;QAC3F,+CAAiB,CAAA;QACjB,wCAAwC;QACxC,sCAA8C,CAAA;IAChD,CAAC,EAVW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAUnB;AAeH,CAAC,EA7PgB,KAAK,KAAL,KAAK,QA6PrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\nimport { ContourHit, HitPath, HitPriority } from \"../HitDetail\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport type { Viewport } from \"../Viewport\";\nimport { Transform } from \"@itwin/core-geometry\";\n\n/** Describes aspects of a pixel as read from a [[Viewport]].\n * @see [[Viewport.readPixels]].\n * @public\n * @extensions\n */\nexport namespace Pixel {\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\n export class Data {\n /** The feature that produced the pixel. */\n public readonly feature?: Feature;\n public readonly modelId?: Id64String;\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\n public readonly distanceFraction: number;\n /** The type of geometry that produced the pixel. */\n public readonly type: GeometryType;\n /** The planarity of the geometry that produced the pixel. */\n public readonly planarity: Planarity;\n /** @internal */\n public readonly batchType?: BatchType;\n /** The iModel from which the geometry producing the pixel originated. */\n public readonly iModel?: IModelConnection;\n /** Information about the [contour line]($docs/learning/display/ContourDisplay.md), if any, that generated this pixel.\n * @beta\n */\n public readonly contour?: ContourHit;\n /** @internal */\n public readonly transformFromIModel?: Transform;\n /** @internal */\n public readonly tileId?: string;\n /** The Id of the [ViewAttachment]($backend), if any, from which the pixel originated.\n * @beta\n */\n public readonly viewAttachmentId?: Id64String;\n /** True if the pixel originated from a [[SpatialViewState]] attached via a [SectionDrawing]($backend).\n * @beta\n */\n public readonly inSectionDrawingAttachment: boolean;\n /** @internal */\n public get isClassifier(): boolean {\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\n }\n\n /** @internal */\n public constructor(args?: {\n feature?: ModelFeature;\n distanceFraction?: number;\n type?: GeometryType;\n planarity?: Planarity;\n batchType?: BatchType;\n iModel?: IModelConnection;\n tileId?: string;\n viewAttachmentId?: string;\n inSectionDrawingAttachment?: boolean;\n transformFromIModel?: Transform;\n contour?: ContourHit;\n }) {\n this.distanceFraction = args?.distanceFraction ?? -1;\n this.type = args?.type ?? GeometryType.Unknown;\n this.planarity = args?.planarity ?? Planarity.Unknown;\n this.inSectionDrawingAttachment = true === args?.inSectionDrawingAttachment;\n\n if (!args) {\n return;\n }\n\n if (args.feature) {\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\n }\n\n this.modelId = args.feature?.modelId;\n this.iModel = args.iModel;\n this.tileId = args.tileId;\n this.viewAttachmentId = args.viewAttachmentId;\n this.transformFromIModel = args.transformFromIModel;\n this.contour = args.contour;\n }\n\n /** The Id of the element that produced the pixel. */\n public get elementId(): Id64String | undefined {\n return this.feature?.elementId;\n }\n\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\n public get subCategoryId(): Id64String | undefined {\n return this.feature?.subCategoryId;\n }\n\n /** The class of geometry that produced the pixel. */\n public get geometryClass(): GeometryClass | undefined {\n return this.feature?.geometryClass;\n }\n\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\n public computeHitPriority(): HitPriority {\n switch (this.type) {\n case Pixel.GeometryType.Surface:\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\n case Pixel.GeometryType.Linear:\n return HitPriority.WireEdge;\n case Pixel.GeometryType.Edge:\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\n case Pixel.GeometryType.Silhouette:\n return HitPriority.SilhouetteEdge;\n default:\n return HitPriority.Unknown;\n }\n }\n\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\n * @param viewport The viewport in which the hit originated.\n */\n public toHitProps(viewport: Viewport): Pixel.HitProps {\n let path: HitPath | undefined;\n if (this.viewAttachmentId) {\n const attachmentViewport = viewport.view.getAttachmentViewport({ viewAttachmentId: this.viewAttachmentId });\n if (attachmentViewport) {\n path = {\n viewAttachment: {\n viewport: attachmentViewport,\n id: this.viewAttachmentId,\n },\n };\n }\n }\n\n if (this.inSectionDrawingAttachment) {\n const checkVp = path?.viewAttachment?.viewport ?? viewport;\n const attachVp = checkVp.view.getAttachmentViewport({ inSectionDrawingAttachment: true });\n if (attachVp) {\n path = path ?? { };\n path.sectionDrawingAttachment = { viewport: attachVp };\n }\n }\n\n return {\n sourceId: this.elementId ?? Id64.invalid,\n priority: this.computeHitPriority(),\n distFraction: this.distanceFraction,\n subCategoryId: this.subCategoryId,\n geometryClass: this.geometryClass,\n modelId: this.modelId,\n tileId: this.tileId,\n isClassifier: this.isClassifier,\n sourceIModel: this.iModel,\n transformFromSourceIModel: this.transformFromIModel,\n path,\n contour: this.contour,\n };\n }\n }\n\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\n * ```ts\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\n * return new HitDetail({\n * ...pixel.toHitProps(viewport),\n * viewport, testPoint, hitSource, hitPoint, distXY,\n * };\n * }\n * ```\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\n * @public\n */\n export interface HitProps {\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\n sourceId: Id64String;\n /** The hit geometry priority/classification. */\n priority: HitPriority;\n /** The distance in view coordinates between the hit and the near plane. */\n distFraction: number;\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\n subCategoryId?: Id64String;\n /** The class of the hit geometry. */\n geometryClass?: GeometryClass;\n /** The Id of the [[ModelState]] from which the hit originated. */\n modelId?: Id64String;\n /** The IModelConnection from which the hit originated.\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\n * other than the one associated with the viewport.\n * @internal\n */\n sourceIModel?: IModelConnection;\n /** @internal */\n transformFromSourceIModel?: Transform;\n /** @internal chiefly for debugging */\n tileId?: string;\n /** True if the hit originated from a reality model classifier.\n * @alpha\n */\n isClassifier?: boolean;\n /** Path through which the hit was located.\n * @beta\n */\n path?: HitPath;\n /** Information about the [contour line]($docs/learning/display/ContourDisplay.md), if any, from which the hit originated.\n * @beta\n */\n contour?: ContourHit;\n }\n\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\n export enum GeometryType {\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\n Unknown, // Geometry was not selected, or type could not be determined\n /** No geometry was rendered to this pixel. */\n None,\n /** A surface produced this pixel. */\n Surface,\n /** A point primitive or polyline produced this pixel. */\n Linear,\n /** This pixel was produced by an edge of a surface. */\n Edge,\n /** This pixel was produced by a silhouette edge of a curved surface. */\n Silhouette,\n }\n\n /** Describes the planarity of the foremost geometry which produced the pixel. */\n export enum Planarity {\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\n Unknown,\n /** No geometry was rendered to this pixel. */\n None,\n /** Planar geometry produced this pixel. */\n Planar,\n /** Non-planar geometry produced this pixel. */\n NonPlanar,\n }\n\n /**\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\n * Aspects not specified will be omitted from the returned data.\n */\n export enum Selector {\n None = 0,\n /** Select the [[Feature]] which produced each pixel. */\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\n GeometryAndDistance = 1 << 2,\n /** Select the [[ContourHit]]s describing which if any contour line produced each pixel. */\n Contours = 1 << 3,\n /** Select all aspects of each pixel. */\n All = GeometryAndDistance | Feature | Contours,\n }\n\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\n * @see [[Viewport.readPixels]].\n */\n export interface Buffer {\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\n getPixel(x: number, y: number): Data;\n }\n\n /** A function which receives the results of a call to [[Viewport.readPixels]].\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\n */\n export type Receiver = (pixels: Buffer | undefined) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Pixel.js","sourceRoot":"","sources":["../../../src/render/Pixel.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IA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AI,CAAC,OAAO;gBACrB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,YAAY,EAAE,IAAI,CAAC,MAAM;gBACzB,yBAAyB,EAAE,IAAI,CAAC,mBAAmB;gBACnD,IAAI;aACL,CAAC;QACJ,CAAC;KACF;IAvIY,UAAI,OAuIhB,CAAA;IAgDD,uEAAuE;IACvE,IAAY,YAaX;IAbD,WAAY,YAAY;QACtB,qGAAqG;QACrG,qDAAO,CAAA;QACP,8CAA8C;QAC9C,+CAAI,CAAA;QACJ,qCAAqC;QACrC,qDAAO,CAAA;QACP,yDAAyD;QACzD,mDAAM,CAAA;QACN,uDAAuD;QACvD,+CAAI,CAAA;QACJ,wEAAwE;QACxE,2DAAU,CAAA;IACZ,CAAC,EAbW,YAAY,GAAZ,kBAAY,KAAZ,kBAAY,QAavB;IAED,iFAAiF;IACjF,IAAY,SASX;IATD,WAAY,SAAS;QACnB,0GAA0G;QAC1G,+CAAO,CAAA;QACP,8CAA8C;QAC9C,yCAAI,CAAA;QACJ,2CAA2C;QAC3C,6CAAM,CAAA;QACN,+CAA+C;QAC/C,mDAAS,CAAA;IACX,CAAC,EATW,SAAS,GAAT,eAAS,KAAT,eAAS,QASpB;IAED;;;OAGG;IACH,IAAY,QAQX;IARD,WAAY,QAAQ;QAClB,uCAAQ,CAAA;QACR,wDAAwD;QACxD,6CAAgB,CAAA;QAChB,mJAAmJ;QACnJ,qEAA4B,CAAA;QAC5B,wCAAwC;QACxC,qCAAmC,CAAA;IACrC,CAAC,EARW,QAAQ,GAAR,cAAQ,KAAR,cAAQ,QAQnB;AAeH,CAAC,EAhPgB,KAAK,KAAL,KAAK,QAgPrB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { BatchType, Feature, GeometryClass, ModelFeature } from \"@itwin/core-common\";\nimport { HitPath, HitPriority } from \"../HitDetail\";\nimport { IModelConnection } from \"../IModelConnection\";\nimport type { Viewport } from \"../Viewport\";\nimport { Transform } from \"@itwin/core-geometry\";\n\n/** Describes aspects of a pixel as read from a [[Viewport]].\n * @see [[Viewport.readPixels]].\n * @public\n * @extensions\n */\nexport namespace Pixel {\n /** Describes a single pixel within a [[Pixel.Buffer]]. */\n export class Data {\n /** The feature that produced the pixel. */\n public readonly feature?: Feature;\n public readonly modelId?: Id64String;\n /** The pixel's depth in [[CoordSystem.Npc]] coordinates (0 to 1), or -1 if depth was not written or not requested. */\n public readonly distanceFraction: number;\n /** The type of geometry that produced the pixel. */\n public readonly type: GeometryType;\n /** The planarity of the geometry that produced the pixel. */\n public readonly planarity: Planarity;\n /** @internal */\n public readonly batchType?: BatchType;\n /** The iModel from which the geometry producing the pixel originated. */\n public readonly iModel?: IModelConnection;\n /** @internal */\n public readonly transformFromIModel?: Transform;\n /** @internal */\n public readonly tileId?: string;\n /** The Id of the [ViewAttachment]($backend), if any, from which the pixel originated.\n * @beta\n */\n public readonly viewAttachmentId?: Id64String;\n /** True if the pixel originated from a [[SpatialViewState]] attached via a [SectionDrawing]($backend).\n * @beta\n */\n public readonly inSectionDrawingAttachment: boolean;\n /** @internal */\n public get isClassifier(): boolean {\n return undefined !== this.batchType && BatchType.Primary !== this.batchType;\n }\n\n /** @internal */\n public constructor(args?: {\n feature?: ModelFeature;\n distanceFraction?: number;\n type?: GeometryType;\n planarity?: Planarity;\n batchType?: BatchType;\n iModel?: IModelConnection;\n tileId?: string;\n viewAttachmentId?: string;\n inSectionDrawingAttachment?: boolean;\n transformFromIModel?: Transform;\n }) {\n this.distanceFraction = args?.distanceFraction ?? -1;\n this.type = args?.type ?? GeometryType.Unknown;\n this.planarity = args?.planarity ?? Planarity.Unknown;\n this.inSectionDrawingAttachment = true === args?.inSectionDrawingAttachment;\n\n if (!args) {\n return;\n }\n\n if (args.feature) {\n this.feature = new Feature(args.feature.elementId, args.feature.subCategoryId, args.feature.geometryClass);\n }\n\n this.modelId = args.feature?.modelId;\n this.iModel = args.iModel;\n this.tileId = args.tileId;\n this.viewAttachmentId = args.viewAttachmentId;\n this.transformFromIModel = args.transformFromIModel;\n }\n\n /** The Id of the element that produced the pixel. */\n public get elementId(): Id64String | undefined {\n return this.feature?.elementId;\n }\n\n /** The Id of the [SubCategory]($backend) that produced the pixel. */\n public get subCategoryId(): Id64String | undefined {\n return this.feature?.subCategoryId;\n }\n\n /** The class of geometry that produced the pixel. */\n public get geometryClass(): GeometryClass | undefined {\n return this.feature?.geometryClass;\n }\n\n /** Computes the [[HitPriority]] of this pixel based on its [[type]] and [[planarity]]. */\n public computeHitPriority(): HitPriority {\n switch (this.type) {\n case Pixel.GeometryType.Surface:\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarSurface : HitPriority.NonPlanarSurface;\n case Pixel.GeometryType.Linear:\n return HitPriority.WireEdge;\n case Pixel.GeometryType.Edge:\n return Pixel.Planarity.Planar === this.planarity ? HitPriority.PlanarEdge : HitPriority.NonPlanarEdge;\n case Pixel.GeometryType.Silhouette:\n return HitPriority.SilhouetteEdge;\n default:\n return HitPriority.Unknown;\n }\n }\n\n /** Convert this pixel to a [[Pixel.HitProps]] suitable for constructing a [[HitDetail]].\n * @param viewport The viewport in which the hit originated.\n */\n public toHitProps(viewport: Viewport): Pixel.HitProps {\n let path: HitPath | undefined;\n if (this.viewAttachmentId) {\n const attachmentViewport = viewport.view.getAttachmentViewport({ viewAttachmentId: this.viewAttachmentId });\n if (attachmentViewport) {\n path = {\n viewAttachment: {\n viewport: attachmentViewport,\n id: this.viewAttachmentId,\n },\n };\n }\n }\n\n if (this.inSectionDrawingAttachment) {\n const checkVp = path?.viewAttachment?.viewport ?? viewport;\n const attachVp = checkVp.view.getAttachmentViewport({ inSectionDrawingAttachment: true });\n if (attachVp) {\n path = path ?? { };\n path.sectionDrawingAttachment = { viewport: attachVp };\n }\n }\n\n return {\n sourceId: this.elementId ?? Id64.invalid,\n priority: this.computeHitPriority(),\n distFraction: this.distanceFraction,\n subCategoryId: this.subCategoryId,\n geometryClass: this.geometryClass,\n modelId: this.modelId,\n tileId: this.tileId,\n isClassifier: this.isClassifier,\n sourceIModel: this.iModel,\n transformFromSourceIModel: this.transformFromIModel,\n path,\n };\n }\n }\n\n /** Describes a subset of [[HitDetailProps]] computed from a [[Pixel.Data]], suitable for constructing a [[HitDetail]].\n * For example, the following function creates a `HitDetail` from a `Pixel.Data` and other hit information:\n * ```ts\n * function makeHitDetail(pixel: Pixel.Data, viewport: ScreenViewport, testPoint: Point3d, hitSource: HitSource, hitPoint: Point3d, distXY: number): HitDetail {\n * return new HitDetail({\n * ...pixel.toHitProps(viewport),\n * viewport, testPoint, hitSource, hitPoint, distXY,\n * };\n * }\n * ```\n * @see [[Data.toHitProps]] to convert a [[Pixel.Data]] to a `HitProps`.\n * @public\n */\n export interface HitProps {\n /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */\n sourceId: Id64String;\n /** The hit geometry priority/classification. */\n priority: HitPriority;\n /** The distance in view coordinates between the hit and the near plane. */\n distFraction: number;\n /** The [SubCategory]($backend) to which the hit geometry belongs. */\n subCategoryId?: Id64String;\n /** The class of the hit geometry. */\n geometryClass?: GeometryClass;\n /** The Id of the [[ModelState]] from which the hit originated. */\n modelId?: Id64String;\n /** The IModelConnection from which the hit originated.\n * This should almost always be left undefined, unless the hit is known to have originated from an iModel\n * other than the one associated with the viewport.\n * @internal\n */\n sourceIModel?: IModelConnection;\n /** @internal */\n transformFromSourceIModel?: Transform;\n /** @internal chiefly for debugging */\n tileId?: string;\n /** True if the hit originated from a reality model classifier.\n * @alpha\n */\n isClassifier?: boolean;\n /** Path through which the hit was located.\n * @beta\n */\n path?: HitPath;\n }\n\n /** Describes the type of geometry that produced the [[Pixel.Data]]. */\n export enum GeometryType {\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the type could not be determined. */\n Unknown, // Geometry was not selected, or type could not be determined\n /** No geometry was rendered to this pixel. */\n None,\n /** A surface produced this pixel. */\n Surface,\n /** A point primitive or polyline produced this pixel. */\n Linear,\n /** This pixel was produced by an edge of a surface. */\n Edge,\n /** This pixel was produced by a silhouette edge of a curved surface. */\n Silhouette,\n }\n\n /** Describes the planarity of the foremost geometry which produced the pixel. */\n export enum Planarity {\n /** [[Pixel.Selector.GeometryAndDistance]] was not specified, or the planarity could not be determined. */\n Unknown,\n /** No geometry was rendered to this pixel. */\n None,\n /** Planar geometry produced this pixel. */\n Planar,\n /** Non-planar geometry produced this pixel. */\n NonPlanar,\n }\n\n /**\n * Bit-mask by which callers of [[Viewport.readPixels]] specify which aspects are of interest.\n * Aspects not specified will be omitted from the returned data.\n */\n export enum Selector {\n None = 0,\n /** Select the [[Feature]] which produced each pixel. */\n Feature = 1 << 0, // eslint-disable-line @typescript-eslint/no-shadow\n /** Select the type and planarity of geometry which produced each pixel as well as the fraction of its distance between the near and far planes. */\n GeometryAndDistance = 1 << 2,\n /** Select all aspects of each pixel. */\n All = GeometryAndDistance | Feature,\n }\n\n /** A rectangular array of pixels as read from a [[Viewport]]'s frame buffer. Each pixel is represented as a [[Pixel.Data]] object.\n * The contents of the pixel buffer will be specified using device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\n * @see [[Viewport.readPixels]].\n */\n export interface Buffer {\n /** Retrieve the data associated with the pixel at (x,y) in view coordinates. */\n getPixel(x: number, y: number): Data;\n }\n\n /** A function which receives the results of a call to [[Viewport.readPixels]].\n * @note The contents of the buffer become invalid once the Receiver function returns. Do not store a reference to it.\n */\n export type Receiver = (pixels: Buffer | undefined) => void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-frontend",
|
|
3
|
-
"version": "5.3.0-dev.
|
|
3
|
+
"version": "5.3.0-dev.9",
|
|
4
4
|
"description": "iTwin.js frontend components",
|
|
5
5
|
"main": "lib/cjs/core-frontend.js",
|
|
6
6
|
"module": "lib/esm/core-frontend.js",
|
|
@@ -23,20 +23,21 @@
|
|
|
23
23
|
"url": "http://www.bentley.com"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/appui-abstract": "5.3.0-dev.
|
|
27
|
-
"@itwin/core-
|
|
28
|
-
"@itwin/core-geometry": "5.3.0-dev.
|
|
29
|
-
"@itwin/core-common": "5.3.0-dev.
|
|
30
|
-
"@itwin/
|
|
31
|
-
"@itwin/core-
|
|
32
|
-
"@itwin/
|
|
33
|
-
"@itwin/ecschema-rpcinterface-common": "5.3.0-dev.
|
|
26
|
+
"@itwin/appui-abstract": "5.3.0-dev.9",
|
|
27
|
+
"@itwin/core-orbitgt": "5.3.0-dev.9",
|
|
28
|
+
"@itwin/core-geometry": "5.3.0-dev.9",
|
|
29
|
+
"@itwin/core-common": "5.3.0-dev.9",
|
|
30
|
+
"@itwin/core-quantity": "5.3.0-dev.9",
|
|
31
|
+
"@itwin/core-bentley": "5.3.0-dev.9",
|
|
32
|
+
"@itwin/ecschema-metadata": "5.3.0-dev.9",
|
|
33
|
+
"@itwin/ecschema-rpcinterface-common": "5.3.0-dev.9"
|
|
34
34
|
},
|
|
35
35
|
"//devDependencies": [
|
|
36
36
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
37
37
|
"NOTE: All tools used by scripts in this package must be listed as devDependencies"
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@itwin/object-storage-core": "^3.0.4",
|
|
40
41
|
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
41
42
|
"@types/chai-as-promised": "^7",
|
|
42
43
|
"@types/draco3d": "^1.4.10",
|
|
@@ -56,29 +57,27 @@
|
|
|
56
57
|
"vite-multiple-assets": "^1.3.1",
|
|
57
58
|
"vite-plugin-static-copy": "2.2.0",
|
|
58
59
|
"webpack": "^5.97.1",
|
|
59
|
-
"@itwin/appui-abstract": "5.3.0-dev.
|
|
60
|
-
"@itwin/
|
|
61
|
-
"@itwin/core-
|
|
62
|
-
"@itwin/
|
|
63
|
-
"@itwin/
|
|
64
|
-
"@itwin/core-
|
|
65
|
-
"@itwin/
|
|
66
|
-
"@itwin/
|
|
67
|
-
"@itwin/
|
|
60
|
+
"@itwin/appui-abstract": "5.3.0-dev.9",
|
|
61
|
+
"@itwin/core-bentley": "5.3.0-dev.9",
|
|
62
|
+
"@itwin/core-common": "5.3.0-dev.9",
|
|
63
|
+
"@itwin/build-tools": "5.3.0-dev.9",
|
|
64
|
+
"@itwin/core-geometry": "5.3.0-dev.9",
|
|
65
|
+
"@itwin/core-orbitgt": "5.3.0-dev.9",
|
|
66
|
+
"@itwin/core-quantity": "5.3.0-dev.9",
|
|
67
|
+
"@itwin/ecschema-metadata": "5.3.0-dev.9",
|
|
68
|
+
"@itwin/ecschema-rpcinterface-common": "5.3.0-dev.9"
|
|
68
69
|
},
|
|
69
70
|
"//dependencies": [
|
|
70
71
|
"NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",
|
|
71
72
|
"NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"
|
|
72
73
|
],
|
|
73
74
|
"dependencies": {
|
|
74
|
-
"@itwin/cloud-agnostic-core": "^2.2.4",
|
|
75
|
-
"@itwin/object-storage-core": "^2.3.0",
|
|
76
75
|
"@loaders.gl/core": "^4.3.4",
|
|
77
76
|
"@loaders.gl/draco": "^4.3.4",
|
|
78
77
|
"fuse.js": "^3.3.0",
|
|
79
78
|
"wms-capabilities": "0.4.0",
|
|
80
|
-
"@itwin/core-i18n": "5.3.0-dev.
|
|
81
|
-
"@itwin/webgl-compatibility": "5.3.0-dev.
|
|
79
|
+
"@itwin/core-i18n": "5.3.0-dev.9",
|
|
80
|
+
"@itwin/webgl-compatibility": "5.3.0-dev.9"
|
|
82
81
|
},
|
|
83
82
|
"scripts": {
|
|
84
83
|
"build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco",
|