@itwin/core-frontend 4.10.0-dev.3 → 4.10.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
- package/lib/cjs/DisplayStyleState.js +5 -1
- package/lib/cjs/DisplayStyleState.js.map +1 -1
- package/lib/cjs/ElementLocateManager.d.ts +7 -1
- package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
- package/lib/cjs/ElementLocateManager.js +34 -10
- package/lib/cjs/ElementLocateManager.js.map +1 -1
- package/lib/cjs/NoRenderApp.d.ts +1 -0
- package/lib/cjs/NoRenderApp.d.ts.map +1 -1
- package/lib/cjs/NoRenderApp.js +1 -0
- package/lib/cjs/NoRenderApp.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +25 -1
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +20 -12
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/common/imdl/ImdlModel.d.ts +3 -8
- package/lib/cjs/common/imdl/ImdlModel.d.ts.map +1 -1
- package/lib/cjs/common/imdl/ImdlModel.js.map +1 -1
- package/lib/cjs/common/internal/Symbols.d.ts +7 -0
- package/lib/cjs/common/internal/Symbols.d.ts.map +1 -1
- package/lib/cjs/common/internal/Symbols.js +8 -1
- package/lib/cjs/common/internal/Symbols.js.map +1 -1
- package/lib/cjs/common/internal/render/InstancedGraphicPropsBuilder.d.ts +15 -0
- package/lib/cjs/common/internal/render/InstancedGraphicPropsBuilder.d.ts.map +1 -0
- package/lib/cjs/common/internal/render/InstancedGraphicPropsBuilder.js +95 -0
- package/lib/cjs/common/internal/render/InstancedGraphicPropsBuilder.js.map +1 -0
- package/lib/cjs/common/internal/render/LineCode.d.ts +9 -0
- package/lib/cjs/common/internal/render/LineCode.d.ts.map +1 -0
- package/lib/cjs/common/internal/render/LineCode.js +31 -0
- package/lib/cjs/common/internal/render/LineCode.js.map +1 -0
- package/lib/cjs/common/internal/render/OvrFlags.d.ts +25 -0
- package/lib/cjs/common/internal/render/OvrFlags.d.ts.map +1 -0
- package/lib/cjs/common/internal/render/OvrFlags.js +10 -0
- package/lib/cjs/common/internal/render/OvrFlags.js.map +1 -0
- package/lib/cjs/common/render/InstancedGraphicParams.d.ts +25 -1
- package/lib/cjs/common/render/InstancedGraphicParams.d.ts.map +1 -1
- package/lib/cjs/common/render/InstancedGraphicParams.js +59 -0
- package/lib/cjs/common/render/InstancedGraphicParams.js.map +1 -1
- package/lib/cjs/common/render/RenderInstancesParams.d.ts +76 -0
- package/lib/cjs/common/render/RenderInstancesParams.d.ts.map +1 -0
- package/lib/cjs/common/render/RenderInstancesParams.js +33 -0
- package/lib/cjs/common/render/RenderInstancesParams.js.map +1 -0
- package/lib/cjs/common.d.ts +1 -0
- package/lib/cjs/common.d.ts.map +1 -1
- package/lib/cjs/common.js +1 -0
- package/lib/cjs/common.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +1 -0
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +1 -0
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/internal/render/PrimitiveBuilder.d.ts +4 -1
- package/lib/cjs/internal/render/PrimitiveBuilder.d.ts.map +1 -1
- package/lib/cjs/internal/render/PrimitiveBuilder.js +82 -35
- package/lib/cjs/internal/render/PrimitiveBuilder.js.map +1 -1
- package/lib/cjs/internal/render/RenderGeometry.d.ts +20 -0
- package/lib/cjs/internal/render/RenderGeometry.d.ts.map +1 -0
- package/lib/cjs/internal/render/RenderGeometry.js +10 -0
- package/lib/cjs/internal/render/RenderGeometry.js.map +1 -0
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.d.ts +24 -0
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.d.ts.map +1 -0
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.js +69 -0
- package/lib/cjs/internal/render/RenderInstancesParamsImpl.js.map +1 -0
- package/lib/cjs/render/GraphicBuilder.d.ts +17 -3
- package/lib/cjs/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/cjs/render/GraphicBuilder.js +7 -1
- package/lib/cjs/render/GraphicBuilder.js.map +1 -1
- package/lib/cjs/render/GraphicTemplate.d.ts +76 -0
- package/lib/cjs/render/GraphicTemplate.d.ts.map +1 -0
- package/lib/cjs/render/GraphicTemplate.js +41 -0
- package/lib/cjs/render/GraphicTemplate.js.map +1 -0
- package/lib/cjs/render/MockRender.d.ts +12 -2
- package/lib/cjs/render/MockRender.d.ts.map +1 -1
- package/lib/cjs/render/MockRender.js +19 -5
- package/lib/cjs/render/MockRender.js.map +1 -1
- package/lib/cjs/render/RenderSystem.d.ts +58 -10
- package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
- package/lib/cjs/render/RenderSystem.js +42 -4
- package/lib/cjs/render/RenderSystem.js.map +1 -1
- package/lib/cjs/render/RenderTarget.d.ts +1 -1
- package/lib/cjs/render/RenderTarget.d.ts.map +1 -1
- package/lib/cjs/render/RenderTarget.js.map +1 -1
- package/lib/cjs/render/webgl/BatchUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/EdgeSettings.d.ts +2 -1
- package/lib/cjs/render/webgl/EdgeSettings.d.ts.map +1 -1
- package/lib/cjs/render/webgl/EdgeSettings.js.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.d.ts +1 -0
- package/lib/cjs/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/cjs/render/webgl/FeatureOverrides.js +37 -20
- package/lib/cjs/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.d.ts +40 -10
- package/lib/cjs/render/webgl/InstancedGeometry.d.ts.map +1 -1
- package/lib/cjs/render/webgl/InstancedGeometry.js +99 -31
- package/lib/cjs/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/LineCode.d.ts.map +1 -1
- package/lib/cjs/render/webgl/LineCode.js +2 -14
- package/lib/cjs/render/webgl/LineCode.js.map +1 -1
- package/lib/cjs/render/webgl/Mesh.d.ts +9 -4
- package/lib/cjs/render/webgl/Mesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Mesh.js +18 -16
- package/lib/cjs/render/webgl/Mesh.js.map +1 -1
- package/lib/cjs/render/webgl/PointCloud.d.ts +5 -1
- package/lib/cjs/render/webgl/PointCloud.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PointCloud.js +7 -2
- package/lib/cjs/render/webgl/PointCloud.js.map +1 -1
- package/lib/cjs/render/webgl/PointString.d.ts +5 -1
- package/lib/cjs/render/webgl/PointString.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PointString.js +8 -3
- package/lib/cjs/render/webgl/PointString.js.map +1 -1
- package/lib/cjs/render/webgl/Polyline.d.ts +5 -1
- package/lib/cjs/render/webgl/Polyline.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Polyline.js +7 -2
- package/lib/cjs/render/webgl/Polyline.js.map +1 -1
- package/lib/cjs/render/webgl/Primitive.d.ts +1 -3
- package/lib/cjs/render/webgl/Primitive.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Primitive.js +1 -6
- package/lib/cjs/render/webgl/Primitive.js.map +1 -1
- package/lib/cjs/render/webgl/RealityMesh.d.ts +5 -1
- package/lib/cjs/render/webgl/RealityMesh.d.ts.map +1 -1
- package/lib/cjs/render/webgl/RealityMesh.js +6 -0
- package/lib/cjs/render/webgl/RealityMesh.js.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.d.ts +0 -18
- package/lib/cjs/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/cjs/render/webgl/RenderFlags.js.map +1 -1
- package/lib/cjs/render/webgl/System.d.ts +11 -5
- package/lib/cjs/render/webgl/System.d.ts.map +1 -1
- package/lib/cjs/render/webgl/System.js +81 -13
- package/lib/cjs/render/webgl/System.js.map +1 -1
- package/lib/cjs/render/webgl/Target.d.ts +6 -2
- package/lib/cjs/render/webgl/Target.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Target.js +23 -1
- package/lib/cjs/render/webgl/Target.js.map +1 -1
- package/lib/cjs/render/webgl/Texture.d.ts +2 -1
- package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Texture.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js +6 -0
- package/lib/cjs/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +27 -7
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +84 -68
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/ImdlGraphicsCreator.d.ts +4 -1
- package/lib/cjs/tile/ImdlGraphicsCreator.d.ts.map +1 -1
- package/lib/cjs/tile/ImdlGraphicsCreator.js +32 -22
- package/lib/cjs/tile/ImdlGraphicsCreator.js.map +1 -1
- package/lib/esm/DisplayStyleState.d.ts.map +1 -1
- package/lib/esm/DisplayStyleState.js +5 -1
- package/lib/esm/DisplayStyleState.js.map +1 -1
- package/lib/esm/ElementLocateManager.d.ts +7 -1
- package/lib/esm/ElementLocateManager.d.ts.map +1 -1
- package/lib/esm/ElementLocateManager.js +34 -10
- package/lib/esm/ElementLocateManager.js.map +1 -1
- package/lib/esm/NoRenderApp.d.ts +1 -0
- package/lib/esm/NoRenderApp.d.ts.map +1 -1
- package/lib/esm/NoRenderApp.js +1 -0
- package/lib/esm/NoRenderApp.js.map +1 -1
- package/lib/esm/Viewport.d.ts +25 -1
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +20 -12
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/common/imdl/ImdlModel.d.ts +3 -8
- package/lib/esm/common/imdl/ImdlModel.d.ts.map +1 -1
- package/lib/esm/common/imdl/ImdlModel.js.map +1 -1
- package/lib/esm/common/internal/Symbols.d.ts +7 -0
- package/lib/esm/common/internal/Symbols.d.ts.map +1 -1
- package/lib/esm/common/internal/Symbols.js +7 -0
- package/lib/esm/common/internal/Symbols.js.map +1 -1
- package/lib/esm/common/internal/render/InstancedGraphicPropsBuilder.d.ts +15 -0
- package/lib/esm/common/internal/render/InstancedGraphicPropsBuilder.d.ts.map +1 -0
- package/lib/esm/common/internal/render/InstancedGraphicPropsBuilder.js +91 -0
- package/lib/esm/common/internal/render/InstancedGraphicPropsBuilder.js.map +1 -0
- package/lib/esm/common/internal/render/LineCode.d.ts +9 -0
- package/lib/esm/common/internal/render/LineCode.d.ts.map +1 -0
- package/lib/esm/common/internal/render/LineCode.js +27 -0
- package/lib/esm/common/internal/render/LineCode.js.map +1 -0
- package/lib/esm/common/internal/render/OvrFlags.d.ts +25 -0
- package/lib/esm/common/internal/render/OvrFlags.d.ts.map +1 -0
- package/lib/esm/common/internal/render/OvrFlags.js +9 -0
- package/lib/esm/common/internal/render/OvrFlags.js.map +1 -0
- package/lib/esm/common/render/InstancedGraphicParams.d.ts +25 -1
- package/lib/esm/common/render/InstancedGraphicParams.d.ts.map +1 -1
- package/lib/esm/common/render/InstancedGraphicParams.js +58 -1
- package/lib/esm/common/render/InstancedGraphicParams.js.map +1 -1
- package/lib/esm/common/render/RenderInstancesParams.d.ts +76 -0
- package/lib/esm/common/render/RenderInstancesParams.d.ts.map +1 -0
- package/lib/esm/common/render/RenderInstancesParams.js +30 -0
- package/lib/esm/common/render/RenderInstancesParams.js.map +1 -0
- package/lib/esm/common.d.ts +1 -0
- package/lib/esm/common.d.ts.map +1 -1
- package/lib/esm/common.js +1 -0
- package/lib/esm/common.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +1 -0
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +1 -0
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/internal/render/PrimitiveBuilder.d.ts +4 -1
- package/lib/esm/internal/render/PrimitiveBuilder.d.ts.map +1 -1
- package/lib/esm/internal/render/PrimitiveBuilder.js +82 -35
- package/lib/esm/internal/render/PrimitiveBuilder.js.map +1 -1
- package/lib/esm/internal/render/RenderGeometry.d.ts +20 -0
- package/lib/esm/internal/render/RenderGeometry.d.ts.map +1 -0
- package/lib/esm/internal/render/RenderGeometry.js +9 -0
- package/lib/esm/internal/render/RenderGeometry.js.map +1 -0
- package/lib/esm/internal/render/RenderInstancesParamsImpl.d.ts +24 -0
- package/lib/esm/internal/render/RenderInstancesParamsImpl.d.ts.map +1 -0
- package/lib/esm/internal/render/RenderInstancesParamsImpl.js +64 -0
- package/lib/esm/internal/render/RenderInstancesParamsImpl.js.map +1 -0
- package/lib/esm/render/GraphicBuilder.d.ts +17 -3
- package/lib/esm/render/GraphicBuilder.d.ts.map +1 -1
- package/lib/esm/render/GraphicBuilder.js +7 -1
- package/lib/esm/render/GraphicBuilder.js.map +1 -1
- package/lib/esm/render/GraphicTemplate.d.ts +76 -0
- package/lib/esm/render/GraphicTemplate.d.ts.map +1 -0
- package/lib/esm/render/GraphicTemplate.js +37 -0
- package/lib/esm/render/GraphicTemplate.js.map +1 -0
- package/lib/esm/render/MockRender.d.ts +12 -2
- package/lib/esm/render/MockRender.d.ts.map +1 -1
- package/lib/esm/render/MockRender.js +19 -5
- package/lib/esm/render/MockRender.js.map +1 -1
- package/lib/esm/render/RenderSystem.d.ts +58 -10
- package/lib/esm/render/RenderSystem.d.ts.map +1 -1
- package/lib/esm/render/RenderSystem.js +44 -6
- package/lib/esm/render/RenderSystem.js.map +1 -1
- package/lib/esm/render/RenderTarget.d.ts +1 -1
- package/lib/esm/render/RenderTarget.d.ts.map +1 -1
- package/lib/esm/render/RenderTarget.js.map +1 -1
- package/lib/esm/render/webgl/BatchUniforms.js.map +1 -1
- package/lib/esm/render/webgl/EdgeSettings.d.ts +2 -1
- package/lib/esm/render/webgl/EdgeSettings.d.ts.map +1 -1
- package/lib/esm/render/webgl/EdgeSettings.js.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.d.ts +1 -0
- package/lib/esm/render/webgl/FeatureOverrides.d.ts.map +1 -1
- package/lib/esm/render/webgl/FeatureOverrides.js +37 -20
- package/lib/esm/render/webgl/FeatureOverrides.js.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.d.ts +40 -10
- package/lib/esm/render/webgl/InstancedGeometry.d.ts.map +1 -1
- package/lib/esm/render/webgl/InstancedGeometry.js +97 -30
- package/lib/esm/render/webgl/InstancedGeometry.js.map +1 -1
- package/lib/esm/render/webgl/LineCode.d.ts.map +1 -1
- package/lib/esm/render/webgl/LineCode.js +2 -14
- package/lib/esm/render/webgl/LineCode.js.map +1 -1
- package/lib/esm/render/webgl/Mesh.d.ts +9 -4
- package/lib/esm/render/webgl/Mesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/Mesh.js +19 -17
- package/lib/esm/render/webgl/Mesh.js.map +1 -1
- package/lib/esm/render/webgl/PointCloud.d.ts +5 -1
- package/lib/esm/render/webgl/PointCloud.d.ts.map +1 -1
- package/lib/esm/render/webgl/PointCloud.js +7 -2
- package/lib/esm/render/webgl/PointCloud.js.map +1 -1
- package/lib/esm/render/webgl/PointString.d.ts +5 -1
- package/lib/esm/render/webgl/PointString.d.ts.map +1 -1
- package/lib/esm/render/webgl/PointString.js +8 -3
- package/lib/esm/render/webgl/PointString.js.map +1 -1
- package/lib/esm/render/webgl/Polyline.d.ts +5 -1
- package/lib/esm/render/webgl/Polyline.d.ts.map +1 -1
- package/lib/esm/render/webgl/Polyline.js +7 -2
- package/lib/esm/render/webgl/Polyline.js.map +1 -1
- package/lib/esm/render/webgl/Primitive.d.ts +1 -3
- package/lib/esm/render/webgl/Primitive.d.ts.map +1 -1
- package/lib/esm/render/webgl/Primitive.js +2 -7
- package/lib/esm/render/webgl/Primitive.js.map +1 -1
- package/lib/esm/render/webgl/RealityMesh.d.ts +5 -1
- package/lib/esm/render/webgl/RealityMesh.d.ts.map +1 -1
- package/lib/esm/render/webgl/RealityMesh.js +6 -0
- package/lib/esm/render/webgl/RealityMesh.js.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.d.ts +0 -18
- package/lib/esm/render/webgl/RenderFlags.d.ts.map +1 -1
- package/lib/esm/render/webgl/RenderFlags.js.map +1 -1
- package/lib/esm/render/webgl/System.d.ts +11 -5
- package/lib/esm/render/webgl/System.d.ts.map +1 -1
- package/lib/esm/render/webgl/System.js +82 -14
- package/lib/esm/render/webgl/System.js.map +1 -1
- package/lib/esm/render/webgl/Target.d.ts +6 -2
- package/lib/esm/render/webgl/Target.d.ts.map +1 -1
- package/lib/esm/render/webgl/Target.js +23 -1
- package/lib/esm/render/webgl/Target.js.map +1 -1
- package/lib/esm/render/webgl/Texture.d.ts +2 -1
- package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
- package/lib/esm/render/webgl/Texture.js.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js +6 -0
- package/lib/esm/render/webgl/glsl/FeatureSymbology.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +27 -7
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +82 -67
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/ImdlGraphicsCreator.d.ts +4 -1
- package/lib/esm/tile/ImdlGraphicsCreator.d.ts.map +1 -1
- package/lib/esm/tile/ImdlGraphicsCreator.js +31 -22
- package/lib/esm/tile/ImdlGraphicsCreator.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +18 -18
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Rendering
|
|
8
|
+
*/
|
|
9
|
+
var _a;
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.collectRenderInstancesParamsTransferables = exports.createRenderInstancesParamsBuilder = void 0;
|
|
12
|
+
const Symbols_1 = require("../../common/internal/Symbols");
|
|
13
|
+
const InstancedGraphicParams_1 = require("../../common/render/InstancedGraphicParams");
|
|
14
|
+
const InstancedGraphicPropsBuilder_1 = require("../../common/internal/render/InstancedGraphicPropsBuilder");
|
|
15
|
+
const core_common_1 = require("@itwin/core-common");
|
|
16
|
+
class Builder {
|
|
17
|
+
constructor(modelId) {
|
|
18
|
+
this[_a] = undefined;
|
|
19
|
+
this._instances = new InstancedGraphicPropsBuilder_1.InstancedGraphicPropsBuilder();
|
|
20
|
+
this._containsFeatures = false;
|
|
21
|
+
this._modelId = modelId;
|
|
22
|
+
}
|
|
23
|
+
add(instance) {
|
|
24
|
+
this._instances.add(instance);
|
|
25
|
+
if (undefined !== instance.feature) {
|
|
26
|
+
this._containsFeatures = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
finish() {
|
|
30
|
+
const numInstances = this._instances.length;
|
|
31
|
+
if (numInstances === 0) {
|
|
32
|
+
throw new Error("No instances defined");
|
|
33
|
+
}
|
|
34
|
+
let featureTable;
|
|
35
|
+
if (this._containsFeatures) {
|
|
36
|
+
featureTable = new core_common_1.FeatureTable(numInstances, this._modelId);
|
|
37
|
+
}
|
|
38
|
+
const instances = this._instances.finish(featureTable);
|
|
39
|
+
const result = {
|
|
40
|
+
[Symbols_1._implementationProhibited]: "renderInstancesParams",
|
|
41
|
+
instances,
|
|
42
|
+
};
|
|
43
|
+
if (featureTable) {
|
|
44
|
+
const packedTable = core_common_1.PackedFeatureTable.pack(featureTable);
|
|
45
|
+
result.features = {
|
|
46
|
+
data: packedTable.data,
|
|
47
|
+
modelId: packedTable.batchModelId,
|
|
48
|
+
count: packedTable.numFeatures,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_a = Symbols_1._implementationProhibited;
|
|
55
|
+
function createRenderInstancesParamsBuilder(args) {
|
|
56
|
+
return new Builder(args.modelId);
|
|
57
|
+
}
|
|
58
|
+
exports.createRenderInstancesParamsBuilder = createRenderInstancesParamsBuilder;
|
|
59
|
+
function collectRenderInstancesParamsTransferables(xfers, inParams) {
|
|
60
|
+
const params = inParams;
|
|
61
|
+
if (params.instances) {
|
|
62
|
+
InstancedGraphicParams_1.InstancedGraphicProps.collectTransferables(xfers, params.instances);
|
|
63
|
+
}
|
|
64
|
+
if (params.features) {
|
|
65
|
+
xfers.add(params.features.data.buffer);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.collectRenderInstancesParamsTransferables = collectRenderInstancesParamsTransferables;
|
|
69
|
+
//# sourceMappingURL=RenderInstancesParamsImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderInstancesParamsImpl.js","sourceRoot":"","sources":["../../../../src/internal/render/RenderInstancesParamsImpl.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;AAGH,2DAA0E;AAC1E,uFAAmF;AAEnF,4GAAyG;AACzG,oDAAsE;AAkBtE,MAAM,OAAO;IAMX,YAAmB,OAAoB;QALvB,QAA2B,GAAG,SAAS,CAAC;QACvC,eAAU,GAAG,IAAI,2DAA4B,EAAE,CAAC;QAEzD,sBAAiB,GAAG,KAAK,CAAC;QAGhC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAEM,GAAG,CAAC,QAAkB;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAE9B,IAAI,SAAS,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;YACnC,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IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AATD,8FASC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { _implementationProhibited } from \"../../common/internal/Symbols\";\r\nimport { InstancedGraphicProps } from \"../../common/render/InstancedGraphicParams\";\r\nimport { CreateRenderInstancesParamsBuilderArgs, Instance, RenderInstancesParams, RenderInstancesParamsBuilder } from \"../../common/render/RenderInstancesParams\";\r\nimport { InstancedGraphicPropsBuilder } from \"../../common/internal/render/InstancedGraphicPropsBuilder\";\r\nimport { FeatureTable, PackedFeatureTable } from \"@itwin/core-common\";\r\n\r\n/** Intermediate representation of `RenderInstances[_batch]`. */\r\nexport interface InstancedFeaturesParams {\r\n modelId: Id64String;\r\n data: Uint32Array;\r\n count: number;\r\n}\r\n\r\n/** This exists so that [[RenderInstancesParams]] can be an opaque type that can be copied between Workers.\r\n * (`Symbol`s are dropped during structured cloning).\r\n */\r\nexport interface RenderInstancesParamsImpl extends RenderInstancesParams {\r\n [_implementationProhibited]: \"renderInstancesParams\";\r\n instances: InstancedGraphicProps;\r\n features?: InstancedFeaturesParams;\r\n}\r\n\r\nclass Builder implements RenderInstancesParamsBuilder {\r\n public readonly [_implementationProhibited] = undefined;\r\n private readonly _instances = new InstancedGraphicPropsBuilder();\r\n private readonly _modelId?: Id64String;\r\n private _containsFeatures = false;\r\n\r\n public constructor(modelId?: Id64String) {\r\n this._modelId = modelId;\r\n }\r\n\r\n public add(instance: Instance): void {\r\n this._instances.add(instance);\r\n\r\n if (undefined !== instance.feature) {\r\n this._containsFeatures = true;\r\n }\r\n }\r\n\r\n public finish(): RenderInstancesParams {\r\n const numInstances = this._instances.length;\r\n if (numInstances === 0) {\r\n throw new Error(\"No instances defined\");\r\n }\r\n\r\n let featureTable;\r\n if (this._containsFeatures) {\r\n featureTable = new FeatureTable(numInstances, this._modelId);\r\n }\r\n\r\n const instances = this._instances.finish(featureTable);\r\n const result: RenderInstancesParamsImpl = {\r\n [_implementationProhibited]: \"renderInstancesParams\",\r\n instances,\r\n };\r\n\r\n if (featureTable) {\r\n const packedTable = PackedFeatureTable.pack(featureTable);\r\n result.features = {\r\n data: packedTable.data,\r\n modelId: packedTable.batchModelId,\r\n count: packedTable.numFeatures,\r\n };\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n\r\nexport function createRenderInstancesParamsBuilder(args: CreateRenderInstancesParamsBuilderArgs): RenderInstancesParamsBuilder {\r\n return new Builder(args.modelId);\r\n}\r\n\r\nexport function collectRenderInstancesParamsTransferables(xfers: Set<Transferable>, inParams: RenderInstancesParams): void {\r\n const params = inParams as RenderInstancesParamsImpl;\r\n if (params.instances) {\r\n InstancedGraphicProps.collectTransferables(xfers, params.instances);\r\n }\r\n\r\n if (params.features) {\r\n xfers.add(params.features.data.buffer);\r\n }\r\n}\r\n"]}
|
|
@@ -9,6 +9,7 @@ import { RenderGraphic } from "./RenderGraphic";
|
|
|
9
9
|
import { GraphicType } from "../common/render/GraphicType";
|
|
10
10
|
import type { PickableGraphicOptions } from "../common/render/BatchOptions";
|
|
11
11
|
import { GraphicAssembler } from "../common/render/GraphicAssembler";
|
|
12
|
+
import { GraphicTemplate } from "./GraphicTemplate";
|
|
12
13
|
/** Options for creating a [[GraphicBuilder]] used by functions like [[DecorateContext.createGraphic]] and [[RenderSystem.createGraphic]].
|
|
13
14
|
* @see [[ViewportGraphicBuilderOptions]] to create a graphic builder for a [[Viewport]].
|
|
14
15
|
* @see [[CustomGraphicBuilderOptions]] to create a graphic builder unassociated with any [[Viewport]].
|
|
@@ -67,7 +68,7 @@ export interface ViewportGraphicBuilderOptions extends GraphicBuilderOptions {
|
|
|
67
68
|
iModel?: never;
|
|
68
69
|
computeChordTolerance?: never;
|
|
69
70
|
}
|
|
70
|
-
/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]]
|
|
71
|
+
/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]] or [[GraphicTemplate]] produced by a [[GraphicBuilder]].
|
|
71
72
|
* Generally, the chord tolerance should be roughly equivalent to the size in meters of one pixel on screen where the graphic is to be displayed.
|
|
72
73
|
* For [[GraphicType.ViewOverlay]] and [[GraphicType.ViewBackground]], which already define their geometry in pixels, the chord tolerance should typically be 1.
|
|
73
74
|
* @see [[CustomGraphicBuilderOptions.computeChordTolerance]].
|
|
@@ -80,7 +81,7 @@ export interface ComputeChordToleranceArgs {
|
|
|
80
81
|
/** A function that computes a range enclosing all of the geometry that was added to the builder. */
|
|
81
82
|
readonly computeRange: () => Range3d;
|
|
82
83
|
}
|
|
83
|
-
/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] that is not associated with any particular [[Viewport]] and may not be associated with
|
|
84
|
+
/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] or [[GraphicTemplate]] that is not associated with any particular [[Viewport]] and may not be associated with
|
|
84
85
|
* any particular [[IModelConnection]].
|
|
85
86
|
* This is primarily useful when the same graphic is to be saved and reused for display in multiple viewports and for which a chord tolerance can be computed
|
|
86
87
|
* independently of each viewport's [Frustum]($common).
|
|
@@ -95,7 +96,7 @@ export interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {
|
|
|
95
96
|
applyAspectRatioSkew?: never;
|
|
96
97
|
viewport?: never;
|
|
97
98
|
}
|
|
98
|
-
/** Provides methods for constructing a [[RenderGraphic]] from geometric primitives and symbology.
|
|
99
|
+
/** Provides methods for constructing a [[RenderGraphic]] or [[GraphicTemplate]] from geometric primitives and symbology.
|
|
99
100
|
* GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].
|
|
100
101
|
*
|
|
101
102
|
* The typical process for constructing a [[RenderGraphic]] proceeds as follows:
|
|
@@ -104,6 +105,12 @@ export interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {
|
|
|
104
105
|
* 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.
|
|
105
106
|
* 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].
|
|
106
107
|
*
|
|
108
|
+
* The process for constructing a [[GraphicTemplate]] is similar:
|
|
109
|
+
* 1. Use [[RenderSystem.createGraphic]] to obtain a builder.
|
|
110
|
+
* 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].
|
|
111
|
+
* 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.
|
|
112
|
+
* 4. Use [[GraphicBuilder.finishTemplate]] to produce the finished [[GraphicTemplate]].
|
|
113
|
+
*
|
|
107
114
|
* @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.
|
|
108
115
|
* So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.
|
|
109
116
|
*
|
|
@@ -125,7 +132,14 @@ export declare abstract class GraphicBuilder extends GraphicAssembler {
|
|
|
125
132
|
/**
|
|
126
133
|
* Processes the accumulated symbology and geometry to produce a renderable graphic.
|
|
127
134
|
* This function can only be called once; after the [[RenderGraphic]] has been extracted the [[GraphicBuilder]] should no longer be used.
|
|
135
|
+
* @see [[finishTemplate]] to obtain a [[GraphicTemplate]] instead.
|
|
128
136
|
*/
|
|
129
137
|
abstract finish(): RenderGraphic;
|
|
138
|
+
/** Processes the accumulated symbology and geometry to produce a reusable template for a [[RenderGraphic]].
|
|
139
|
+
* This function can only be called once; after the [[GraphicTemplate]] has been extracted the [[GraphicBuilder]] should no longer be used.
|
|
140
|
+
* @see [[finish]] to obtain a [[RenderGraphic]] instead.
|
|
141
|
+
* @beta
|
|
142
|
+
*/
|
|
143
|
+
abstract finishTemplate(): GraphicTemplate;
|
|
130
144
|
}
|
|
131
145
|
//# sourceMappingURL=GraphicBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicBuilder.d.ts","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphicBuilder.d.ts","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,gB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,cAAe,SAAQ,gBAAgB;IAC3D,uDAAuD;IACvD,SAAgB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1C,gBAAgB;IAChB,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC,IAAI,EAAE,yBAAyB,KAAK,MAAM,CAAC;IAEvF,gBAAgB;IAChB,SAAS,aAAa,OAAO,EAAE,6BAA6B,GAAG,2BAA2B;IAuC1F;;;OAGG;IACH,IAAW,MAAM,IAAI,UAAU,GAAG,SAAS,CAE1C;IAED;;;;OAIG;aACa,MAAM,IAAI,aAAa;IAEvC;;;;OAIG;aACa,cAAc,IAAI,eAAe;CAClD"}
|
|
@@ -12,7 +12,7 @@ const core_geometry_1 = require("@itwin/core-geometry");
|
|
|
12
12
|
const GraphicType_1 = require("../common/render/GraphicType");
|
|
13
13
|
const GraphicAssembler_1 = require("../common/render/GraphicAssembler");
|
|
14
14
|
const Symbols_1 = require("../common/internal/Symbols");
|
|
15
|
-
/** Provides methods for constructing a [[RenderGraphic]] from geometric primitives and symbology.
|
|
15
|
+
/** Provides methods for constructing a [[RenderGraphic]] or [[GraphicTemplate]] from geometric primitives and symbology.
|
|
16
16
|
* GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].
|
|
17
17
|
*
|
|
18
18
|
* The typical process for constructing a [[RenderGraphic]] proceeds as follows:
|
|
@@ -21,6 +21,12 @@ const Symbols_1 = require("../common/internal/Symbols");
|
|
|
21
21
|
* 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.
|
|
22
22
|
* 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].
|
|
23
23
|
*
|
|
24
|
+
* The process for constructing a [[GraphicTemplate]] is similar:
|
|
25
|
+
* 1. Use [[RenderSystem.createGraphic]] to obtain a builder.
|
|
26
|
+
* 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].
|
|
27
|
+
* 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.
|
|
28
|
+
* 4. Use [[GraphicBuilder.finishTemplate]] to produce the finished [[GraphicTemplate]].
|
|
29
|
+
*
|
|
24
30
|
* @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.
|
|
25
31
|
* So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.
|
|
26
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicBuilder.js","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAmE;AAInE,8DAA2D;AAE3D,wEAAqE;AACrE,wDAAuE;AAqGvE;;;;;;;;;;;;;;GAcG;AACH,MAAsB,cAAe,SAAQ,mCAAgB;IAO3D,gBAAgB;IAChB,YAAsB,OAAoE;QACxF,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,yBAAS,CAAC,cAAc,EAAE,CAAC;QAClE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACzH,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,KAAK,CAAC,CAAC;QAC7F,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,YAAY,IAAI,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,cAAc,CAAC,CAAC;QAEtL,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,CAAC,mCAAyB,CAAC,EAAE,SAAS;YACtC,SAAS;YACT,SAAS;YACT,WAAW;YACX,aAAa;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;YAC5D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,sBAAsB,GAAG,CAAC,IAA+B,EAAE,EAAE;YAChE,IAAI,SAAS,GAAG,CAAC,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC5B,uGAAuG;gBACvG,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC;gBAC7E,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;gBAErE,kIAAkI;gBAClI,MAAM,IAAI,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3F,IAAI,IAAI,GAAG,CAAC;oBACV,SAAS,IAAI,IAAI,CAAC;YACtB,CAAC;YAED,OAAO,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC3B,CAAC;CAOF;AA5DD,wCA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Point3d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { GraphicType } from \"../common/render/GraphicType\";\r\nimport type { PickableGraphicOptions} from \"../common/render/BatchOptions\";\r\nimport { GraphicAssembler } from \"../common/render/GraphicAssembler\";\r\nimport { _implementationProhibited } from \"../common/internal/Symbols\";\r\n\r\n/** Options for creating a [[GraphicBuilder]] used by functions like [[DecorateContext.createGraphic]] and [[RenderSystem.createGraphic]].\r\n * @see [[ViewportGraphicBuilderOptions]] to create a graphic builder for a [[Viewport]].\r\n * @see [[CustomGraphicBuilderOptions]] to create a graphic builder unassociated with any [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBuilderOptions {\r\n /** The type of graphic to produce. */\r\n type: GraphicType;\r\n\r\n /** The local-to-world transform in which the builder's geometry is to be defined - by default, an identity transform. */\r\n placement?: Transform;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n pickable?: PickableGraphicOptions;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * This is useful for overlay and background graphics because they draw without using the depth buffer. For example, to draw an overlay containing a red shape with a white outline,\r\n * you would add the shape to the GraphicBuilder first, followed by the outline, to ensure the outline draws \"in front of\" the shape.\r\n * It defaults to true for overlays and background graphics, and false for other graphic types.\r\n * It is not useful for other types of graphics and imposes a performance penalty due to increased number of draw calls.\r\n * For overlay and background graphics that do not need to draw in any particular order, the performance penalty can be eliminated by setting this to `false`.\r\n */\r\n preserveOrder?: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces. Normals allow 3d geometry to receive lighting; without them the geometry will be unaffected by lighting.\r\n * By default, normals are generated only for graphics of type [[GraphicType.Scene]]; or for any type of graphic if [[GraphicBuilder.wantEdges]] is true, because\r\n * normals are required to prevent z-fighting between surfaces and their edges. This default can be overridden by explicitly specifying `true` or `false`.\r\n * @see [[GraphicType]] for a description of whether and how different types of graphics are affected by lighting.\r\n */\r\n wantNormals?: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * Edges are only displayed if [ViewFlags.renderMode]($common) is not [RenderMode.SmoothShade]($common) or [ViewFlags.visibleEdges]($common) is `true`.\r\n * Since all decoration graphics except [[GraphicType.Scene]] are drawn in smooth shaded mode with no visible edges, by default edges are only produced for scene graphics, and\r\n * - if a [[Viewport]] is supplied with the options - only if [ViewFlags.edgesRequired]($common) is true for the viewport.\r\n * That default can be overridden by explicitly specifying `true` or `false`. This can be useful for non-scene decorations contained in a [[GraphicBranch]] that applies [ViewFlagOverrides]($common)\r\n * that change the edge display settings; or for scene decorations that might be cached for reuse after the viewport's edge settings are changed.\r\n * @note Edges will tend to z-fight with their surfaces unless the graphic is [[pickable]].\r\n */\r\n generateEdges?: boolean;\r\n\r\n /** If defined, specifies a point about which the graphic will rotate such that it always faces the viewer.\r\n * This can be particular useful for planar regions to create a billboarding effect - e.g., to implement [[Marker]]-like WebGL decorations.\r\n * The graphic's [[placement]] transform is not applied to the point.\r\n * @note This has no effect for graphics displayed in a 2d view.\r\n */\r\n viewIndependentOrigin?: Point3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] to be displayed in a specific [[Viewport]].\r\n * The level of detail of the graphic will be computed from the position of its geometry within the viewport's [Frustum]($common).\r\n * Default values for [[GraphicBuilderOptions.wantNormals]] and [[GraphicBuilderOptions.generateEdges]] will be determined by the viewport's [ViewFlags]($common).\r\n * The [[GraphicBuilder.iModel]] will be set to the viewport's [[IModelConnection]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewportGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** The viewport in which the resultant [[RenderGraphic]] is to be drawn. */\r\n viewport: Viewport;\r\n\r\n /** If true, [[ViewState.getAspectRatioSkew]] will be taken into account when computing the level of detail for the produced graphics. */\r\n applyAspectRatioSkew?: boolean;\r\n\r\n iModel?: never;\r\n computeChordTolerance?: never;\r\n}\r\n\r\n/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]]s produced by a [[GraphicBuilder]].\r\n * Generally, the chord tolerance should be roughly equivalent to the size in meters of one pixel on screen where the graphic is to be displayed.\r\n * For [[GraphicType.ViewOverlay]] and [[GraphicType.ViewBackground]], which already define their geometry in pixels, the chord tolerance should typically be 1.\r\n * @see [[CustomGraphicBuilderOptions.computeChordTolerance]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ComputeChordToleranceArgs {\r\n /** The graphic builder being used to produce the graphics. */\r\n readonly graphic: GraphicBuilder;\r\n /** A function that computes a range enclosing all of the geometry that was added to the builder. */\r\n readonly computeRange: () => Range3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] that is not associated with any particular [[Viewport]] and may not be associated with\r\n * any particular [[IModelConnection]].\r\n * This is primarily useful when the same graphic is to be saved and reused for display in multiple viewports and for which a chord tolerance can be computed\r\n * independently of each viewport's [Frustum]($common).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** Optionally, the IModelConnection with which the graphic is associated. */\r\n iModel?: IModelConnection;\r\n /** A function that can compute the level of detail for the graphics produced by the builder. */\r\n computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n applyAspectRatioSkew?: never;\r\n viewport?: never;\r\n}\r\n\r\n/** Provides methods for constructing a [[RenderGraphic]] from geometric primitives and symbology.\r\n * GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].\r\n *\r\n * The typical process for constructing a [[RenderGraphic]] proceeds as follows:\r\n * 1. Use [[DecorateContext.createGraphic]] or [[RenderSystem.createGraphic]] to obtain a builder.\r\n * 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].\r\n * 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.\r\n * 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].\r\n *\r\n * @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.\r\n * So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class GraphicBuilder extends GraphicAssembler {\r\n /** The iModel associated with this builder, if any. */\r\n public readonly iModel?: IModelConnection;\r\n\r\n /** @internal */\r\n protected readonly _computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n /** @internal */\r\n protected constructor(options: ViewportGraphicBuilderOptions | CustomGraphicBuilderOptions) {\r\n const vp = options.viewport;\r\n const placement = options.placement ?? Transform.createIdentity();\r\n const wantEdges = options.generateEdges ?? (options.type === GraphicType.Scene && (!vp || vp.viewFlags.edgesRequired()));\r\n const wantNormals = options.wantNormals ?? (wantEdges || options.type === GraphicType.Scene);\r\n const preserveOrder = options.preserveOrder ?? (options.type === GraphicType.ViewOverlay || options.type === GraphicType.WorldOverlay || options.type === GraphicType.ViewBackground);\r\n\r\n super({\r\n ...options,\r\n [_implementationProhibited]: undefined,\r\n placement,\r\n wantEdges,\r\n wantNormals,\r\n preserveOrder,\r\n });\r\n\r\n this.iModel = vp?.iModel ?? options.iModel;\r\n if (!options.viewport) {\r\n this._computeChordTolerance = options.computeChordTolerance;\r\n return;\r\n }\r\n\r\n this._computeChordTolerance = (args: ComputeChordToleranceArgs) => {\r\n let pixelSize = 1;\r\n if (!this.isViewCoordinates) {\r\n // Compute the horizontal distance in meters between two adjacent pixels at the center of the geometry.\r\n pixelSize = options.viewport.getPixelSizeAtPoint(args.computeRange().center);\r\n pixelSize = options.viewport.target.adjustPixelSizeForLOD(pixelSize);\r\n\r\n // Aspect ratio skew > 1.0 stretches the view in Y. In that case use the smaller vertical pixel distance for our stroke tolerance.\r\n const skew = options.applyAspectRatioSkew ? options.viewport.view.getAspectRatioSkew() : 0;\r\n if (skew > 1)\r\n pixelSize /= skew;\r\n }\r\n\r\n return pixelSize * 0.25;\r\n };\r\n }\r\n\r\n /** The Id to be associated with the graphic for picking.\r\n * @see [[GraphicBuilderOptions.pickable]] for more options.\r\n * @deprecated in 3.x. This provides only the **first** pickable Id for this graphic - you should keep track of the **current** pickable Id yourself.\r\n */\r\n public get pickId(): Id64String | undefined {\r\n return this.pickable?.id;\r\n }\r\n\r\n /**\r\n * Processes the accumulated symbology and geometry to produce a renderable graphic.\r\n * This function can only be called once; after the [[RenderGraphic]] has been extracted the [[GraphicBuilder]] should no longer be used.\r\n */\r\n public abstract finish(): RenderGraphic;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"GraphicBuilder.js","sourceRoot":"","sources":["../../../src/render/GraphicBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAmE;AAInE,8DAA2D;AAE3D,wEAAqE;AACrE,wDAAuE;AAsGvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAsB,cAAe,SAAQ,mCAAgB;IAO3D,gBAAgB;IAChB,YAAsB,OAAoE;QACxF,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC5B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,yBAAS,CAAC,cAAc,EAAE,CAAC;QAClE,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACzH,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,yBAAW,CAAC,KAAK,CAAC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AGG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC3B,CAAC;CAeF;AApED,wCAoEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Point3d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { RenderGraphic } from \"./RenderGraphic\";\r\nimport { GraphicType } from \"../common/render/GraphicType\";\r\nimport type { PickableGraphicOptions} from \"../common/render/BatchOptions\";\r\nimport { GraphicAssembler } from \"../common/render/GraphicAssembler\";\r\nimport { _implementationProhibited } from \"../common/internal/Symbols\";\r\nimport { GraphicTemplate } from \"./GraphicTemplate\";\r\n\r\n/** Options for creating a [[GraphicBuilder]] used by functions like [[DecorateContext.createGraphic]] and [[RenderSystem.createGraphic]].\r\n * @see [[ViewportGraphicBuilderOptions]] to create a graphic builder for a [[Viewport]].\r\n * @see [[CustomGraphicBuilderOptions]] to create a graphic builder unassociated with any [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface GraphicBuilderOptions {\r\n /** The type of graphic to produce. */\r\n type: GraphicType;\r\n\r\n /** The local-to-world transform in which the builder's geometry is to be defined - by default, an identity transform. */\r\n placement?: Transform;\r\n\r\n /** If the graphic is to be pickable, specifies the pickable Id and other options. */\r\n pickable?: PickableGraphicOptions;\r\n\r\n /** If true, the order in which geometry is added to the builder is preserved.\r\n * This is useful for overlay and background graphics because they draw without using the depth buffer. For example, to draw an overlay containing a red shape with a white outline,\r\n * you would add the shape to the GraphicBuilder first, followed by the outline, to ensure the outline draws \"in front of\" the shape.\r\n * It defaults to true for overlays and background graphics, and false for other graphic types.\r\n * It is not useful for other types of graphics and imposes a performance penalty due to increased number of draw calls.\r\n * For overlay and background graphics that do not need to draw in any particular order, the performance penalty can be eliminated by setting this to `false`.\r\n */\r\n preserveOrder?: boolean;\r\n\r\n /** Controls whether normals are generated for surfaces. Normals allow 3d geometry to receive lighting; without them the geometry will be unaffected by lighting.\r\n * By default, normals are generated only for graphics of type [[GraphicType.Scene]]; or for any type of graphic if [[GraphicBuilder.wantEdges]] is true, because\r\n * normals are required to prevent z-fighting between surfaces and their edges. This default can be overridden by explicitly specifying `true` or `false`.\r\n * @see [[GraphicType]] for a description of whether and how different types of graphics are affected by lighting.\r\n */\r\n wantNormals?: boolean;\r\n\r\n /** Controls whether edges are generated for surfaces.\r\n * Edges are only displayed if [ViewFlags.renderMode]($common) is not [RenderMode.SmoothShade]($common) or [ViewFlags.visibleEdges]($common) is `true`.\r\n * Since all decoration graphics except [[GraphicType.Scene]] are drawn in smooth shaded mode with no visible edges, by default edges are only produced for scene graphics, and\r\n * - if a [[Viewport]] is supplied with the options - only if [ViewFlags.edgesRequired]($common) is true for the viewport.\r\n * That default can be overridden by explicitly specifying `true` or `false`. This can be useful for non-scene decorations contained in a [[GraphicBranch]] that applies [ViewFlagOverrides]($common)\r\n * that change the edge display settings; or for scene decorations that might be cached for reuse after the viewport's edge settings are changed.\r\n * @note Edges will tend to z-fight with their surfaces unless the graphic is [[pickable]].\r\n */\r\n generateEdges?: boolean;\r\n\r\n /** If defined, specifies a point about which the graphic will rotate such that it always faces the viewer.\r\n * This can be particular useful for planar regions to create a billboarding effect - e.g., to implement [[Marker]]-like WebGL decorations.\r\n * The graphic's [[placement]] transform is not applied to the point.\r\n * @note This has no effect for graphics displayed in a 2d view.\r\n */\r\n viewIndependentOrigin?: Point3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] to be displayed in a specific [[Viewport]].\r\n * The level of detail of the graphic will be computed from the position of its geometry within the viewport's [Frustum]($common).\r\n * Default values for [[GraphicBuilderOptions.wantNormals]] and [[GraphicBuilderOptions.generateEdges]] will be determined by the viewport's [ViewFlags]($common).\r\n * The [[GraphicBuilder.iModel]] will be set to the viewport's [[IModelConnection]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ViewportGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** The viewport in which the resultant [[RenderGraphic]] is to be drawn. */\r\n viewport: Viewport;\r\n\r\n /** If true, [[ViewState.getAspectRatioSkew]] will be taken into account when computing the level of detail for the produced graphics. */\r\n applyAspectRatioSkew?: boolean;\r\n\r\n iModel?: never;\r\n computeChordTolerance?: never;\r\n}\r\n\r\n/** Arguments used to compute the chord tolerance (level of detail) of the [[RenderGraphic]] or [[GraphicTemplate]] produced by a [[GraphicBuilder]].\r\n * Generally, the chord tolerance should be roughly equivalent to the size in meters of one pixel on screen where the graphic is to be displayed.\r\n * For [[GraphicType.ViewOverlay]] and [[GraphicType.ViewBackground]], which already define their geometry in pixels, the chord tolerance should typically be 1.\r\n * @see [[CustomGraphicBuilderOptions.computeChordTolerance]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface ComputeChordToleranceArgs {\r\n /** The graphic builder being used to produce the graphics. */\r\n readonly graphic: GraphicBuilder;\r\n /** A function that computes a range enclosing all of the geometry that was added to the builder. */\r\n readonly computeRange: () => Range3d;\r\n}\r\n\r\n/** Options for creating a [[GraphicBuilder]] to produce a [[RenderGraphic]] or [[GraphicTemplate]] that is not associated with any particular [[Viewport]] and may not be associated with\r\n * any particular [[IModelConnection]].\r\n * This is primarily useful when the same graphic is to be saved and reused for display in multiple viewports and for which a chord tolerance can be computed\r\n * independently of each viewport's [Frustum]($common).\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CustomGraphicBuilderOptions extends GraphicBuilderOptions {\r\n /** Optionally, the IModelConnection with which the graphic is associated. */\r\n iModel?: IModelConnection;\r\n /** A function that can compute the level of detail for the graphics produced by the builder. */\r\n computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n applyAspectRatioSkew?: never;\r\n viewport?: never;\r\n}\r\n\r\n/** Provides methods for constructing a [[RenderGraphic]] or [[GraphicTemplate]] from geometric primitives and symbology.\r\n * GraphicBuilder is primarily used for creating [[Decorations]] to be displayed inside a [[Viewport]].\r\n *\r\n * The typical process for constructing a [[RenderGraphic]] proceeds as follows:\r\n * 1. Use [[DecorateContext.createGraphic]] or [[RenderSystem.createGraphic]] to obtain a builder.\r\n * 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].\r\n * 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.\r\n * 4. Use [[GraphicBuilder.finish]] to produce the finished [[RenderGraphic]].\r\n *\r\n * The process for constructing a [[GraphicTemplate]] is similar:\r\n * 1. Use [[RenderSystem.createGraphic]] to obtain a builder.\r\n * 2. Set up the symbology using [[GraphicBuilder.activateGraphicParams]] or [[GraphicBuilder.setSymbology]].\r\n * 3. Add one or more geometric primitives using methods like [[GraphicBuilder.addShape]] and [[GraphicBuilder.addLineString]], possibly setting new symbology in between.\r\n * 4. Use [[GraphicBuilder.finishTemplate]] to produce the finished [[GraphicTemplate]].\r\n *\r\n * @note Most of the methods which add geometry to the builder take ownership of their inputs rather than cloning them.\r\n * So, for example, if you pass an array of points to addLineString(), you should not subsequently modify that array.\r\n *\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class GraphicBuilder extends GraphicAssembler {\r\n /** The iModel associated with this builder, if any. */\r\n public readonly iModel?: IModelConnection;\r\n\r\n /** @internal */\r\n protected readonly _computeChordTolerance: (args: ComputeChordToleranceArgs) => number;\r\n\r\n /** @internal */\r\n protected constructor(options: ViewportGraphicBuilderOptions | CustomGraphicBuilderOptions) {\r\n const vp = options.viewport;\r\n const placement = options.placement ?? Transform.createIdentity();\r\n const wantEdges = options.generateEdges ?? (options.type === GraphicType.Scene && (!vp || vp.viewFlags.edgesRequired()));\r\n const wantNormals = options.wantNormals ?? (wantEdges || options.type === GraphicType.Scene);\r\n const preserveOrder = options.preserveOrder ?? (options.type === GraphicType.ViewOverlay || options.type === GraphicType.WorldOverlay || options.type === GraphicType.ViewBackground);\r\n\r\n super({\r\n ...options,\r\n [_implementationProhibited]: undefined,\r\n placement,\r\n wantEdges,\r\n wantNormals,\r\n preserveOrder,\r\n });\r\n\r\n this.iModel = vp?.iModel ?? options.iModel;\r\n if (!options.viewport) {\r\n this._computeChordTolerance = options.computeChordTolerance;\r\n return;\r\n }\r\n\r\n this._computeChordTolerance = (args: ComputeChordToleranceArgs) => {\r\n let pixelSize = 1;\r\n if (!this.isViewCoordinates) {\r\n // Compute the horizontal distance in meters between two adjacent pixels at the center of the geometry.\r\n pixelSize = options.viewport.getPixelSizeAtPoint(args.computeRange().center);\r\n pixelSize = options.viewport.target.adjustPixelSizeForLOD(pixelSize);\r\n\r\n // Aspect ratio skew > 1.0 stretches the view in Y. In that case use the smaller vertical pixel distance for our stroke tolerance.\r\n const skew = options.applyAspectRatioSkew ? options.viewport.view.getAspectRatioSkew() : 0;\r\n if (skew > 1)\r\n pixelSize /= skew;\r\n }\r\n\r\n return pixelSize * 0.25;\r\n };\r\n }\r\n\r\n /** The Id to be associated with the graphic for picking.\r\n * @see [[GraphicBuilderOptions.pickable]] for more options.\r\n * @deprecated in 3.x. This provides only the **first** pickable Id for this graphic - you should keep track of the **current** pickable Id yourself.\r\n */\r\n public get pickId(): Id64String | undefined {\r\n return this.pickable?.id;\r\n }\r\n\r\n /**\r\n * Processes the accumulated symbology and geometry to produce a renderable graphic.\r\n * This function can only be called once; after the [[RenderGraphic]] has been extracted the [[GraphicBuilder]] should no longer be used.\r\n * @see [[finishTemplate]] to obtain a [[GraphicTemplate]] instead.\r\n */\r\n public abstract finish(): RenderGraphic;\r\n\r\n /** Processes the accumulated symbology and geometry to produce a reusable template for a [[RenderGraphic]].\r\n * This function can only be called once; after the [[GraphicTemplate]] has been extracted the [[GraphicBuilder]] should no longer be used.\r\n * @see [[finish]] to obtain a [[RenderGraphic]] instead.\r\n * @beta\r\n */\r\n public abstract finishTemplate(): GraphicTemplate;\r\n}\r\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Rendering
|
|
3
|
+
*/
|
|
4
|
+
import { Range3d, Transform } from "@itwin/core-geometry";
|
|
5
|
+
import { _batch, _branch, _implementationProhibited, _nodes } from "../common/internal/Symbols";
|
|
6
|
+
import { RenderGeometry } from "../internal/render/RenderGeometry";
|
|
7
|
+
import { RenderFeatureTable, ViewFlagOverrides } from "@itwin/core-common";
|
|
8
|
+
import { InstancedGraphicParams } from "../common/render/InstancedGraphicParams";
|
|
9
|
+
import { BatchOptions } from "../common/render/BatchOptions";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export interface GraphicTemplateNode {
|
|
12
|
+
geometry: RenderGeometry[];
|
|
13
|
+
/** For glTF models, the flattened transform of the scene graph node. */
|
|
14
|
+
transform?: Transform;
|
|
15
|
+
/** For glTF models, the instances associated with the scene graph node, or with the model as a whole. */
|
|
16
|
+
instances?: InstancedGraphicParams;
|
|
17
|
+
}
|
|
18
|
+
/** Describes the collection of $[Feature]($common)s in a [[GraphicTemplate]].
|
|
19
|
+
* If the template is used for instancing, the batch information in the [[RenderInstances]] overrides this.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export interface GraphicTemplateBatch {
|
|
23
|
+
readonly featureTable: RenderFeatureTable;
|
|
24
|
+
readonly options?: BatchOptions;
|
|
25
|
+
readonly range: Range3d;
|
|
26
|
+
}
|
|
27
|
+
/** Applies a transform and/or view flag overrides to all of the nodes in a [[GraphicTemplate]].
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export interface GraphicTemplateBranch {
|
|
31
|
+
readonly transform?: Transform;
|
|
32
|
+
readonly viewFlagOverrides?: ViewFlagOverrides;
|
|
33
|
+
}
|
|
34
|
+
/** A reusable representation of a [[RenderGraphic]].
|
|
35
|
+
* You can use [[RenderSystem.createGraphicFromTemplate]] to produce a [[RenderGraphic]] from a template.
|
|
36
|
+
* The template contains all of the WebGL resources required to render the graphics, so no matter how many times you use the template,
|
|
37
|
+
* no additional GPU resources will be allocated.
|
|
38
|
+
* The primary use for a template is [instanced rendering](https://webglfundamentals.org/webgl/lessons/webgl-instanced-drawing.html) - efficiently
|
|
39
|
+
* drawing many repetitions of the same graphic with different positions, scales, rotations, and symbology.
|
|
40
|
+
* Using instancing to draw 1 template N times is far more efficient than drawing N [[RenderGraphic]]s created from the same template.
|
|
41
|
+
* You can instance a template by supplying a [[RenderInstances]] to [[RenderSystem.createGraphicFromTemplate]], unless [[isInstanceable]] is `false`.
|
|
42
|
+
* @see [[GraphicBuilder.finishTemplate]] to create a template from a [[GraphicBuilder]].
|
|
43
|
+
* @see [[RenderSystem.createTemplateFromDescription]] to create a template from a [[GraphicDescription]].
|
|
44
|
+
* @see [[readGltfTemplate]] to create a template from a glTF model.
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface GraphicTemplate {
|
|
48
|
+
/** @internal */
|
|
49
|
+
readonly [_implementationProhibited]: unknown;
|
|
50
|
+
/** Whether the graphics in this template can be instanced. Non-instanceable graphics include those produced from glTF models that already
|
|
51
|
+
* contain instanced geometry and view-independent geometry created from a [[GraphicBuilder]].
|
|
52
|
+
* [[RenderSystem.createGraphicFromTemplate]] will throw an error if you attempt to instance a non-instanceable template by supplying
|
|
53
|
+
* [[CreateGraphicFromTemplateArgs.instances]].
|
|
54
|
+
*/
|
|
55
|
+
readonly isInstanceable: boolean;
|
|
56
|
+
/** @internal */
|
|
57
|
+
readonly [_nodes]: GraphicTemplateNode[];
|
|
58
|
+
/** @internal */
|
|
59
|
+
readonly [_batch]?: GraphicTemplateBatch;
|
|
60
|
+
/** @internal */
|
|
61
|
+
readonly [_branch]?: GraphicTemplateBranch;
|
|
62
|
+
}
|
|
63
|
+
/** Create a GraphicTemplate.
|
|
64
|
+
* If the caller specifies `noDispose` as `true`, every RenderGeometry in every node will be marked `noDispose`;
|
|
65
|
+
* this permits the same template to be reused by multiple graphics. The garbage collector will reclaim its
|
|
66
|
+
* WebGL resources and its `dispose` method will do nothing.
|
|
67
|
+
* The `isInstancable` flag will be calculated from the nodes and their geometry.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export declare function createGraphicTemplate(args: {
|
|
71
|
+
nodes: GraphicTemplateNode[];
|
|
72
|
+
batch?: GraphicTemplateBatch;
|
|
73
|
+
noDispose: boolean;
|
|
74
|
+
branch?: GraphicTemplateBranch;
|
|
75
|
+
}): GraphicTemplate;
|
|
76
|
+
//# sourceMappingURL=GraphicTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicTemplate.d.ts","sourceRoot":"","sources":["../../../src/render/GraphicTemplate.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,gBAAgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,yGAAyG;IACzG,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CAChD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB;IAChB,QAAQ,CAAC,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAE9C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC,gBAAgB;IAChB,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACzC,gBAAgB;IAChB,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,oBAAoB,CAAC;IACzC,gBAAgB;IAChB,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,qBAAqB,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC,GAAG,eAAe,CAsBlB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Rendering
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createGraphicTemplate = void 0;
|
|
11
|
+
const Symbols_1 = require("../common/internal/Symbols");
|
|
12
|
+
/** Create a GraphicTemplate.
|
|
13
|
+
* If the caller specifies `noDispose` as `true`, every RenderGeometry in every node will be marked `noDispose`;
|
|
14
|
+
* this permits the same template to be reused by multiple graphics. The garbage collector will reclaim its
|
|
15
|
+
* WebGL resources and its `dispose` method will do nothing.
|
|
16
|
+
* The `isInstancable` flag will be calculated from the nodes and their geometry.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function createGraphicTemplate(args) {
|
|
20
|
+
let isInstanceable = true;
|
|
21
|
+
for (const node of args.nodes) {
|
|
22
|
+
if (node.instances) {
|
|
23
|
+
isInstanceable = false;
|
|
24
|
+
}
|
|
25
|
+
for (const geometry of node.geometry) {
|
|
26
|
+
geometry.noDispose = args.noDispose;
|
|
27
|
+
if (!geometry.isInstanceable) {
|
|
28
|
+
isInstanceable = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
[Symbols_1._implementationProhibited]: undefined,
|
|
34
|
+
isInstanceable,
|
|
35
|
+
[Symbols_1._nodes]: args.nodes,
|
|
36
|
+
[Symbols_1._batch]: args.batch,
|
|
37
|
+
[Symbols_1._branch]: args.branch,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
exports.createGraphicTemplate = createGraphicTemplate;
|
|
41
|
+
//# sourceMappingURL=GraphicTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphicTemplate.js","sourceRoot":"","sources":["../../../src/render/GraphicTemplate.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAgG;AAiEhG;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,IAKrC;IACC,IAAI,cAAc,GAAG,IAAI,CAAC;IAC1B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,cAAc,GAAG,KAAK,CAAC;QACzB,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACrC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;gBAC7B,cAAc,GAAG,KAAK,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,CAAC,mCAAyB,CAAC,EAAE,SAAS;QACtC,cAAc;QACd,CAAC,gBAAM,CAAC,EAAE,IAAI,CAAC,KAAK;QACpB,CAAC,gBAAM,CAAC,EAAE,IAAI,CAAC,KAAK;QACpB,CAAC,iBAAO,CAAC,EAAE,IAAI,CAAC,MAAM;KACvB,CAAC;AACJ,CAAC;AA3BD,sDA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Rendering\r\n */\r\n\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { _batch, _branch, _implementationProhibited, _nodes } from \"../common/internal/Symbols\";\r\nimport { RenderGeometry } from \"../internal/render/RenderGeometry\";\r\nimport { RenderFeatureTable, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { InstancedGraphicParams } from \"../common/render/InstancedGraphicParams\";\r\nimport { BatchOptions } from \"../common/render/BatchOptions\";\r\n\r\n/** @internal */\r\nexport interface GraphicTemplateNode {\r\n geometry: RenderGeometry[];\r\n /** For glTF models, the flattened transform of the scene graph node. */\r\n transform?: Transform;\r\n /** For glTF models, the instances associated with the scene graph node, or with the model as a whole. */\r\n instances?: InstancedGraphicParams;\r\n}\r\n\r\n/** Describes the collection of $[Feature]($common)s in a [[GraphicTemplate]].\r\n * If the template is used for instancing, the batch information in the [[RenderInstances]] overrides this.\r\n * @internal\r\n */\r\nexport interface GraphicTemplateBatch {\r\n readonly featureTable: RenderFeatureTable;\r\n readonly options?: BatchOptions;\r\n readonly range: Range3d;\r\n}\r\n\r\n/** Applies a transform and/or view flag overrides to all of the nodes in a [[GraphicTemplate]].\r\n * @internal\r\n */\r\nexport interface GraphicTemplateBranch {\r\n readonly transform?: Transform;\r\n readonly viewFlagOverrides?: ViewFlagOverrides;\r\n}\r\n\r\n/** A reusable representation of a [[RenderGraphic]].\r\n * You can use [[RenderSystem.createGraphicFromTemplate]] to produce a [[RenderGraphic]] from a template.\r\n * The template contains all of the WebGL resources required to render the graphics, so no matter how many times you use the template,\r\n * no additional GPU resources will be allocated.\r\n * The primary use for a template is [instanced rendering](https://webglfundamentals.org/webgl/lessons/webgl-instanced-drawing.html) - efficiently\r\n * drawing many repetitions of the same graphic with different positions, scales, rotations, and symbology.\r\n * Using instancing to draw 1 template N times is far more efficient than drawing N [[RenderGraphic]]s created from the same template.\r\n * You can instance a template by supplying a [[RenderInstances]] to [[RenderSystem.createGraphicFromTemplate]], unless [[isInstanceable]] is `false`.\r\n * @see [[GraphicBuilder.finishTemplate]] to create a template from a [[GraphicBuilder]].\r\n * @see [[RenderSystem.createTemplateFromDescription]] to create a template from a [[GraphicDescription]].\r\n * @see [[readGltfTemplate]] to create a template from a glTF model.\r\n * @beta\r\n */\r\nexport interface GraphicTemplate {\r\n /** @internal */\r\n readonly [_implementationProhibited]: unknown;\r\n\r\n /** Whether the graphics in this template can be instanced. Non-instanceable graphics include those produced from glTF models that already\r\n * contain instanced geometry and view-independent geometry created from a [[GraphicBuilder]].\r\n * [[RenderSystem.createGraphicFromTemplate]] will throw an error if you attempt to instance a non-instanceable template by supplying\r\n * [[CreateGraphicFromTemplateArgs.instances]].\r\n */\r\n readonly isInstanceable: boolean;\r\n\r\n /** @internal */\r\n readonly [_nodes]: GraphicTemplateNode[];\r\n /** @internal */\r\n readonly [_batch]?: GraphicTemplateBatch;\r\n /** @internal */\r\n readonly [_branch]?: GraphicTemplateBranch;\r\n}\r\n\r\n/** Create a GraphicTemplate.\r\n * If the caller specifies `noDispose` as `true`, every RenderGeometry in every node will be marked `noDispose`;\r\n * this permits the same template to be reused by multiple graphics. The garbage collector will reclaim its\r\n * WebGL resources and its `dispose` method will do nothing.\r\n * The `isInstancable` flag will be calculated from the nodes and their geometry.\r\n * @internal\r\n */\r\nexport function createGraphicTemplate(args: {\r\n nodes: GraphicTemplateNode[];\r\n batch?: GraphicTemplateBatch;\r\n noDispose: boolean;\r\n branch?: GraphicTemplateBranch;\r\n}): GraphicTemplate {\r\n let isInstanceable = true;\r\n for (const node of args.nodes) {\r\n if (node.instances) {\r\n isInstanceable = false;\r\n }\r\n\r\n for (const geometry of node.geometry) {\r\n geometry.noDispose = args.noDispose;\r\n if (!geometry.isInstanceable) {\r\n isInstanceable = false;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n [_implementationProhibited]: undefined,\r\n isInstanceable,\r\n [_nodes]: args.nodes,\r\n [_batch]: args.batch,\r\n [_branch]: args.branch,\r\n };\r\n}\r\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transform } from "@itwin/core-geometry";
|
|
1
|
+
import { Range3d, Transform } from "@itwin/core-geometry";
|
|
2
2
|
import { ElementAlignedBox3d, RenderFeatureTable } from "@itwin/core-common";
|
|
3
3
|
import { IModelAppOptions } from "../IModelApp";
|
|
4
4
|
import { IModelConnection } from "../IModelConnection";
|
|
@@ -15,10 +15,11 @@ import { PointCloudArgs } from "../common/internal/render/PointCloudPrimitive";
|
|
|
15
15
|
import { GraphicList, RenderGraphic } from "./RenderGraphic";
|
|
16
16
|
import { RenderMemory } from "./RenderMemory";
|
|
17
17
|
import { RenderPlan } from "./RenderPlan";
|
|
18
|
-
import { RenderAreaPattern,
|
|
18
|
+
import { RenderAreaPattern, RenderSystem } from "./RenderSystem";
|
|
19
19
|
import { RenderTarget } from "./RenderTarget";
|
|
20
20
|
import { Scene } from "./Scene";
|
|
21
21
|
import { _implementationProhibited } from "../common/internal/Symbols";
|
|
22
|
+
import { RenderGeometry } from "../internal/render/RenderGeometry";
|
|
22
23
|
/** Contains extensible mock implementations of the various components of a RenderSystem, intended for use in tests.
|
|
23
24
|
* Use these for tests instead of the default RenderSystem wherever possible because:
|
|
24
25
|
* (1) Electron has a bug on Windows in which it fails to obtain a WebGLRenderingContext when running inside a VM (e.g., during CI job); and
|
|
@@ -96,11 +97,18 @@ export declare namespace MockRender {
|
|
|
96
97
|
}
|
|
97
98
|
/** @internal */
|
|
98
99
|
class Geometry implements RenderGeometry {
|
|
100
|
+
readonly renderGeometryType: "mesh" | "polyline" | "point-string";
|
|
101
|
+
noDispose: boolean;
|
|
102
|
+
readonly isInstanceable = true;
|
|
103
|
+
isDisposed: boolean;
|
|
104
|
+
constructor(renderGeometryType: "mesh" | "polyline" | "point-string");
|
|
99
105
|
dispose(): void;
|
|
100
106
|
collectStatistics(): void;
|
|
107
|
+
computeRange(): Range3d;
|
|
101
108
|
}
|
|
102
109
|
/** @internal */
|
|
103
110
|
class AreaPattern implements RenderAreaPattern {
|
|
111
|
+
readonly [_implementationProhibited] = "renderAreaPattern";
|
|
104
112
|
dispose(): void;
|
|
105
113
|
collectStatistics(): void;
|
|
106
114
|
}
|
|
@@ -136,6 +144,8 @@ export declare namespace MockRender {
|
|
|
136
144
|
createPointStringGeometry(): Geometry;
|
|
137
145
|
/** @internal */
|
|
138
146
|
createAreaPattern(): AreaPattern;
|
|
147
|
+
/** @internal */
|
|
148
|
+
createGraphicFromTemplate(): Graphic;
|
|
139
149
|
}
|
|
140
150
|
type SystemFactory = () => RenderSystem;
|
|
141
151
|
/** An implementation of IModelApp which uses a MockRender.System by default. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockRender.d.ts","sourceRoot":"","sources":["../../../src/render/MockRender.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,SAAS,EAA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;eAE/D,OAAO,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;eAO/C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;QAK7C,SAAS,CAAC,MAAM,CAAC,yBAAyB;KAC3C;CACF"}
|
|
@@ -9,6 +9,7 @@ exports.MockRender = void 0;
|
|
|
9
9
|
* @module Utils
|
|
10
10
|
*/
|
|
11
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const core_geometry_1 = require("@itwin/core-geometry");
|
|
12
13
|
const core_common_1 = require("@itwin/core-common");
|
|
13
14
|
const IModelApp_1 = require("../IModelApp");
|
|
14
15
|
const ViewRect_1 = require("../common/ViewRect");
|
|
@@ -31,7 +32,7 @@ const Symbols_1 = require("../common/internal/Symbols");
|
|
|
31
32
|
*/
|
|
32
33
|
var MockRender;
|
|
33
34
|
(function (MockRender) {
|
|
34
|
-
var _a;
|
|
35
|
+
var _a, _b;
|
|
35
36
|
/** @internal */
|
|
36
37
|
class Target extends RenderTarget_1.RenderTarget {
|
|
37
38
|
constructor(_system) {
|
|
@@ -125,15 +126,26 @@ var MockRender;
|
|
|
125
126
|
MockRender.Batch = Batch;
|
|
126
127
|
/** @internal */
|
|
127
128
|
class Geometry {
|
|
128
|
-
|
|
129
|
+
constructor(renderGeometryType) {
|
|
130
|
+
this.renderGeometryType = renderGeometryType;
|
|
131
|
+
this.noDispose = false;
|
|
132
|
+
this.isInstanceable = true;
|
|
133
|
+
this.isDisposed = false;
|
|
134
|
+
}
|
|
135
|
+
dispose() { this.isDisposed = true; }
|
|
129
136
|
collectStatistics() { }
|
|
137
|
+
computeRange() { return new core_geometry_1.Range3d(); }
|
|
130
138
|
}
|
|
131
139
|
MockRender.Geometry = Geometry;
|
|
132
140
|
/** @internal */
|
|
133
141
|
class AreaPattern {
|
|
142
|
+
constructor() {
|
|
143
|
+
this[_b] = "renderAreaPattern";
|
|
144
|
+
}
|
|
134
145
|
dispose() { }
|
|
135
146
|
collectStatistics() { }
|
|
136
147
|
}
|
|
148
|
+
_b = Symbols_1._implementationProhibited;
|
|
137
149
|
MockRender.AreaPattern = AreaPattern;
|
|
138
150
|
class System extends RenderSystem_1.RenderSystem {
|
|
139
151
|
get isValid() { return true; }
|
|
@@ -162,13 +174,15 @@ var MockRender;
|
|
|
162
174
|
createPointCloud(_args, _imodel) { return new Graphic(); }
|
|
163
175
|
createRenderGraphic() { return new Graphic(); }
|
|
164
176
|
/** @internal */
|
|
165
|
-
createMeshGeometry() { return new Geometry(); }
|
|
177
|
+
createMeshGeometry() { return new Geometry("mesh"); }
|
|
166
178
|
/** @internal */
|
|
167
|
-
createPolylineGeometry() { return new Geometry(); }
|
|
179
|
+
createPolylineGeometry() { return new Geometry("polyline"); }
|
|
168
180
|
/** @internal */
|
|
169
|
-
createPointStringGeometry() { return new Geometry(); }
|
|
181
|
+
createPointStringGeometry() { return new Geometry("point-string"); }
|
|
170
182
|
/** @internal */
|
|
171
183
|
createAreaPattern() { return new AreaPattern(); }
|
|
184
|
+
/** @internal */
|
|
185
|
+
createGraphicFromTemplate() { return new Graphic(); }
|
|
172
186
|
}
|
|
173
187
|
MockRender.System = System;
|
|
174
188
|
/** An implementation of IModelApp which uses a MockRender.System by default. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockRender.js","sourceRoot":"","sources":["../../../src/render/MockRender.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA8C;AAE9C,oDAAgG;AAChG,4CAA2D;AAK3D,iDAA8C;AAK9C,0EAAuE;AAEvE,mDAA6D;AAG7D,iDAAiF;AACjF,iDAA8C;AAE9C,wDAAuE;AAEvE;;;;;;;;;;;GAWG;AACH,IAAiB,UAAU,CAyJ1B;AAzJD,WAAiB,UAAU;;IACzB,gBAAgB;IAChB,MAAsB,MAAO,SAAQ,2BAAY;QAG/C,YAAuC,OAAqB;YAAI,KAAK,EAAE,CAAC;YAAjC,YAAO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,CAAC,KAAK,CAAC,OAAO,CAAC,IAAuB;YACjD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,+BAAiB,EAAE,CAAC;YACjE,MAAM,qBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAEM,MAAM,CAAC,KAAK,CAAC,QAAQ;YAC1B,IAAI,CAAC,aAAa,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;YAC3D,MAAM,qBAAS,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC;QAES,MAAM,CAAC,yBAAyB,KAAK,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;;IAdvD,iBAAa,GAAkB,GAAG,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;IADxE,cAAG,MAgBf,CAAA;AACH,CAAC,EAzJgB,UAAU,0BAAV,UAAU,QAyJ1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { dispose } from \"@itwin/core-bentley\";\r\nimport { Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, EmptyLocalization, RenderFeatureTable } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelAppOptions } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { MeshParams } from \"../common/internal/render/MeshParams\";\r\nimport { PointStringParams } from \"../common/internal/render/PointStringParams\";\r\nimport { PolylineParams } from \"../common/internal/render/PolylineParams\";\r\nimport { ViewRect } from \"../common/ViewRect\";\r\nimport { Decorations } from \"./Decorations\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./GraphicBranch\";\r\nimport { CustomGraphicBuilderOptions, GraphicBuilder, ViewportGraphicBuilderOptions } from \"./GraphicBuilder\";\r\nimport { Pixel } from \"./Pixel\";\r\nimport { PrimitiveBuilder } from \"../internal/render/PrimitiveBuilder\";\r\nimport { PointCloudArgs } from \"../common/internal/render/PointCloudPrimitive\";\r\nimport { GraphicList, RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlan } from \"./RenderPlan\";\r\nimport { RenderAreaPattern, RenderGeometry, RenderSystem } from \"./RenderSystem\";\r\nimport { RenderTarget } from \"./RenderTarget\";\r\nimport { Scene } from \"./Scene\";\r\nimport { _implementationProhibited } from \"../common/internal/Symbols\";\r\n\r\n/** Contains extensible mock implementations of the various components of a RenderSystem, intended for use in tests.\r\n * Use these for tests instead of the default RenderSystem wherever possible because:\r\n * (1) Electron has a bug on Windows in which it fails to obtain a WebGLRenderingContext when running inside a VM (e.g., during CI job); and\r\n * (2) To decouple the logic which uses aspects of the RenderSystem from the full implementation.\r\n * Any and all of these types can be extended for the purposes of specific tests.\r\n * To use this:\r\n * (1) If overriding anything in the implementation supplied herein, pass a SystemFactory function to MockRender.App.systemFactory.\r\n * (2) Call MockRender.App.startup() instead of IModelApp.startup() before tests begin.\r\n * (3) Likewise call MockRender.App.shutdown() when finished. This resets the SystemFactory to its default.\r\n * @note The APIs within this namespace are intended *strictly* for use with unit tests.\r\n * @internal\r\n */\r\nexport namespace MockRender {\r\n /** @internal */\r\n export abstract class Target extends RenderTarget {\r\n protected override readonly [_implementationProhibited] = undefined;\r\n\r\n protected constructor(private readonly _system: RenderSystem) { super(); }\r\n\r\n public get renderSystem(): RenderSystem { return this._system; }\r\n public get wantInvertBlackBackground() { return false; }\r\n public get analysisFraction() { return 0; }\r\n public set analysisFraction(_fraction: number) { }\r\n public changeScene(_scene: Scene) { }\r\n public changeDynamics(_dynamics?: GraphicList) { }\r\n public changeDecorations(_decs: Decorations) { }\r\n public changeRenderPlan(_plan: RenderPlan) { }\r\n public drawFrame(_sceneTime?: number) { }\r\n public updateViewRect() { return false; }\r\n public readPixels(_rect: ViewRect, _selector: Pixel.Selector, receiver: Pixel.Receiver, _excludeNonLocatable: boolean) { receiver(undefined); }\r\n public get screenSpaceEffects(): Iterable<string> { return []; }\r\n public set screenSpaceEffects(_effects: Iterable<string>) { }\r\n }\r\n\r\n /** @internal */\r\n export class OnScreenTarget extends Target {\r\n public constructor(system: RenderSystem, private readonly _canvas: HTMLCanvasElement) { super(system); }\r\n\r\n public get viewRect() { return new ViewRect(0, 0, this._canvas.clientWidth, this._canvas.clientHeight); }\r\n public setViewRect(_rect: ViewRect, _temp: boolean) { }\r\n }\r\n\r\n /** @internal */\r\n export class OffScreenTarget extends Target {\r\n public constructor(system: RenderSystem, private readonly _viewRect: ViewRect) { super(system); }\r\n\r\n public get viewRect() { return this._viewRect; }\r\n public setViewRect(rect: ViewRect, _temp: boolean) { this._viewRect.setFrom(rect); }\r\n }\r\n\r\n /** @internal */\r\n export class Builder extends PrimitiveBuilder {\r\n public constructor(system: System, options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions) {\r\n super(system, options);\r\n }\r\n }\r\n\r\n export class Graphic extends RenderGraphic {\r\n public constructor() { super(); }\r\n\r\n public dispose() { }\r\n public collectStatistics(_stats: RenderMemory.Statistics): void { }\r\n public unionRange() { }\r\n }\r\n\r\n export class List extends Graphic {\r\n public constructor(public readonly graphics: RenderGraphic[]) { super(); }\r\n\r\n public override dispose() {\r\n for (const graphic of this.graphics)\r\n dispose(graphic);\r\n\r\n this.graphics.length = 0;\r\n }\r\n }\r\n\r\n export class Branch extends Graphic {\r\n public constructor(public readonly branch: GraphicBranch, public readonly transform: Transform, public readonly options?: GraphicBranchOptions) { super(); }\r\n\r\n public override dispose() { this.branch.dispose(); }\r\n }\r\n\r\n export class Batch extends Graphic {\r\n public constructor(public readonly graphic: RenderGraphic, public readonly featureTable: RenderFeatureTable, public readonly range: ElementAlignedBox3d) { super(); }\r\n\r\n public override dispose() {\r\n dispose(this.graphic);\r\n }\r\n }\r\n\r\n /** @internal */\r\n export class Geometry implements RenderGeometry {\r\n public dispose(): void { }\r\n public collectStatistics(): void { }\r\n }\r\n\r\n /** @internal */\r\n export class AreaPattern implements RenderAreaPattern {\r\n public dispose(): void { }\r\n public collectStatistics(): void { }\r\n }\r\n\r\n export class System extends RenderSystem {\r\n public get isValid() { return true; }\r\n public dispose(): void { }\r\n public override get maxTextureSize() { return 4096; }\r\n\r\n public constructor() { super(); }\r\n\r\n /** @internal */\r\n public override doIdleWork(): boolean { return false; }\r\n\r\n /** @internal */\r\n public override createTarget(canvas: HTMLCanvasElement): OnScreenTarget { return new OnScreenTarget(this, canvas); }\r\n /** @internal */\r\n public override createOffscreenTarget(rect: ViewRect): RenderTarget { return new OffScreenTarget(this, rect); }\r\n\r\n public override createGraphic(options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions): GraphicBuilder {\r\n return new Builder(this, options);\r\n }\r\n\r\n public override createGraphicList(primitives: RenderGraphic[]) { return new List(primitives); }\r\n public override createGraphicBranch(branch: GraphicBranch, transform: Transform, options?: GraphicBranchOptions) { return new Branch(branch, transform, options); }\r\n public override createBatch(graphic: RenderGraphic, features: RenderFeatureTable, range: ElementAlignedBox3d) { return new Batch(graphic, features, range); }\r\n\r\n /** @internal */\r\n public override createMesh(_params: MeshParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPolyline(_params: PolylineParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPointString(_params: PointStringParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPointCloud(_args: PointCloudArgs, _imodel: IModelConnection) { return new Graphic(); }\r\n public override createRenderGraphic() { return new Graphic(); }\r\n\r\n /** @internal */\r\n public override createMeshGeometry() { return new Geometry(); }\r\n /** @internal */\r\n public override createPolylineGeometry() { return new Geometry(); }\r\n /** @internal */\r\n public override createPointStringGeometry() { return new Geometry(); }\r\n /** @internal */\r\n public override createAreaPattern() { return new AreaPattern(); }\r\n }\r\n\r\n export type SystemFactory = () => RenderSystem;\r\n\r\n /** An implementation of IModelApp which uses a MockRender.System by default. */\r\n export class App {\r\n public static systemFactory: SystemFactory = () => App.createDefaultRenderSystem();\r\n\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n opts = opts ? opts : {};\r\n opts.renderSys = this.systemFactory();\r\n opts.localization = opts.localization ?? new EmptyLocalization();\r\n await IModelApp.startup(opts);\r\n }\r\n\r\n public static async shutdown(): Promise<void> {\r\n this.systemFactory = () => App.createDefaultRenderSystem();\r\n await IModelApp.shutdown();\r\n }\r\n\r\n protected static createDefaultRenderSystem() { return new System(); }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"MockRender.js","sourceRoot":"","sources":["../../../src/render/MockRender.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA8C;AAC9C,wDAA0D;AAC1D,oDAAgG;AAChG,4CAA2D;AAK3D,iDAA8C;AAK9C,0EAAuE;AAEvE,mDAA6D;AAG7D,iDAAiE;AACjE,iDAA8C;AAE9C,wDAAuE;AAGvE;;;;;;;;;;;GAWG;AACH,IAAiB,UAAU,CAmK1B;AAnKD,WAAiB,UAAU;;IACzB,gBAAgB;IAChB,MAAsB,MAAO,SAAQ,2BAAY;QAG/C,YAAuC,OAAqB;YAAI,KAAK,EAAE,CAAC;YAAjC,YAAO,GAAP,OAAO,CAAc;YAFhC,QAA2B,GAAG,SAAS,CAAC;QAEK,CAAC;QAE1E,IAAW,YAAY,KAAmB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAChE,IAAW,yBAAyB,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;QACxD,IAAW,gBAAgB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAW,gBAAgB,CA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AAI,WAAW,EAAE,CAAC,CAAC,CAAC;QACjE,gBAAgB;QACA,yBAAyB,KAAK,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC;KACtE;IA3CY,iBAAM,SA2ClB,CAAA;IAID,gFAAgF;IAChF,MAAa,GAAG;QAGP,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAuB;YACjD,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,IAAI,+BAAiB,EAAE,CAAC;YACjE,MAAM,qBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAEM,MAAM,CAAC,KAAK,CAAC,QAAQ;YAC1B,IAAI,CAAC,aAAa,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;YAC3D,MAAM,qBAAS,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC;QAES,MAAM,CAAC,yBAAyB,KAAK,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;;IAdvD,iBAAa,GAAkB,GAAG,EAAE,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;IADxE,cAAG,MAgBf,CAAA;AACH,CAAC,EAnKgB,UAAU,0BAAV,UAAU,QAmK1B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\nimport { dispose } from \"@itwin/core-bentley\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, EmptyLocalization, RenderFeatureTable } from \"@itwin/core-common\";\r\nimport { IModelApp, IModelAppOptions } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { MeshParams } from \"../common/internal/render/MeshParams\";\r\nimport { PointStringParams } from \"../common/internal/render/PointStringParams\";\r\nimport { PolylineParams } from \"../common/internal/render/PolylineParams\";\r\nimport { ViewRect } from \"../common/ViewRect\";\r\nimport { Decorations } from \"./Decorations\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./GraphicBranch\";\r\nimport { CustomGraphicBuilderOptions, GraphicBuilder, ViewportGraphicBuilderOptions } from \"./GraphicBuilder\";\r\nimport { Pixel } from \"./Pixel\";\r\nimport { PrimitiveBuilder } from \"../internal/render/PrimitiveBuilder\";\r\nimport { PointCloudArgs } from \"../common/internal/render/PointCloudPrimitive\";\r\nimport { GraphicList, RenderGraphic } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderPlan } from \"./RenderPlan\";\r\nimport { RenderAreaPattern, RenderSystem } from \"./RenderSystem\";\r\nimport { RenderTarget } from \"./RenderTarget\";\r\nimport { Scene } from \"./Scene\";\r\nimport { _implementationProhibited } from \"../common/internal/Symbols\";\r\nimport { RenderGeometry } from \"../internal/render/RenderGeometry\";\r\n\r\n/** Contains extensible mock implementations of the various components of a RenderSystem, intended for use in tests.\r\n * Use these for tests instead of the default RenderSystem wherever possible because:\r\n * (1) Electron has a bug on Windows in which it fails to obtain a WebGLRenderingContext when running inside a VM (e.g., during CI job); and\r\n * (2) To decouple the logic which uses aspects of the RenderSystem from the full implementation.\r\n * Any and all of these types can be extended for the purposes of specific tests.\r\n * To use this:\r\n * (1) If overriding anything in the implementation supplied herein, pass a SystemFactory function to MockRender.App.systemFactory.\r\n * (2) Call MockRender.App.startup() instead of IModelApp.startup() before tests begin.\r\n * (3) Likewise call MockRender.App.shutdown() when finished. This resets the SystemFactory to its default.\r\n * @note The APIs within this namespace are intended *strictly* for use with unit tests.\r\n * @internal\r\n */\r\nexport namespace MockRender {\r\n /** @internal */\r\n export abstract class Target extends RenderTarget {\r\n protected override readonly [_implementationProhibited] = undefined;\r\n\r\n protected constructor(private readonly _system: RenderSystem) { super(); }\r\n\r\n public get renderSystem(): RenderSystem { return this._system; }\r\n public get wantInvertBlackBackground() { return false; }\r\n public get analysisFraction() { return 0; }\r\n public set analysisFraction(_fraction: number) { }\r\n public changeScene(_scene: Scene) { }\r\n public changeDynamics(_dynamics?: GraphicList) { }\r\n public changeDecorations(_decs: Decorations) { }\r\n public changeRenderPlan(_plan: RenderPlan) { }\r\n public drawFrame(_sceneTime?: number) { }\r\n public updateViewRect() { return false; }\r\n public readPixels(_rect: ViewRect, _selector: Pixel.Selector, receiver: Pixel.Receiver, _excludeNonLocatable: boolean) { receiver(undefined); }\r\n public get screenSpaceEffects(): Iterable<string> { return []; }\r\n public set screenSpaceEffects(_effects: Iterable<string>) { }\r\n }\r\n\r\n /** @internal */\r\n export class OnScreenTarget extends Target {\r\n public constructor(system: RenderSystem, private readonly _canvas: HTMLCanvasElement) { super(system); }\r\n\r\n public get viewRect() { return new ViewRect(0, 0, this._canvas.clientWidth, this._canvas.clientHeight); }\r\n public setViewRect(_rect: ViewRect, _temp: boolean) { }\r\n }\r\n\r\n /** @internal */\r\n export class OffScreenTarget extends Target {\r\n public constructor(system: RenderSystem, private readonly _viewRect: ViewRect) { super(system); }\r\n\r\n public get viewRect() { return this._viewRect; }\r\n public setViewRect(rect: ViewRect, _temp: boolean) { this._viewRect.setFrom(rect); }\r\n }\r\n\r\n /** @internal */\r\n export class Builder extends PrimitiveBuilder {\r\n public constructor(system: System, options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions) {\r\n super(system, options);\r\n }\r\n }\r\n\r\n export class Graphic extends RenderGraphic {\r\n public constructor() { super(); }\r\n\r\n public dispose() { }\r\n public collectStatistics(_stats: RenderMemory.Statistics): void { }\r\n public unionRange() { }\r\n }\r\n\r\n export class List extends Graphic {\r\n public constructor(public readonly graphics: RenderGraphic[]) { super(); }\r\n\r\n public override dispose() {\r\n for (const graphic of this.graphics)\r\n dispose(graphic);\r\n\r\n this.graphics.length = 0;\r\n }\r\n }\r\n\r\n export class Branch extends Graphic {\r\n public constructor(public readonly branch: GraphicBranch, public readonly transform: Transform, public readonly options?: GraphicBranchOptions) { super(); }\r\n\r\n public override dispose() { this.branch.dispose(); }\r\n }\r\n\r\n export class Batch extends Graphic {\r\n public constructor(public readonly graphic: RenderGraphic, public readonly featureTable: RenderFeatureTable, public readonly range: ElementAlignedBox3d) { super(); }\r\n\r\n public override dispose() {\r\n dispose(this.graphic);\r\n }\r\n }\r\n\r\n /** @internal */\r\n export class Geometry implements RenderGeometry {\r\n public noDispose = false;\r\n public readonly isInstanceable = true;\r\n public isDisposed = false;\r\n public constructor(public readonly renderGeometryType: \"mesh\" | \"polyline\" | \"point-string\") {\r\n\r\n }\r\n public dispose(): void { this.isDisposed = true; }\r\n public collectStatistics(): void { }\r\n public computeRange() { return new Range3d(); }\r\n }\r\n\r\n /** @internal */\r\n export class AreaPattern implements RenderAreaPattern {\r\n public readonly [_implementationProhibited] = \"renderAreaPattern\";\r\n public dispose(): void { }\r\n public collectStatistics(): void { }\r\n }\r\n\r\n export class System extends RenderSystem {\r\n public get isValid() { return true; }\r\n public dispose(): void { }\r\n public override get maxTextureSize() { return 4096; }\r\n\r\n public constructor() { super(); }\r\n\r\n /** @internal */\r\n public override doIdleWork(): boolean { return false; }\r\n\r\n /** @internal */\r\n public override createTarget(canvas: HTMLCanvasElement): OnScreenTarget { return new OnScreenTarget(this, canvas); }\r\n /** @internal */\r\n public override createOffscreenTarget(rect: ViewRect): RenderTarget { return new OffScreenTarget(this, rect); }\r\n\r\n public override createGraphic(options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions): GraphicBuilder {\r\n return new Builder(this, options);\r\n }\r\n\r\n public override createGraphicList(primitives: RenderGraphic[]) { return new List(primitives); }\r\n public override createGraphicBranch(branch: GraphicBranch, transform: Transform, options?: GraphicBranchOptions) { return new Branch(branch, transform, options); }\r\n public override createBatch(graphic: RenderGraphic, features: RenderFeatureTable, range: ElementAlignedBox3d) { return new Batch(graphic, features, range); }\r\n\r\n /** @internal */\r\n public override createMesh(_params: MeshParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPolyline(_params: PolylineParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPointString(_params: PointStringParams) { return new Graphic(); }\r\n /** @internal */\r\n public override createPointCloud(_args: PointCloudArgs, _imodel: IModelConnection) { return new Graphic(); }\r\n public override createRenderGraphic() { return new Graphic(); }\r\n\r\n /** @internal */\r\n public override createMeshGeometry() { return new Geometry(\"mesh\"); }\r\n /** @internal */\r\n public override createPolylineGeometry() { return new Geometry(\"polyline\"); }\r\n /** @internal */\r\n public override createPointStringGeometry() { return new Geometry(\"point-string\"); }\r\n /** @internal */\r\n public override createAreaPattern() { return new AreaPattern(); }\r\n /** @internal */\r\n public override createGraphicFromTemplate() { return new Graphic(); }\r\n }\r\n\r\n export type SystemFactory = () => RenderSystem;\r\n\r\n /** An implementation of IModelApp which uses a MockRender.System by default. */\r\n export class App {\r\n public static systemFactory: SystemFactory = () => App.createDefaultRenderSystem();\r\n\r\n public static async startup(opts?: IModelAppOptions): Promise<void> {\r\n opts = opts ? opts : {};\r\n opts.renderSys = this.systemFactory();\r\n opts.localization = opts.localization ?? new EmptyLocalization();\r\n await IModelApp.startup(opts);\r\n }\r\n\r\n public static async shutdown(): Promise<void> {\r\n this.systemFactory = () => App.createDefaultRenderSystem();\r\n await IModelApp.shutdown();\r\n }\r\n\r\n protected static createDefaultRenderSystem() { return new System(); }\r\n }\r\n}\r\n"]}
|