@itwin/core-common 4.1.0-dev.62 → 4.1.0-dev.66
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 +16 -1
- package/lib/cjs/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/cjs/tile/GltfTileIO.js +2 -0
- package/lib/cjs/tile/GltfTileIO.js.map +1 -1
- package/lib/esm/tile/GltfTileIO.d.ts.map +1 -1
- package/lib/esm/tile/GltfTileIO.js +2 -0
- package/lib/esm/tile/GltfTileIO.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Change Log - @itwin/core-common
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 17 Jul 2023 19:31:25 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.0.4
|
|
6
|
+
Wed, 12 Jul 2023 15:50:01 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
4
9
|
|
|
5
10
|
## 4.0.3
|
|
6
11
|
Mon, 03 Jul 2023 15:28:41 GMT
|
|
@@ -34,6 +39,16 @@ Mon, 22 May 2023 15:34:14 GMT
|
|
|
34
39
|
- Add interfaces representing 3d tileset schema.
|
|
35
40
|
- add Atmosphere class as a property of Environment
|
|
36
41
|
|
|
42
|
+
## 3.7.11
|
|
43
|
+
Tue, 11 Jul 2023 17:17:21 GMT
|
|
44
|
+
|
|
45
|
+
_Version update only_
|
|
46
|
+
|
|
47
|
+
## 3.7.10
|
|
48
|
+
Wed, 05 Jul 2023 13:41:21 GMT
|
|
49
|
+
|
|
50
|
+
_Version update only_
|
|
51
|
+
|
|
37
52
|
## 3.7.9
|
|
38
53
|
Tue, 20 Jun 2023 12:51:02 GMT
|
|
39
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB1D,gBAAgB;AAChB,qBAAa,SAAU,SAAQ,UAAU;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAK;IACvC,SAAgB,SAAS,EAAE,SAAS,CAA4B;IAChE,SAAgB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxC,SAAgB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IAExD,IAAW,OAAO,IAAI,OAAO,CAE5B;gBAEkB,MAAM,EAAE,UAAU;CAuEtC"}
|
|
@@ -31,6 +31,8 @@ function consumeNextChunk(stream) {
|
|
|
31
31
|
return undefined;
|
|
32
32
|
const offset = stream.curPos + 8;
|
|
33
33
|
const length = stream.readUint32();
|
|
34
|
+
if (stream.isAtTheEnd)
|
|
35
|
+
return undefined;
|
|
34
36
|
const type = stream.readUint32();
|
|
35
37
|
stream.advance(length);
|
|
36
38
|
return stream.isPastTheEnd ? false : { offset, length, type };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AACzD,qCAAkD;AAElD;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAED,gBAAgB;AAChB,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B;AAmBD,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,IAAI,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/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Q,KAAK,CAAC,IAAI,EAAE;wBAClB,KAAK,gBAAgB,CAAC,IAAI;4BACxB,0DAA0D;4BAC1D,IAAI,CAAC,UAAU,EAAE,CAAC;4BAClB,OAAO;wBACT,KAAK,gBAAgB,CAAC,MAAM;4BAC1B,2EAA2E;4BAC3E,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;gCACpD,IAAI,CAAC,UAAU,EAAE,CAAC;gCAClB,OAAO;6BACR;4BAED,IAAI,CAAC,WAAW,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;4BAClE,MAAM;wBACR;4BACE,kEAAkE;4BAClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;qBACT;iBACF;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE;oBACnB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;iBACR;gBAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,IAAA,qBAAM,EAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;SACT;IACH,CAAC;CACF;AAjFD,8BAiFC","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 Tile\r\n */\r\n\r\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\r\n * @internal\r\n */\r\nexport enum GltfVersions {\r\n Version1 = 1,\r\n Version2 = 2,\r\n CurrentVersion = Version1,\r\n Gltf1SceneFormat = 0,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfV2ChunkTypes {\r\n JSON = 0x4E4F534a,\r\n Binary = 0x004E4942,\r\n}\r\n\r\n/** A chunk of a glb file.\r\n * @internal\r\n */\r\nexport interface GltfChunk {\r\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\r\n * This excludes the 8-byte chunk header containing the length and type fields.\r\n */\r\n offset: number;\r\n /** The number of bytes in the chunk's data. */\r\n length: number;\r\n}\r\n\r\n/** Describes a glTF chunk's data along with its type.\r\n * @internal\r\n */\r\nexport type TypedGltfChunk = GltfChunk & { type: number };\r\n\r\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const offset = stream.curPos + 8;\r\n\r\n const length = stream.readUint32();\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const type = stream.readUint32();\r\n stream.advance(length);\r\n return stream.isPastTheEnd ? false : { offset, length, type };\r\n}\r\n\r\n/** @internal */\r\nexport class GlbHeader extends TileHeader {\r\n public readonly gltfLength: number = 0;\r\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\r\n public readonly binaryChunk?: GltfChunk;\r\n public readonly additionalChunks: TypedGltfChunk[] = [];\r\n\r\n public get isValid(): boolean {\r\n return TileFormat.Gltf === this.format;\r\n }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.gltfLength = stream.readUint32();\r\n\r\n const jsonLength = stream.readUint32();\r\n const word5 = stream.readUint32();\r\n\r\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\r\n // validating the chunk type.\r\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\r\n this.version = GltfVersions.Version1;\r\n\r\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\r\n switch (this.version) {\r\n case GltfVersions.Version1:\r\n if (GltfVersions.Gltf1SceneFormat !== word5) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n const binaryOffset = stream.curPos + jsonLength;\r\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\r\n break;\r\n case GltfVersions.Version2:\r\n if (word5 !== GltfV2ChunkTypes.JSON) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n stream.advance(jsonLength);\r\n if (stream.isPastTheEnd) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n let chunk;\r\n while (chunk = consumeNextChunk(stream)) {\r\n switch (chunk.type) {\r\n case GltfV2ChunkTypes.JSON:\r\n // Only one JSON chunk permitted and it must be the first.\r\n this.invalidate();\r\n return;\r\n case GltfV2ChunkTypes.Binary:\r\n // At most one binary chunk permitted and it must be the second if present.\r\n if (this.binaryChunk || this.additionalChunks.length) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\r\n break;\r\n default:\r\n // Any other chunk type should be ignored - for use by extensions.\r\n this.additionalChunks.push(chunk);\r\n break;\r\n }\r\n }\r\n\r\n if (false === chunk) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n assert(undefined === chunk);\r\n assert(stream.isAtTheEnd);\r\n break;\r\n default:\r\n this.invalidate();\r\n break;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"GltfTileIO.d.ts","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,QAAQ,IAAI;IACZ,cAAc,IAAW;IACzB,gBAAgB,IAAI;CACrB;AAED,gBAAgB;AAChB,oBAAY,gBAAgB;IAC1B,IAAI,aAAa;IACjB,MAAM,UAAa;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB1D,gBAAgB;AAChB,qBAAa,SAAU,SAAQ,UAAU;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAK;IACvC,SAAgB,SAAS,EAAE,SAAS,CAA4B;IAChE,SAAgB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxC,SAAgB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IAExD,IAAW,OAAO,IAAI,OAAO,CAE5B;gBAEkB,MAAM,EAAE,UAAU;CAuEtC"}
|
|
@@ -28,6 +28,8 @@ function consumeNextChunk(stream) {
|
|
|
28
28
|
return undefined;
|
|
29
29
|
const offset = stream.curPos + 8;
|
|
30
30
|
const length = stream.readUint32();
|
|
31
|
+
if (stream.isAtTheEnd)
|
|
32
|
+
return undefined;
|
|
31
33
|
const type = stream.readUint32();
|
|
32
34
|
stream.advance(length);
|
|
33
35
|
return stream.isPastTheEnd ? false : { offset, length, type };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEAAyB,CAAA;IACzB,uEAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,gEAAiB,CAAA;IACjB,iEAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAmBD,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,IAAI,MAAM,CAAC,UAAU;QACnB,OAAO,SAAS,CAAC;IAEnB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GltfTileIO.js","sourceRoot":"","sources":["../../../src/tile/GltfTileIO.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAc,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElD;;GAEG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,uDAAY,CAAA;IACZ,mEA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AC,WAAW,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;gCACpD,IAAI,CAAC,UAAU,EAAE,CAAC;gCAClB,OAAO;6BACR;4BAED,IAAI,CAAC,WAAW,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;4BAClE,MAAM;wBACR;4BACE,kEAAkE;4BAClE,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;4BAClC,MAAM;qBACT;iBACF;gBAED,IAAI,KAAK,KAAK,KAAK,EAAE;oBACnB,IAAI,CAAC,UAAU,EAAE,CAAC;oBAClB,OAAO;iBACR;gBAED,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;gBAC5B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC1B,MAAM;YACR;gBACE,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,MAAM;SACT;IACH,CAAC;CACF","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 Tile\r\n */\r\n\r\nimport { assert, ByteStream } from \"@itwin/core-bentley\";\r\nimport { TileFormat, TileHeader } from \"./TileIO\";\r\n\r\n/** Known version of the [glTF format](https://www.khronos.org/gltf/).\r\n * @internal\r\n */\r\nexport enum GltfVersions {\r\n Version1 = 1,\r\n Version2 = 2,\r\n CurrentVersion = Version1,\r\n Gltf1SceneFormat = 0,\r\n}\r\n\r\n/** @internal */\r\nexport enum GltfV2ChunkTypes {\r\n JSON = 0x4E4F534a,\r\n Binary = 0x004E4942,\r\n}\r\n\r\n/** A chunk of a glb file.\r\n * @internal\r\n */\r\nexport interface GltfChunk {\r\n /** Offset of the first byte of the chunk's data relative to the beginning of the glb data.\r\n * This excludes the 8-byte chunk header containing the length and type fields.\r\n */\r\n offset: number;\r\n /** The number of bytes in the chunk's data. */\r\n length: number;\r\n}\r\n\r\n/** Describes a glTF chunk's data along with its type.\r\n * @internal\r\n */\r\nexport type TypedGltfChunk = GltfChunk & { type: number };\r\n\r\nfunction consumeNextChunk(stream: ByteStream): TypedGltfChunk | undefined | false {\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const offset = stream.curPos + 8;\r\n\r\n const length = stream.readUint32();\r\n if (stream.isAtTheEnd)\r\n return undefined;\r\n\r\n const type = stream.readUint32();\r\n stream.advance(length);\r\n return stream.isPastTheEnd ? false : { offset, length, type };\r\n}\r\n\r\n/** @internal */\r\nexport class GlbHeader extends TileHeader {\r\n public readonly gltfLength: number = 0;\r\n public readonly jsonChunk: GltfChunk = { offset: 0, length: 0 };\r\n public readonly binaryChunk?: GltfChunk;\r\n public readonly additionalChunks: TypedGltfChunk[] = [];\r\n\r\n public get isValid(): boolean {\r\n return TileFormat.Gltf === this.format;\r\n }\r\n\r\n public constructor(stream: ByteStream) {\r\n super(stream);\r\n this.gltfLength = stream.readUint32();\r\n\r\n const jsonLength = stream.readUint32();\r\n const word5 = stream.readUint32();\r\n\r\n // Early versions of the reality data tile publisher incorrectly put version 2 into header - handle these old tiles\r\n // validating the chunk type.\r\n if (this.version === GltfVersions.Version2 && word5 === GltfVersions.Gltf1SceneFormat)\r\n this.version = GltfVersions.Version1;\r\n\r\n this.jsonChunk = { offset: stream.curPos, length: jsonLength };\r\n switch (this.version) {\r\n case GltfVersions.Version1:\r\n if (GltfVersions.Gltf1SceneFormat !== word5) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n const binaryOffset = stream.curPos + jsonLength;\r\n this.binaryChunk = { offset: binaryOffset, length: this.gltfLength - binaryOffset };\r\n break;\r\n case GltfVersions.Version2:\r\n if (word5 !== GltfV2ChunkTypes.JSON) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n stream.advance(jsonLength);\r\n if (stream.isPastTheEnd) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n let chunk;\r\n while (chunk = consumeNextChunk(stream)) {\r\n switch (chunk.type) {\r\n case GltfV2ChunkTypes.JSON:\r\n // Only one JSON chunk permitted and it must be the first.\r\n this.invalidate();\r\n return;\r\n case GltfV2ChunkTypes.Binary:\r\n // At most one binary chunk permitted and it must be the second if present.\r\n if (this.binaryChunk || this.additionalChunks.length) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n this.binaryChunk = { offset: chunk.offset, length: chunk.length };\r\n break;\r\n default:\r\n // Any other chunk type should be ignored - for use by extensions.\r\n this.additionalChunks.push(chunk);\r\n break;\r\n }\r\n }\r\n\r\n if (false === chunk) {\r\n this.invalidate();\r\n return;\r\n }\r\n\r\n assert(undefined === chunk);\r\n assert(stream.isAtTheEnd);\r\n break;\r\n default:\r\n this.invalidate();\r\n break;\r\n }\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-common",
|
|
3
|
-
"version": "4.1.0-dev.
|
|
3
|
+
"version": "4.1.0-dev.66",
|
|
4
4
|
"description": "iTwin.js components common to frontend and backend",
|
|
5
5
|
"main": "lib/cjs/core-common.js",
|
|
6
6
|
"module": "lib/esm/core-common.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"js-base64": "^3.6.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@itwin/core-bentley": "^4.1.0-dev.
|
|
31
|
-
"@itwin/core-geometry": "^4.1.0-dev.
|
|
30
|
+
"@itwin/core-bentley": "^4.1.0-dev.66",
|
|
31
|
+
"@itwin/core-geometry": "^4.1.0-dev.66"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@itwin/eslint-plugin": "4.0.0-dev.36",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"nyc": "^15.1.0",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"typescript": "~5.0.2",
|
|
46
|
-
"@itwin/build-tools": "4.1.0-dev.
|
|
47
|
-
"@itwin/core-
|
|
48
|
-
"@itwin/core-
|
|
46
|
+
"@itwin/build-tools": "4.1.0-dev.66",
|
|
47
|
+
"@itwin/core-geometry": "4.1.0-dev.66",
|
|
48
|
+
"@itwin/core-bentley": "4.1.0-dev.66"
|
|
49
49
|
},
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|