@loaders.gl/potree 3.1.3 → 4.0.0-alpha.5

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.
Files changed (49) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/index.js +4 -9
  4. package/dist/index.js.map +1 -0
  5. package/dist/lib/octree.js +222 -191
  6. package/dist/lib/octree.js.map +1 -0
  7. package/dist/parsers/parse-potree-bin.js +3 -5
  8. package/dist/parsers/parse-potree-bin.js.map +1 -0
  9. package/dist/parsers/parse-potree-hierarchy-chunk.js +71 -117
  10. package/dist/parsers/parse-potree-hierarchy-chunk.js.map +1 -0
  11. package/dist/potree-bin-loader.js +14 -24
  12. package/dist/potree-bin-loader.js.map +1 -0
  13. package/dist/potree-hierarchy-chunk-loader.js +12 -20
  14. package/dist/potree-hierarchy-chunk-loader.js.map +1 -0
  15. package/dist/potree-loader.js +14 -20
  16. package/dist/potree-loader.js.map +1 -0
  17. package/package.json +5 -5
  18. package/dist/es5/bundle.js +0 -7
  19. package/dist/es5/bundle.js.map +0 -1
  20. package/dist/es5/index.js +0 -30
  21. package/dist/es5/index.js.map +0 -1
  22. package/dist/es5/lib/octree.js +0 -260
  23. package/dist/es5/lib/octree.js.map +0 -1
  24. package/dist/es5/parsers/parse-potree-bin.js +0 -11
  25. package/dist/es5/parsers/parse-potree-bin.js.map +0 -1
  26. package/dist/es5/parsers/parse-potree-hierarchy-chunk.js +0 -112
  27. package/dist/es5/parsers/parse-potree-hierarchy-chunk.js.map +0 -1
  28. package/dist/es5/potree-bin-loader.js +0 -28
  29. package/dist/es5/potree-bin-loader.js.map +0 -1
  30. package/dist/es5/potree-hierarchy-chunk-loader.js +0 -55
  31. package/dist/es5/potree-hierarchy-chunk-loader.js.map +0 -1
  32. package/dist/es5/potree-loader.js +0 -26
  33. package/dist/es5/potree-loader.js.map +0 -1
  34. package/dist/esm/bundle.js +0 -5
  35. package/dist/esm/bundle.js.map +0 -1
  36. package/dist/esm/index.js +0 -4
  37. package/dist/esm/index.js.map +0 -1
  38. package/dist/esm/lib/octree.js +0 -228
  39. package/dist/esm/lib/octree.js.map +0 -1
  40. package/dist/esm/parsers/parse-potree-bin.js +0 -4
  41. package/dist/esm/parsers/parse-potree-bin.js.map +0 -1
  42. package/dist/esm/parsers/parse-potree-hierarchy-chunk.js +0 -83
  43. package/dist/esm/parsers/parse-potree-hierarchy-chunk.js.map +0 -1
  44. package/dist/esm/potree-bin-loader.js +0 -17
  45. package/dist/esm/potree-bin-loader.js.map +0 -1
  46. package/dist/esm/potree-hierarchy-chunk-loader.js +0 -15
  47. package/dist/esm/potree-hierarchy-chunk-loader.js.map +0 -1
  48. package/dist/esm/potree-loader.js +0 -15
  49. package/dist/esm/potree-loader.js.map +0 -1
@@ -1,129 +1,83 @@
1
- "use strict";
2
- // This file is derived from the Cesium code base under BSD 2-clause license
3
- // See LICENSE.md and https://github.com/potree/potree/blob/develop/LICENSE
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- // Potree Hierarchy Chunk file format
6
- // https://github.com/potree/potree/blob/develop/docs/potree-file-format.md#index-files
7
- /*
8
- ### Hierarchy Chunk Files
9
-
10
- As mentioned in the former section, the `.hrc` files contain the index structure
11
- meaning a list of all the files stored within the directory tree.
12
-
13
- An index file contains a list of tuple values with the first being a `uint8`
14
- "mask" and the second being `uint32` "number of points" of a hierarchy level
15
- in a [breadth first level order][breadth-first].
16
-
17
- Per hierarchy level we have 8 possible nodes. To indicate whether a node exists
18
- a simple binary mask is used:
19
-
20
- | Position | Mask | [Binary][bin] |
21
- |----------|------|---------------|
22
- | 0 | 1 | 0b00000001 |
23
- | 1 | 2 | 0b00000010 |
24
- | 2 | 4 | 0b00000100 |
25
- | 3 | 8 | 0b00001000 |
26
- | 4 | 16 | 0b00010000 |
27
- | 5 | 32 | 0b00100000 |
28
- | 6 | 64 | 0b01000000 |
29
- | 7 | 128 | 0b10000000 |
1
+ export default function parsePotreeHierarchyChunk(arrayBuffer) {
2
+ const tileHeaders = parseBinaryChunk(arrayBuffer);
3
+ return buildHierarchy(tileHeaders);
4
+ }
30
5
 
31
- So if in a hierarchy the child node 3 and node 7 exist then the hierarchies
32
- mask has to be `0b00001000 | 0b10000000` → `0b10001000` (=136).
6
+ function parseBinaryChunk(arrayBuffer, byteOffset = 0) {
7
+ const dataView = new DataView(arrayBuffer);
8
+ const stack = [];
9
+ const topTileHeader = {};
10
+ byteOffset = decodeRow(dataView, byteOffset, topTileHeader);
11
+ stack.push(topTileHeader);
12
+ const tileHeaders = [];
33
13
 
34
- _Example:_ A simple, non-realistic tree:
14
+ while (stack.length > 0) {
15
+ const snode = stack.shift();
16
+ let mask = 1;
35
17
 
36
- ```
37
- |- r1
38
- | |
39
- | \- r14 (2 Points)
40
- |
41
- \- r3
42
- |
43
- \- r36 (1 Point)
44
- ```
18
+ for (let i = 0; i < 8; i++) {
19
+ if (snode && (snode.header.childMask & mask) !== 0) {
20
+ const tileHeader = {};
21
+ byteOffset = decodeRow(dataView, byteOffset, tileHeader);
22
+ tileHeader.name = snode.name + i;
23
+ stack.push(tileHeader);
24
+ tileHeaders.push(tileHeader);
25
+ snode.header.childCount++;
26
+ }
45
27
 
46
- Would have an index looking like this:
28
+ mask = mask * 2;
29
+ }
47
30
 
48
- | name | mask | points |
49
- |------|--------------------|--------|
50
- | r | `0b00001010` (=10) | `3` |
51
- | r1 | `0b00010000` (=16) | `2` |
52
- | r3 | `0b01000000` (=64) | `1` |
53
- | r14 | `0b00000000` (=0) | `2` |
54
- | r36 | `0b00000000` (=0) | `1` |
55
- */
56
- // @ts-nocheck
57
- // load hierarchy
58
- function parsePotreeHierarchyChunk(arrayBuffer) {
59
- const tileHeaders = parseBinaryChunk(arrayBuffer);
60
- return buildHierarchy(tileHeaders);
61
- }
62
- exports.default = parsePotreeHierarchyChunk;
63
- // Parses the binary rows
64
- function parseBinaryChunk(arrayBuffer, byteOffset = 0) {
65
- const dataView = new DataView(arrayBuffer);
66
- const stack = [];
67
- // Get root mask
68
- const topTileHeader = {};
69
- byteOffset = decodeRow(dataView, byteOffset, topTileHeader);
70
- stack.push(topTileHeader);
71
- const tileHeaders = [];
72
- while (stack.length > 0) {
73
- const snode = stack.shift();
74
- let mask = 1;
75
- for (let i = 0; i < 8; i++) {
76
- if (snode && (snode.header.childMask & mask) !== 0) {
77
- const tileHeader = {};
78
- byteOffset = decodeRow(dataView, byteOffset, tileHeader);
79
- tileHeader.name = snode.name + i;
80
- stack.push(tileHeader);
81
- tileHeaders.push(tileHeader);
82
- snode.header.childCount++;
83
- }
84
- mask = mask * 2;
85
- }
86
- if (byteOffset === dataView.byteLength) {
87
- break;
88
- }
31
+ if (byteOffset === dataView.byteLength) {
32
+ break;
89
33
  }
90
- return tileHeaders;
34
+ }
35
+
36
+ return tileHeaders;
91
37
  }
38
+
92
39
  function decodeRow(dataView, byteOffset, tileHeader) {
93
- tileHeader.header = tileHeader.header || {};
94
- tileHeader.header.childMask = dataView.getUint8(byteOffset);
95
- tileHeader.header.childCount = 0;
96
- tileHeader.pointCount = dataView.getUint32(byteOffset + 1, true);
97
- tileHeader.name = '';
98
- byteOffset += 5;
99
- return byteOffset;
40
+ tileHeader.header = tileHeader.header || {};
41
+ tileHeader.header.childMask = dataView.getUint8(byteOffset);
42
+ tileHeader.header.childCount = 0;
43
+ tileHeader.pointCount = dataView.getUint32(byteOffset + 1, true);
44
+ tileHeader.name = '';
45
+ byteOffset += 5;
46
+ return byteOffset;
100
47
  }
101
- // Resolves the binary rows into a hierarchy (tree structure)
48
+
102
49
  function buildHierarchy(tileHeaders, options = {}) {
103
- const DEFAULT_OPTIONS = { spacing: 100 }; // TODO assert instead of default?
104
- options = { ...DEFAULT_OPTIONS, ...options };
105
- const topNode = tileHeaders[0];
106
- const nodes = {};
107
- for (const tileHeader of tileHeaders) {
108
- const { name } = tileHeader;
109
- const index = parseInt(name.charAt(name.length - 1), 10);
110
- const parentName = name.substring(0, name.length - 1);
111
- const parentNode = nodes[parentName];
112
- const level = name.length - 1;
113
- // assert(parentNode && level >= 0);
114
- tileHeader.level = level;
115
- tileHeader.hasChildren = tileHeader.header.childCount;
116
- tileHeader.children = [];
117
- tileHeader.childrenByIndex = new Array(8).fill(null);
118
- tileHeader.spacing = options.spacing / Math.pow(2, level);
119
- // tileHeader.boundingVolume = Utils.createChildAABB(parentNode.boundingBox, index);
120
- if (parentNode) {
121
- parentNode.children.push(tileHeader);
122
- parentNode.childrenByIndex[index] = tileHeader;
123
- }
124
- // Add the node to the map
125
- nodes[name] = tileHeader;
50
+ const DEFAULT_OPTIONS = {
51
+ spacing: 100
52
+ };
53
+ options = { ...DEFAULT_OPTIONS,
54
+ ...options
55
+ };
56
+ const topNode = tileHeaders[0];
57
+ const nodes = {};
58
+
59
+ for (const tileHeader of tileHeaders) {
60
+ const {
61
+ name
62
+ } = tileHeader;
63
+ const index = parseInt(name.charAt(name.length - 1), 10);
64
+ const parentName = name.substring(0, name.length - 1);
65
+ const parentNode = nodes[parentName];
66
+ const level = name.length - 1;
67
+ tileHeader.level = level;
68
+ tileHeader.hasChildren = tileHeader.header.childCount;
69
+ tileHeader.children = [];
70
+ tileHeader.childrenByIndex = new Array(8).fill(null);
71
+ tileHeader.spacing = options.spacing / Math.pow(2, level);
72
+
73
+ if (parentNode) {
74
+ parentNode.children.push(tileHeader);
75
+ parentNode.childrenByIndex[index] = tileHeader;
126
76
  }
127
- // First node is the root
128
- return topNode;
77
+
78
+ nodes[name] = tileHeader;
79
+ }
80
+
81
+ return topNode;
129
82
  }
83
+ //# sourceMappingURL=parse-potree-hierarchy-chunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/parsers/parse-potree-hierarchy-chunk.ts"],"names":["parsePotreeHierarchyChunk","arrayBuffer","tileHeaders","parseBinaryChunk","buildHierarchy","byteOffset","dataView","DataView","stack","topTileHeader","decodeRow","push","length","snode","shift","mask","i","header","childMask","tileHeader","name","childCount","byteLength","getUint8","pointCount","getUint32","options","DEFAULT_OPTIONS","spacing","topNode","nodes","index","parseInt","charAt","parentName","substring","parentNode","level","hasChildren","children","childrenByIndex","Array","fill","Math","pow"],"mappings":"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","sourcesContent":["// This file is derived from the Cesium code base under BSD 2-clause license\n// See LICENSE.md and https://github.com/potree/potree/blob/develop/LICENSE\n\n// Potree Hierarchy Chunk file format\n// https://github.com/potree/potree/blob/develop/docs/potree-file-format.md#index-files\n\n/*\n### Hierarchy Chunk Files\n\nAs mentioned in the former section, the `.hrc` files contain the index structure\nmeaning a list of all the files stored within the directory tree.\n\nAn index file contains a list of tuple values with the first being a `uint8`\n\"mask\" and the second being `uint32` \"number of points\" of a hierarchy level\nin a [breadth first level order][breadth-first].\n\nPer hierarchy level we have 8 possible nodes. To indicate whether a node exists\na simple binary mask is used:\n\n| Position | Mask | [Binary][bin] |\n|----------|------|---------------|\n| 0 | 1 | 0b00000001 |\n| 1 | 2 | 0b00000010 |\n| 2 | 4 | 0b00000100 |\n| 3 | 8 | 0b00001000 |\n| 4 | 16 | 0b00010000 |\n| 5 | 32 | 0b00100000 |\n| 6 | 64 | 0b01000000 |\n| 7 | 128 | 0b10000000 |\n\nSo if in a hierarchy the child node 3 and node 7 exist then the hierarchies\nmask has to be `0b00001000 | 0b10000000` → `0b10001000` (=136).\n\n_Example:_ A simple, non-realistic tree:\n\n```\n|- r1\n| |\n| \\- r14 (2 Points)\n|\n\\- r3\n |\n \\- r36 (1 Point)\n```\n\nWould have an index looking like this:\n\n| name | mask | points |\n|------|--------------------|--------|\n| r | `0b00001010` (=10) | `3` |\n| r1 | `0b00010000` (=16) | `2` |\n| r3 | `0b01000000` (=64) | `1` |\n| r14 | `0b00000000` (=0) | `2` |\n| r36 | `0b00000000` (=0) | `1` |\n*/\n\n// @ts-nocheck\n\n// load hierarchy\nexport default function parsePotreeHierarchyChunk(arrayBuffer: ArrayBuffer) {\n const tileHeaders = parseBinaryChunk(arrayBuffer);\n return buildHierarchy(tileHeaders);\n}\n\n// Parses the binary rows\nfunction parseBinaryChunk(arrayBuffer: ArrayBuffer, byteOffset = 0) {\n const dataView = new DataView(arrayBuffer);\n\n const stack = [];\n\n // Get root mask\n const topTileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, topTileHeader);\n\n stack.push(topTileHeader);\n\n const tileHeaders = [];\n\n while (stack.length > 0) {\n const snode = stack.shift();\n let mask = 1;\n\n for (let i = 0; i < 8; i++) {\n if (snode && (snode.header.childMask & mask) !== 0) {\n const tileHeader = {};\n byteOffset = decodeRow(dataView, byteOffset, tileHeader);\n tileHeader.name = snode.name + i;\n\n stack.push(tileHeader);\n tileHeaders.push(tileHeader);\n snode.header.childCount++;\n }\n mask = mask * 2;\n }\n\n if (byteOffset === dataView.byteLength) {\n break;\n }\n }\n\n return tileHeaders;\n}\n\nfunction decodeRow(dataView, byteOffset, tileHeader) {\n tileHeader.header = tileHeader.header || {};\n tileHeader.header.childMask = dataView.getUint8(byteOffset);\n tileHeader.header.childCount = 0;\n tileHeader.pointCount = dataView.getUint32(byteOffset + 1, true);\n tileHeader.name = '';\n byteOffset += 5;\n return byteOffset;\n}\n\n// Resolves the binary rows into a hierarchy (tree structure)\nfunction buildHierarchy(tileHeaders, options = {}) {\n const DEFAULT_OPTIONS = {spacing: 100}; // TODO assert instead of default?\n options = {...DEFAULT_OPTIONS, ...options};\n\n const topNode = tileHeaders[0];\n const nodes = {};\n\n for (const tileHeader of tileHeaders) {\n const {name} = tileHeader;\n\n const index = parseInt(name.charAt(name.length - 1), 10);\n const parentName = name.substring(0, name.length - 1);\n const parentNode = nodes[parentName];\n const level = name.length - 1;\n // assert(parentNode && level >= 0);\n\n tileHeader.level = level;\n tileHeader.hasChildren = tileHeader.header.childCount;\n tileHeader.children = [];\n tileHeader.childrenByIndex = new Array(8).fill(null);\n tileHeader.spacing = options.spacing / Math.pow(2, level);\n // tileHeader.boundingVolume = Utils.createChildAABB(parentNode.boundingBox, index);\n\n if (parentNode) {\n parentNode.children.push(tileHeader);\n parentNode.childrenByIndex[index] = tileHeader;\n }\n\n // Add the node to the map\n nodes[name] = tileHeader;\n }\n\n // First node is the root\n return topNode;\n}\n"],"file":"parse-potree-hierarchy-chunk.js"}
@@ -1,27 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PotreeBinLoader = void 0;
7
- const parse_potree_bin_1 = __importDefault(require("./parsers/parse-potree-bin"));
8
- /**
9
- * Loader for potree Binary Point Attributes
10
- * */
11
- // @ts-ignore
12
- exports.PotreeBinLoader = {
13
- name: 'potree Binary Point Attributes',
14
- id: 'potree',
15
- extensions: ['bin'],
16
- mimeTypes: ['application/octet-stream'],
17
- // Unfortunately binary potree files have no header bytes, no test possible
18
- // test: ['...'],
19
- parseSync,
20
- binary: true
1
+ import { default as parsePotreeBin } from './parsers/parse-potree-bin';
2
+ export const PotreeBinLoader = {
3
+ name: 'potree Binary Point Attributes',
4
+ id: 'potree',
5
+ extensions: ['bin'],
6
+ mimeTypes: ['application/octet-stream'],
7
+ parseSync,
8
+ binary: true
21
9
  };
10
+
22
11
  function parseSync(arrayBuffer, options) {
23
- const index = {};
24
- const byteOffset = 0;
25
- (0, parse_potree_bin_1.default)(arrayBuffer, byteOffset, options, index);
26
- return index;
12
+ const index = {};
13
+ const byteOffset = 0;
14
+ parsePotreeBin(arrayBuffer, byteOffset, options, index);
15
+ return index;
27
16
  }
17
+ //# sourceMappingURL=potree-bin-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/potree-bin-loader.ts"],"names":["default","parsePotreeBin","PotreeBinLoader","name","id","extensions","mimeTypes","parseSync","binary","arrayBuffer","options","index","byteOffset"],"mappings":"AACA,SAAQA,OAAO,IAAIC,cAAnB,QAAwC,4BAAxC;AAMA,OAAO,MAAMC,eAAiC,GAAG;AAC/CC,EAAAA,IAAI,EAAE,gCADyC;AAE/CC,EAAAA,EAAE,EAAE,QAF2C;AAG/CC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAHmC;AAI/CC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAJoC;AAO/CC,EAAAA,SAP+C;AAQ/CC,EAAAA,MAAM,EAAE;AARuC,CAA1C;;AAWP,SAASD,SAAT,CAAmBE,WAAnB,EAA6CC,OAA7C,EAAsE;AACpE,QAAMC,KAAK,GAAG,EAAd;AACA,QAAMC,UAAU,GAAG,CAAnB;AACAX,EAAAA,cAAc,CAACQ,WAAD,EAAcG,UAAd,EAA0BF,OAA1B,EAAmCC,KAAnC,CAAd;AACA,SAAOA,KAAP;AACD","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport {default as parsePotreeBin} from './parsers/parse-potree-bin';\n\n/**\n * Loader for potree Binary Point Attributes\n * */\n// @ts-ignore\nexport const PotreeBinLoader: LoaderWithParser = {\n name: 'potree Binary Point Attributes',\n id: 'potree',\n extensions: ['bin'],\n mimeTypes: ['application/octet-stream'],\n // Unfortunately binary potree files have no header bytes, no test possible\n // test: ['...'],\n parseSync,\n binary: true\n};\n\nfunction parseSync(arrayBuffer: ArrayBuffer, options?: LoaderOptions) {\n const index = {};\n const byteOffset = 0;\n parsePotreeBin(arrayBuffer, byteOffset, options, index);\n return index;\n}\n"],"file":"potree-bin-loader.js"}
@@ -1,23 +1,15 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PotreeHierarchyChunkLoader = void 0;
7
- const parse_potree_hierarchy_chunk_1 = __importDefault(require("./parsers/parse-potree-hierarchy-chunk"));
8
- /** Potree hierarchy chunk loader */
9
- // @ts-ignore
10
- exports.PotreeHierarchyChunkLoader = {
11
- id: 'potree',
12
- name: 'potree Hierarchy Chunk',
13
- extensions: ['hrc'],
14
- mimeTypes: ['application/octet-stream'],
15
- // binary potree files have no header bytes, no content test function possible
16
- // test: ['...'],
17
- parse: async (arrayBuffer, options) => await parseSync(arrayBuffer),
18
- parseSync,
19
- binary: true
1
+ import { default as parsePotreeHierarchyChunk } from './parsers/parse-potree-hierarchy-chunk';
2
+ export const PotreeHierarchyChunkLoader = {
3
+ id: 'potree',
4
+ name: 'potree Hierarchy Chunk',
5
+ extensions: ['hrc'],
6
+ mimeTypes: ['application/octet-stream'],
7
+ parse: async (arrayBuffer, options) => await parseSync(arrayBuffer),
8
+ parseSync,
9
+ binary: true
20
10
  };
11
+
21
12
  function parseSync(arrayBuffer) {
22
- return (0, parse_potree_hierarchy_chunk_1.default)(arrayBuffer);
13
+ return parsePotreeHierarchyChunk(arrayBuffer);
23
14
  }
15
+ //# sourceMappingURL=potree-hierarchy-chunk-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/potree-hierarchy-chunk-loader.ts"],"names":["default","parsePotreeHierarchyChunk","PotreeHierarchyChunkLoader","id","name","extensions","mimeTypes","parse","arrayBuffer","options","parseSync","binary"],"mappings":"AACA,SAAQA,OAAO,IAAIC,yBAAnB,QAAmD,wCAAnD;AAIA,OAAO,MAAMC,0BAA4C,GAAG;AAC1DC,EAAAA,EAAE,EAAE,QADsD;AAE1DC,EAAAA,IAAI,EAAE,wBAFoD;AAG1DC,EAAAA,UAAU,EAAE,CAAC,KAAD,CAH8C;AAI1DC,EAAAA,SAAS,EAAE,CAAC,0BAAD,CAJ+C;AAO1DC,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBC,OAApB,KAAgC,MAAMC,SAAS,CAACF,WAAD,CAPI;AAQ1DE,EAAAA,SAR0D;AAS1DC,EAAAA,MAAM,EAAE;AATkD,CAArD;;AAYP,SAASD,SAAT,CAAmBF,WAAnB,EAAgC;AAC9B,SAAOP,yBAAyB,CAACO,WAAD,CAAhC;AACD","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\nimport {default as parsePotreeHierarchyChunk} from './parsers/parse-potree-hierarchy-chunk';\n\n/** Potree hierarchy chunk loader */\n// @ts-ignore\nexport const PotreeHierarchyChunkLoader: LoaderWithParser = {\n id: 'potree',\n name: 'potree Hierarchy Chunk',\n extensions: ['hrc'],\n mimeTypes: ['application/octet-stream'],\n // binary potree files have no header bytes, no content test function possible\n // test: ['...'],\n parse: async (arrayBuffer, options) => await parseSync(arrayBuffer),\n parseSync,\n binary: true\n};\n\nfunction parseSync(arrayBuffer) {\n return parsePotreeHierarchyChunk(arrayBuffer);\n}\n"],"file":"potree-hierarchy-chunk-loader.js"}
@@ -1,21 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PotreeLoader = void 0;
4
- // __VERSION__ is injected by babel-plugin-version-inline
5
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
7
- /** Potree loader */
8
- // @ts-ignore
9
- exports.PotreeLoader = {
10
- name: 'potree',
11
- id: 'potree',
12
- module: 'potree',
13
- version: VERSION,
14
- extensions: ['json'],
15
- mimeTypes: ['application/json'],
16
- testText: (text) => text.indexOf('octreeDir') >= 0,
17
- parseTextSync: (text) => JSON.parse(text),
18
- options: {
19
- potree: {}
20
- }
1
+ const VERSION = typeof "4.0.0-alpha.5" !== 'undefined' ? "4.0.0-alpha.5" : 'latest';
2
+ export const PotreeLoader = {
3
+ name: 'potree',
4
+ id: 'potree',
5
+ module: 'potree',
6
+ version: VERSION,
7
+ extensions: ['json'],
8
+ mimeTypes: ['application/json'],
9
+ testText: text => text.indexOf('octreeDir') >= 0,
10
+ parseTextSync: text => JSON.parse(text),
11
+ options: {
12
+ potree: {}
13
+ }
21
14
  };
15
+ //# sourceMappingURL=potree-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/potree-loader.ts"],"names":["VERSION","PotreeLoader","name","id","module","version","extensions","mimeTypes","testText","text","indexOf","parseTextSync","JSON","parse","options","potree"],"mappings":"AAIA,MAAMA,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAIA,OAAO,MAAMC,YAA8B,GAAG;AAC5CC,EAAAA,IAAI,EAAE,QADsC;AAE5CC,EAAAA,EAAE,EAAE,QAFwC;AAG5CC,EAAAA,MAAM,EAAE,QAHoC;AAI5CC,EAAAA,OAAO,EAAEL,OAJmC;AAK5CM,EAAAA,UAAU,EAAE,CAAC,MAAD,CALgC;AAM5CC,EAAAA,SAAS,EAAE,CAAC,kBAAD,CANiC;AAO5CC,EAAAA,QAAQ,EAAGC,IAAD,IAAUA,IAAI,CAACC,OAAL,CAAa,WAAb,KAA6B,CAPL;AAQ5CC,EAAAA,aAAa,EAAGF,IAAD,IAAUG,IAAI,CAACC,KAAL,CAAWJ,IAAX,CARmB;AAS5CK,EAAAA,OAAO,EAAE;AACPC,IAAAA,MAAM,EAAE;AADD;AATmC,CAAvC","sourcesContent":["import type {LoaderWithParser} from '@loaders.gl/loader-utils';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Potree loader */\n// @ts-ignore\nexport const PotreeLoader: LoaderWithParser = {\n name: 'potree',\n id: 'potree',\n module: 'potree',\n version: VERSION,\n extensions: ['json'],\n mimeTypes: ['application/json'],\n testText: (text) => text.indexOf('octreeDir') >= 0,\n parseTextSync: (text) => JSON.parse(text),\n options: {\n potree: {}\n }\n};\n"],"file":"potree-loader.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/potree",
3
- "version": "3.1.3",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "potree loaders for large point clouds.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -22,8 +22,8 @@
22
22
  "pointcloud"
23
23
  ],
24
24
  "types": "dist/index.d.ts",
25
- "main": "dist/es5/index.js",
26
- "module": "dist/esm/index.js",
25
+ "main": "dist/index.js",
26
+ "module": "dist/index.js",
27
27
  "sideEffects": false,
28
28
  "files": [
29
29
  "src",
@@ -35,8 +35,8 @@
35
35
  "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
36
36
  },
37
37
  "dependencies": {
38
- "@loaders.gl/math": "3.1.3",
38
+ "@loaders.gl/math": "4.0.0-alpha.5",
39
39
  "@math.gl/core": "^3.5.1"
40
40
  },
41
- "gitHead": "4a690c369779346d73c9a27395d1c08d77d279a4"
41
+ "gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
42
42
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- var moduleExports = require('./index');
4
-
5
- globalThis.loaders = globalThis.loaders || {};
6
- module.exports = Object.assign(globalThis.loaders, moduleExports);
7
- //# sourceMappingURL=bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
package/dist/es5/index.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PotreeLoader", {
7
- enumerable: true,
8
- get: function get() {
9
- return _potreeLoader.PotreeLoader;
10
- }
11
- });
12
- Object.defineProperty(exports, "PotreeHierarchyChunkLoader", {
13
- enumerable: true,
14
- get: function get() {
15
- return _potreeHierarchyChunkLoader.PotreeHierarchyChunkLoader;
16
- }
17
- });
18
- Object.defineProperty(exports, "PotreeBinLoader", {
19
- enumerable: true,
20
- get: function get() {
21
- return _potreeBinLoader.PotreeBinLoader;
22
- }
23
- });
24
-
25
- var _potreeLoader = require("./potree-loader");
26
-
27
- var _potreeHierarchyChunkLoader = require("./potree-hierarchy-chunk-loader");
28
-
29
- var _potreeBinLoader = require("./potree-bin-loader");
30
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["export {PotreeLoader} from './potree-loader';\nexport {PotreeHierarchyChunkLoader} from './potree-hierarchy-chunk-loader';\nexport {PotreeBinLoader} from './potree-bin-loader';\n"],"file":"index.js"}