@itwin/core-frontend 4.1.0-dev.63 → 4.1.0-dev.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/lib/cjs/Viewport.js +1 -1
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/render/CanvasDecoration.d.ts +6 -2
- package/lib/cjs/render/CanvasDecoration.d.ts.map +1 -1
- package/lib/cjs/render/CanvasDecoration.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +10 -1
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +64 -5
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +9 -4
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/TileContent.d.ts +6 -0
- package/lib/cjs/tile/TileContent.d.ts.map +1 -1
- package/lib/cjs/tile/TileContent.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.d.ts +11 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.d.ts.map +1 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.js +10 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.js.map +1 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts +3 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGeometryRenderer.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts +2 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js +1 -0
- package/lib/cjs/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +2 -1
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/Viewport.js +1 -1
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/render/CanvasDecoration.d.ts +6 -2
- package/lib/esm/render/CanvasDecoration.d.ts.map +1 -1
- package/lib/esm/render/CanvasDecoration.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +10 -1
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +65 -6
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +9 -4
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/TileContent.d.ts +6 -0
- package/lib/esm/tile/TileContent.d.ts.map +1 -1
- package/lib/esm/tile/TileContent.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.d.ts +11 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.d.ts.map +1 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.js +9 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisAttributeDrivenSymbology.js.map +1 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts +3 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGisGeometryRenderer.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts +2 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js +1 -0
- package/lib/esm/tile/map/ImageryProviders/ArcGisGraphicsRenderer.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +2 -1
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/package.json +18 -18
|
@@ -31,10 +31,14 @@ export interface CanvasDecoration {
|
|
|
31
31
|
pick?(pt: XAndY): boolean;
|
|
32
32
|
/** Optional method to be called whenever this decorator is picked and the mouse first enters this decoration. */
|
|
33
33
|
onMouseEnter?(ev: BeButtonEvent): void;
|
|
34
|
-
/** Optional method to be called whenever
|
|
34
|
+
/** Optional method to be called whenever the mouse leaves this decoration. */
|
|
35
35
|
onMouseLeave?(): void;
|
|
36
|
-
/** Optional method to be called whenever
|
|
36
|
+
/** Optional method to be called whenever the mouse moves inside this decoration. */
|
|
37
37
|
onMouseMove?(ev: BeButtonEvent): void;
|
|
38
|
+
/** Optional method to be called whenever the mouse moves inside this decoration that determines whether the event is forwarded to the active tool.
|
|
39
|
+
* @return true if the event was *not* handled by this decoration and should be forwarded to the active tool.
|
|
40
|
+
*/
|
|
41
|
+
propagateMouseMove?(ev: BeButtonEvent): boolean;
|
|
38
42
|
/**
|
|
39
43
|
* Optional method to be called whenever this decorator is picked and a mouse button is pressed or released inside this decoration.
|
|
40
44
|
* @return true if the event was handled by this decoration and should *not* be forwarded to the active tool.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasDecoration.d.ts","sourceRoot":"","sources":["../../../src/render/CanvasDecoration.ts"],"names":[],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AAC,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC;IAC3C;;;OAGG;IACH,OAAO,CAAC,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC;IACpC,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasDecoration.js","sourceRoot":"","sources":["../../../src/render/CanvasDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { XAndY } from \"@itwin/core-geometry\";\r\nimport { BeButtonEvent, BeWheelEvent } from \"../tools/Tool\";\r\n\r\n/** A [Decoration]($docs/learning/frontend/ViewDecorations#canvas-decorations) that is drawn onto the\r\n * [2d canvas](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) on top of a ScreenViewport.\r\n * CanvasDecorations may be pickable by implementing [[pick]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CanvasDecoration {\r\n /**\r\n * Required method to draw this decoration into the supplied [CanvasRenderingContext2D](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D). This method is called every time a frame is rendered.\r\n * @param ctx The CanvasRenderingContext2D for the [[ScreenViewport]] being rendered.\r\n * @note Before this this function is called, the state of the CanvasRenderingContext2D is [saved](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/save),\r\n * and it is [restored](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/restore) when this method returns. Therefore,\r\n * it is *not* necessary for implementers to save/restore themselves.\r\n */\r\n drawDecoration(ctx: CanvasRenderingContext2D): void;\r\n /**\r\n * Optional view coordinates position of this overlay decoration. If present, [ctx.translate](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/translate) is called\r\n * with this point before [[drawDecoration]] is called.\r\n */\r\n position?: XAndY;\r\n /** Optional method to provide feedback when mouse events occur on this decoration.\r\n * @param pt The position of the mouse in the ScreenViewport\r\n * @return true if the mouse is inside this decoration.\r\n * @note If this method is not present, no mouse events are directed to this decoration.\r\n */\r\n pick?(pt: XAndY): boolean;\r\n /** Optional method to be called whenever this decorator is picked and the mouse first enters this decoration. */\r\n onMouseEnter?(ev: BeButtonEvent): void;\r\n /** Optional method to be called whenever
|
|
1
|
+
{"version":3,"file":"CanvasDecoration.js","sourceRoot":"","sources":["../../../src/render/CanvasDecoration.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG","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 { XAndY } from \"@itwin/core-geometry\";\r\nimport { BeButtonEvent, BeWheelEvent } from \"../tools/Tool\";\r\n\r\n/** A [Decoration]($docs/learning/frontend/ViewDecorations#canvas-decorations) that is drawn onto the\r\n * [2d canvas](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) on top of a ScreenViewport.\r\n * CanvasDecorations may be pickable by implementing [[pick]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface CanvasDecoration {\r\n /**\r\n * Required method to draw this decoration into the supplied [CanvasRenderingContext2D](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D). This method is called every time a frame is rendered.\r\n * @param ctx The CanvasRenderingContext2D for the [[ScreenViewport]] being rendered.\r\n * @note Before this this function is called, the state of the CanvasRenderingContext2D is [saved](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/save),\r\n * and it is [restored](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/restore) when this method returns. Therefore,\r\n * it is *not* necessary for implementers to save/restore themselves.\r\n */\r\n drawDecoration(ctx: CanvasRenderingContext2D): void;\r\n /**\r\n * Optional view coordinates position of this overlay decoration. If present, [ctx.translate](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/translate) is called\r\n * with this point before [[drawDecoration]] is called.\r\n */\r\n position?: XAndY;\r\n /** Optional method to provide feedback when mouse events occur on this decoration.\r\n * @param pt The position of the mouse in the ScreenViewport\r\n * @return true if the mouse is inside this decoration.\r\n * @note If this method is not present, no mouse events are directed to this decoration.\r\n */\r\n pick?(pt: XAndY): boolean;\r\n /** Optional method to be called whenever this decorator is picked and the mouse first enters this decoration. */\r\n onMouseEnter?(ev: BeButtonEvent): void;\r\n /** Optional method to be called whenever the mouse leaves this decoration. */\r\n onMouseLeave?(): void;\r\n /** Optional method to be called whenever the mouse moves inside this decoration. */\r\n onMouseMove?(ev: BeButtonEvent): void;\r\n /** Optional method to be called whenever the mouse moves inside this decoration that determines whether the event is forwarded to the active tool.\r\n * @return true if the event was *not* handled by this decoration and should be forwarded to the active tool.\r\n */\r\n propagateMouseMove?(ev: BeButtonEvent): boolean;\r\n /**\r\n * Optional method to be called whenever this decorator is picked and a mouse button is pressed or released inside this decoration.\r\n * @return true if the event was handled by this decoration and should *not* be forwarded to the active tool.\r\n * @note This method is called for both mouse up and down events. If it returns `true` for a down event, it should also return `true` for the\r\n * corresponding up event.\r\n */\r\n onMouseButton?(ev: BeButtonEvent): boolean;\r\n /**\r\n * Optional method to be called when the mouse wheel is rolled with the pointer over this decoration.\r\n * @return true to indicate that the event has been handled and should not be propagated to default handler\r\n */\r\n onWheel?(ev: BeWheelEvent): boolean;\r\n /** Cursor to use when mouse is inside this decoration. Default is \"pointer\". */\r\n decorationCursor?: string;\r\n}\r\n\r\n/** An array of [[CanvasDecoration]]s.\r\n * @public\r\n * @extensions\r\n */\r\nexport type CanvasDecorationList = CanvasDecoration[];\r\n"]}
|
|
@@ -11,6 +11,7 @@ import { RenderGraphic } from "../render/RenderGraphic";
|
|
|
11
11
|
import { RenderSystem } from "../render/RenderSystem";
|
|
12
12
|
import { RealityTileGeometry, TileContent } from "./internal";
|
|
13
13
|
import { DisplayParams } from "../common/render/primitives/DisplayParams";
|
|
14
|
+
import { PointCloudArgs } from "../render/primitives/PointCloudPrimitive";
|
|
14
15
|
import { TextureImageSource } from "../common/render/TextureParams";
|
|
15
16
|
import { GltfAccessor, GltfBuffer, GltfBufferViewProps, GltfDataType, GltfDictionary, GltfDocument, GltfId, GltfImage, GltfMaterial, GltfMesh, GltfMeshPrimitive, GltfNode, GltfSampler, GltfScene, GltfTexture, GltfWrapMode } from "../common/gltf/GltfSchema";
|
|
16
17
|
/** @internal */
|
|
@@ -88,8 +89,14 @@ export declare class GltfMeshData {
|
|
|
88
89
|
uvs?: Uint16Array;
|
|
89
90
|
uvRange?: Range2d;
|
|
90
91
|
indices?: Uint8Array | Uint16Array | Uint32Array;
|
|
92
|
+
readonly type: "mesh";
|
|
91
93
|
constructor(props: Mesh);
|
|
92
94
|
}
|
|
95
|
+
interface GltfPointCloud extends PointCloudArgs {
|
|
96
|
+
readonly type: "pointcloud";
|
|
97
|
+
pointRange: Range3d;
|
|
98
|
+
}
|
|
99
|
+
type GltfPrimitiveData = GltfMeshData | GltfPointCloud;
|
|
93
100
|
/** A function that returns true if deserialization of the data supplied by the reader should abort.
|
|
94
101
|
* @internal
|
|
95
102
|
*/
|
|
@@ -141,6 +148,7 @@ export declare abstract class GltfReader {
|
|
|
141
148
|
protected _computedContentRange?: ElementAlignedBox3d;
|
|
142
149
|
private readonly _resolvedTextures;
|
|
143
150
|
private readonly _dracoMeshes;
|
|
151
|
+
private _containsPointCloud;
|
|
144
152
|
protected get _nodes(): GltfDictionary<GltfNode>;
|
|
145
153
|
protected get _meshes(): GltfDictionary<GltfMesh>;
|
|
146
154
|
protected get _accessors(): GltfDictionary<GltfAccessor>;
|
|
@@ -200,7 +208,8 @@ export declare abstract class GltfReader {
|
|
|
200
208
|
private isMaterialTransparent;
|
|
201
209
|
protected createDisplayParams(material: GltfMaterial, hasBakedLighting: boolean): DisplayParams | undefined;
|
|
202
210
|
private readMeshPrimitives;
|
|
203
|
-
protected readMeshPrimitive(primitive: GltfMeshPrimitive, featureTable?: FeatureTable, pseudoRtcBias?: Vector3d):
|
|
211
|
+
protected readMeshPrimitive(primitive: GltfMeshPrimitive, featureTable?: FeatureTable, pseudoRtcBias?: Vector3d): GltfPrimitiveData | undefined;
|
|
212
|
+
private readPointCloud;
|
|
204
213
|
private readDracoMeshPrimitive;
|
|
205
214
|
private deduplicateVertices;
|
|
206
215
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfReader.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EACsC,OAAO,EAAqB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAC7G,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAAE,SAAS,EAAY,mBAAmB,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"GltfReader.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfReader.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EACsC,OAAO,EAAqB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAC7G,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAAE,SAAS,EAAY,mBAAmB,EAAE,OAAO,EAAkC,YAAY,EACxF,gBAAgB,EAAwC,SAAS,EAAE,SAAS,EACzD,aAAa,EAAE,cAAc,EAAmC,cAAc,EAC3H,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,E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AAI,cAAc,CAAC,SAAS,CAAC,CAA2C;IACzF,IAAW,UAAU,IAAI,MAAM,EAAE,CAA6B;IAC9D,IAAW,QAAQ,IAAI,cAAc,CAAC,WAAW,CAAC,CAA2B;CAC9E"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { assert, ByteStream, compareBooleans, compareNumbers, compareStrings, Dictionary, JsonUtils, Logger, utf8ToString, } from "@itwin/core-bentley";
|
|
9
9
|
import { Angle, IndexedPolyface, Matrix3d, Point2d, Point3d, Point4d, Range2d, Range3d, Transform, Vector3d, } from "@itwin/core-geometry";
|
|
10
|
-
import { BatchType, ColorDef, Feature, FeatureTable, FillFlags, GlbHeader, ImageSource, LinePixels, MeshEdge, MeshEdges, MeshPolyline, OctEncodedNormal, PackedFeatureTable, QParams2d, QParams3d, QPoint2dList, QPoint3dList, Quantization, RenderTexture, TextureMapping, TextureTransparency, TileFormat, TileReadStatus, } from "@itwin/core-common";
|
|
10
|
+
import { BatchType, ColorDef, Feature, FeatureIndex, FeatureIndexType, FeatureTable, FillFlags, GlbHeader, ImageSource, LinePixels, MeshEdge, MeshEdges, MeshPolyline, OctEncodedNormal, PackedFeatureTable, QParams2d, QParams3d, QPoint2dList, QPoint3dList, Quantization, RenderTexture, TextureMapping, TextureTransparency, TileFormat, TileReadStatus, } from "@itwin/core-common";
|
|
11
11
|
import { IModelApp } from "../IModelApp";
|
|
12
12
|
import { GraphicBranch } from "../render/GraphicBranch";
|
|
13
13
|
import { RealityMeshParams } from "../render/RealityMeshParams";
|
|
@@ -181,6 +181,7 @@ export class GltfReaderProps {
|
|
|
181
181
|
*/
|
|
182
182
|
export class GltfMeshData {
|
|
183
183
|
constructor(props) {
|
|
184
|
+
this.type = "mesh";
|
|
184
185
|
this.primitive = props;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
@@ -346,6 +347,7 @@ export class GltfReader {
|
|
|
346
347
|
contentRange,
|
|
347
348
|
range,
|
|
348
349
|
graphic: renderGraphic,
|
|
350
|
+
containsPointCloud: this._containsPointCloud,
|
|
349
351
|
};
|
|
350
352
|
}
|
|
351
353
|
readGltfAndCreateGeometry(transformToRoot, needNormals = false, needParams = false) {
|
|
@@ -359,6 +361,8 @@ export class GltfReader {
|
|
|
359
361
|
return { polyfaces };
|
|
360
362
|
}
|
|
361
363
|
graphicFromMeshData(gltfMesh, instances) {
|
|
364
|
+
if ("pointcloud" === gltfMesh.type)
|
|
365
|
+
return this._system.createPointCloud(gltfMesh, this._iModel);
|
|
362
366
|
if (!gltfMesh.points || !gltfMesh.pointRange)
|
|
363
367
|
return gltfMesh.primitive.getGraphics(this._system, instances);
|
|
364
368
|
const realityMeshPrimitive = (this._vertexTableRequired || instances) ? undefined : RealityMeshParams.fromGltfMesh(gltfMesh);
|
|
@@ -445,9 +449,11 @@ export class GltfReader {
|
|
|
445
449
|
transformStack.push(node);
|
|
446
450
|
const meshes = this.readMeshPrimitives(node);
|
|
447
451
|
for (const mesh of meshes) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
452
|
+
if (mesh.type === "mesh") {
|
|
453
|
+
const polyface = this.polyfaceFromGltfMesh(mesh, transformStack.transform, needNormals, needParams);
|
|
454
|
+
if (polyface)
|
|
455
|
+
polyfaces.push(polyface);
|
|
456
|
+
}
|
|
451
457
|
}
|
|
452
458
|
if (node.children) {
|
|
453
459
|
for (const childId of node.children) {
|
|
@@ -521,6 +527,9 @@ export class GltfReader {
|
|
|
521
527
|
}
|
|
522
528
|
let componentCount = 1;
|
|
523
529
|
switch (accessor.type) {
|
|
530
|
+
case "VEC4":
|
|
531
|
+
componentCount = 4;
|
|
532
|
+
break;
|
|
524
533
|
case "VEC3":
|
|
525
534
|
componentCount = 3;
|
|
526
535
|
break;
|
|
@@ -547,6 +556,7 @@ export class GltfReader {
|
|
|
547
556
|
constructor(args) {
|
|
548
557
|
this._resolvedTextures = new Dictionary((lhs, rhs) => compareTextureKeys(lhs, rhs));
|
|
549
558
|
this._dracoMeshes = new Map();
|
|
559
|
+
this._containsPointCloud = false;
|
|
550
560
|
/** The glTF spec says that if GltfSampler.wrapS/T are omitted, they default to Repeat.
|
|
551
561
|
* However, the reality data service serves tiles that lack any wrapS/T property, and we want those clamped to edge, not repeated.
|
|
552
562
|
* (We also don't want to produce mip-maps for them, which is determined indirectly from the wrap mode).
|
|
@@ -680,6 +690,12 @@ export class GltfReader {
|
|
|
680
690
|
return meshes;
|
|
681
691
|
}
|
|
682
692
|
readMeshPrimitive(primitive, featureTable, pseudoRtcBias) {
|
|
693
|
+
const meshMode = JsonUtils.asInt(primitive.mode, GltfMeshMode.Triangles);
|
|
694
|
+
if (meshMode === GltfMeshMode.Points /* && !this._vertexTableRequired */) {
|
|
695
|
+
const pointCloud = this.readPointCloud(primitive, undefined !== featureTable);
|
|
696
|
+
if (pointCloud)
|
|
697
|
+
return pointCloud;
|
|
698
|
+
}
|
|
683
699
|
const materialName = JsonUtils.asString(primitive.material);
|
|
684
700
|
const material = 0 < materialName.length ? this._materials[materialName] : {};
|
|
685
701
|
if (!material)
|
|
@@ -689,7 +705,6 @@ export class GltfReader {
|
|
|
689
705
|
if (!displayParams)
|
|
690
706
|
return undefined;
|
|
691
707
|
let primitiveType = -1;
|
|
692
|
-
const meshMode = JsonUtils.asInt(primitive.mode, GltfMeshMode.Triangles);
|
|
693
708
|
switch (meshMode) {
|
|
694
709
|
case GltfMeshMode.Lines:
|
|
695
710
|
primitiveType = MeshPrimitiveType.Polyline;
|
|
@@ -701,7 +716,6 @@ export class GltfReader {
|
|
|
701
716
|
primitiveType = MeshPrimitiveType.Mesh;
|
|
702
717
|
break;
|
|
703
718
|
default:
|
|
704
|
-
assert(false);
|
|
705
719
|
return undefined;
|
|
706
720
|
}
|
|
707
721
|
const isVolumeClassifier = this._isVolumeClassifier;
|
|
@@ -796,6 +810,51 @@ export class GltfReader {
|
|
|
796
810
|
}
|
|
797
811
|
return mesh;
|
|
798
812
|
}
|
|
813
|
+
readPointCloud(primitive, hasFeatures) {
|
|
814
|
+
const posView = this.getBufferView(primitive.attributes, "POSITION");
|
|
815
|
+
if (!posView || GltfDataType.Float !== posView.type)
|
|
816
|
+
return undefined;
|
|
817
|
+
const posData = posView.toBufferData(GltfDataType.Float);
|
|
818
|
+
if (!(posData?.buffer instanceof Float32Array))
|
|
819
|
+
return undefined;
|
|
820
|
+
const colorView = this.getBufferView(primitive.attributes, "COLOR_0");
|
|
821
|
+
if (!colorView || GltfDataType.UnsignedByte !== colorView.type)
|
|
822
|
+
return undefined;
|
|
823
|
+
const colorData = colorView.toBufferData(GltfDataType.UnsignedByte);
|
|
824
|
+
if (!(colorData?.buffer instanceof Uint8Array))
|
|
825
|
+
return undefined;
|
|
826
|
+
const strideSkip = posView.stride - 3;
|
|
827
|
+
const pointRange = new Range3d();
|
|
828
|
+
for (let i = 0; i < posData.buffer.length; i += strideSkip)
|
|
829
|
+
pointRange.extendXYZ(posData.buffer[i++], posData.buffer[i++], posData.buffer[i++]);
|
|
830
|
+
let colors = colorData.buffer;
|
|
831
|
+
if ("VEC4" === colorView.accessor.type) {
|
|
832
|
+
// ###TODO support transparent point clouds
|
|
833
|
+
colors = new Uint8Array(colorData.count * 3);
|
|
834
|
+
for (let i = 0; i < colorData.count; i++) {
|
|
835
|
+
const srcIdx = colorView.stride * i;
|
|
836
|
+
const dstIdx = 3 * i;
|
|
837
|
+
for (let j = 0; j < 3; j++)
|
|
838
|
+
colors[dstIdx + j] = colorData.buffer[srcIdx + j];
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
const features = new FeatureIndex();
|
|
842
|
+
if (hasFeatures)
|
|
843
|
+
features.type = FeatureIndexType.Uniform;
|
|
844
|
+
this._containsPointCloud = true;
|
|
845
|
+
return {
|
|
846
|
+
type: "pointcloud",
|
|
847
|
+
positions: posData.buffer,
|
|
848
|
+
qparams: QParams3d.fromOriginAndScale(new Point3d(0, 0, 0), new Point3d(1, 1, 1)),
|
|
849
|
+
pointRange,
|
|
850
|
+
colors,
|
|
851
|
+
colorFormat: "rgb",
|
|
852
|
+
features,
|
|
853
|
+
// ###TODO: If tile does not use additive refinement, compute voxelSize based on point range.
|
|
854
|
+
// Additive refinement is typical of the glTF point clouds we receive from Orbit.
|
|
855
|
+
voxelSize: 0,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
799
858
|
readDracoMeshPrimitive(mesh, ext) {
|
|
800
859
|
const draco = this._dracoMeshes.get(ext);
|
|
801
860
|
if (!draco || "triangle-list" !== draco.topology)
|