@ridp/threejs 0.2.0 → 1.1.0

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 (82) hide show
  1. package/dist/ImageLoader-CB_URfeZ.js +860 -0
  2. package/dist/ImageLoader-DwvBWW6h.cjs +5 -0
  3. package/dist/common-BHi3qsZW.cjs +15 -0
  4. package/dist/{common-DESmndxO.js → common-fbJUHqlj.js} +1 -1
  5. package/dist/hooks.cjs +1 -1
  6. package/dist/hooks.js +7 -9
  7. package/dist/threejs.cjs +1 -1
  8. package/dist/threejs.js +17 -15
  9. package/dist/useGLTFLoader-DHxBLucO.js +5629 -0
  10. package/dist/useGLTFLoader-DM3-7jdq.cjs +4 -0
  11. package/dist/utils.cjs +1 -1
  12. package/dist/utils.js +15 -12
  13. package/esdoc/ast/source/.external-ecmascript.js.json +2802 -0
  14. package/esdoc/ast/source/hooks/index.js.json +739 -0
  15. package/esdoc/ast/source/hooks/useGLTFLoader.js.json +9111 -0
  16. package/esdoc/ast/source/hooks/useObb.js.json +16463 -0
  17. package/esdoc/ast/source/hooks/useRaycaster.js.json +15556 -0
  18. package/esdoc/ast/source/hooks/useThreeJs.js.json +52887 -0
  19. package/esdoc/ast/source/index.js.json +570 -0
  20. package/esdoc/ast/source/instance/IDBCache.js.json +40978 -0
  21. package/esdoc/ast/source/instance/index.js.json +232 -0
  22. package/esdoc/ast/source/utils/ImageLoader.js.json +7037 -0
  23. package/esdoc/ast/source/utils/common.js.json +5134 -0
  24. package/esdoc/ast/source/utils/css3dHelper.js.json +9101 -0
  25. package/esdoc/ast/source/utils/disposeObject.js.json +5978 -0
  26. package/esdoc/ast/source/utils/helper.js.json +10522 -0
  27. package/esdoc/ast/source/utils/index.js.json +908 -0
  28. package/esdoc/badge.svg +17 -0
  29. package/esdoc/class/src/instance/IDBCache.js~IDBCache.html +1299 -0
  30. package/esdoc/coverage.json +86 -0
  31. package/esdoc/css/github.css +83 -0
  32. package/esdoc/css/identifiers.css +37 -0
  33. package/esdoc/css/manual.css +134 -0
  34. package/esdoc/css/prettify-tomorrow.css +132 -0
  35. package/esdoc/css/search.css +84 -0
  36. package/esdoc/css/source.css +55 -0
  37. package/esdoc/css/style.css +608 -0
  38. package/esdoc/css/test.css +58 -0
  39. package/esdoc/file/src/hooks/index.js.html +79 -0
  40. package/esdoc/file/src/hooks/useGLTFLoader.js.html +146 -0
  41. package/esdoc/file/src/hooks/useObb.js.html +149 -0
  42. package/esdoc/file/src/hooks/useRaycaster.js.html +153 -0
  43. package/esdoc/file/src/hooks/useThreeJs.js.html +362 -0
  44. package/esdoc/file/src/index.js.html +78 -0
  45. package/esdoc/file/src/instance/IDBCache.js.html +312 -0
  46. package/esdoc/file/src/instance/index.js.html +76 -0
  47. package/esdoc/file/src/utils/ImageLoader.js.html +118 -0
  48. package/esdoc/file/src/utils/common.js.html +102 -0
  49. package/esdoc/file/src/utils/css3dHelper.js.html +131 -0
  50. package/esdoc/file/src/utils/disposeObject.js.html +114 -0
  51. package/esdoc/file/src/utils/helper.js.html +138 -0
  52. package/esdoc/file/src/utils/index.js.html +80 -0
  53. package/esdoc/function/index.html +2019 -0
  54. package/esdoc/identifiers.html +738 -0
  55. package/esdoc/image/badge.svg +17 -0
  56. package/esdoc/image/esdoc-logo-mini-black.png +0 -0
  57. package/esdoc/image/esdoc-logo-mini.png +0 -0
  58. package/esdoc/image/manual-badge.svg +17 -0
  59. package/esdoc/image/search.png +0 -0
  60. package/esdoc/index.html +153 -0
  61. package/esdoc/index.json +2051 -0
  62. package/esdoc/inject/css/0-cus-style.css +1 -0
  63. package/esdoc/lint.json +1 -0
  64. package/esdoc/script/inherited-summary.js +28 -0
  65. package/esdoc/script/inner-link.js +32 -0
  66. package/esdoc/script/manual.js +12 -0
  67. package/esdoc/script/patch-for-local.js +8 -0
  68. package/esdoc/script/prettify/Apache-License-2.0.txt +202 -0
  69. package/esdoc/script/prettify/prettify.js +46 -0
  70. package/esdoc/script/pretty-print.js +25 -0
  71. package/esdoc/script/search.js +117 -0
  72. package/esdoc/script/search_index.js +572 -0
  73. package/esdoc/script/test-summary.js +54 -0
  74. package/esdoc/source.html +213 -0
  75. package/esdoc/variable/index.html +225 -0
  76. package/package.json +13 -3
  77. package/readme.md +93 -0
  78. package/dist/common-nMt4tIRA.cjs +0 -15
  79. package/dist/disposeObject-BuI3II7v.cjs +0 -1
  80. package/dist/disposeObject-CmFSSgi7.js +0 -616
  81. package/dist/useGLTFLoader-BAoIZjEX.js +0 -2645
  82. package/dist/useGLTFLoader-CGOxhEOO.cjs +0 -6
@@ -0,0 +1,312 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <base data-ice="baseUrl" href="../../../">
6
+ <title data-ice="title">src/instance/IDBCache.js | @ridp/threejs</title>
7
+ <link type="text/css" rel="stylesheet" href="css/style.css">
8
+ <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
9
+ <script src="script/prettify/prettify.js"></script>
10
+ <script src="script/manual.js"></script>
11
+ <link rel="stylesheet" href="./inject/css/0-cus-style.css"></head>
12
+ <body class="layout-container" data-ice="rootContainer">
13
+
14
+ <header>
15
+ <a href="./">Home</a>
16
+
17
+ <a href="identifiers.html">Reference</a>
18
+ <a href="source.html">Source</a>
19
+
20
+ <div class="search-box">
21
+ <span>
22
+ <img src="./image/search.png">
23
+ <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
24
+ </span>
25
+ <ul class="search-result"></ul>
26
+ </div>
27
+ </header>
28
+
29
+ <nav class="navigation" data-ice="nav"><div>
30
+ <ul>
31
+
32
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#hooks">hooks</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useGLTFLoader">useGLTFLoader</a></span></span></li>
33
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useObb">useObb</a></span></span></li>
34
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useRaycaster">useRaycaster</a></span></span></li>
35
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useThreeJs">useThreeJs</a></span></span></li>
36
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-intersectColor">intersectColor</a></span></span></li>
37
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-obbObjects">obbObjects</a></span></span></li>
38
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#instance">instance</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/instance/IDBCache.js~IDBCache.html">IDBCache</a></span></span></li>
39
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#utils">utils</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ImageLoader">ImageLoader</a></span></span></li>
40
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-initEnvImage">initEnvImage</a></span></span></li>
41
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getCommonParent">getCommonParent</a></span></span></li>
42
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createInfoPlane">createInfoPlane</a></span></span></li>
43
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createTagPlane">createTagPlane</a></span></span></li>
44
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-disposeThreeObject">disposeThreeObject</a></span></span></li>
45
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createArrowHelper">createArrowHelper</a></span></span></li>
46
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createAxesHelper">createAxesHelper</a></span></span></li>
47
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createBox3Helper">createBox3Helper</a></span></span></li>
48
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createCameraHelper">createCameraHelper</a></span></span></li>
49
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createGridHelper">createGridHelper</a></span></span></li>
50
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createMapControls">createMapControls</a></span></span></li>
51
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createOrbitControl">createOrbitControl</a></span></span></li>
52
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createRaycaster">createRaycaster</a></span></span></li>
53
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createStats">createStats</a></span></span></li>
54
+ </ul>
55
+ </div>
56
+ </nav>
57
+
58
+ <div class="content" data-ice="content"><h1 data-ice="title">src/instance/IDBCache.js</h1>
59
+ <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import * as THREE from &quot;three&quot;;
60
+ import Dexie from &quot;dexie&quot;;
61
+
62
+ /**
63
+ * ThreeJS &#x7F13;&#x5B58;&#x5DE5;&#x5177;&#x7C7B;
64
+ */
65
+ export class IDBCache {
66
+ /**
67
+ * &#x6784;&#x9020;&#x51FD;&#x6570;
68
+ * @param {string} dbName - &#x6570;&#x636E;&#x5E93;&#x540D;&#x79F0;
69
+ * @param {Object} tableDefinitions - &#x8868;&#x5B9A;&#x4E49;&#x5BF9;&#x8C61;&#xFF0C;&#x4F8B;&#x5982; { models: &quot;&amp;path, data&quot; }
70
+ * @param {number} version - &#x6570;&#x636E;&#x5E93;&#x7248;&#x672C;&#x53F7;
71
+ */
72
+ constructor(dbName = &quot;threeJsIDBCache&quot;, version = 1) {
73
+ this.db = new Dexie(dbName);
74
+ this.materialMap = {};
75
+
76
+ // &#x521D;&#x59CB;&#x5316;&#x6570;&#x636E;&#x5E93;&#x7248;&#x672C;&#x548C;&#x8868;
77
+ this.db.version(version).stores({ models: &quot;&amp;path, data&quot; });
78
+ }
79
+
80
+ /**
81
+ * &#x83B7;&#x53D6; Dexie &#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B;
82
+ * @returns {Dexie} Dexie &#x5B9E;&#x4F8B;
83
+ */
84
+ getDatabase() {
85
+ return this.db;
86
+ }
87
+
88
+ /**
89
+ * &#x5E8F;&#x5217;&#x5316; Three.js &#x5BF9;&#x8C61;
90
+ * @param {THREE.Object3D} object - &#x8981;&#x5E8F;&#x5217;&#x5316;&#x7684;&#x5BF9;&#x8C61;
91
+ * @returns {Object} &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x6570;&#x636E;
92
+ */
93
+ serObject3D(object) {
94
+ const serialized = {
95
+ type: object.type,
96
+ name: object.name,
97
+ position: object.position.toArray(),
98
+ rotation: object.rotation.toArray(),
99
+ scale: object.scale.toArray(),
100
+ visible: object.visible,
101
+ children: [],
102
+ geometry: null,
103
+ material: null,
104
+ };
105
+
106
+ if (object.isMesh) {
107
+ serialized.geometry = this.serGeometry(object.geometry);
108
+ serialized.material = this.serMaterial(object.material);
109
+ }
110
+
111
+ for (const child of object.children) {
112
+ serialized.children.push(this.serObject3D(child));
113
+ }
114
+
115
+ return serialized;
116
+ }
117
+
118
+ /**
119
+ * &#x5E8F;&#x5217;&#x5316;&#x51E0;&#x4F55;&#x4F53;
120
+ * @param {THREE.BufferGeometry} geometry - &#x51E0;&#x4F55;&#x4F53;
121
+ * @returns {Object} &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x51E0;&#x4F55;&#x4F53;&#x6570;&#x636E;
122
+ */
123
+ serGeometry(geometry) {
124
+ const _attributes = [];
125
+ const { attributes, index, type } = geometry;
126
+
127
+ if (attributes.position)
128
+ _attributes[&quot;position&quot;] = {
129
+ type: &quot;Float32Array&quot;,
130
+ array: Array.from(attributes.position.array),
131
+ itemSize: 3,
132
+ };
133
+ if (attributes.normal)
134
+ _attributes[&quot;normal&quot;] = {
135
+ type: &quot;Float32Array&quot;,
136
+ array: Array.from(attributes.normal.array),
137
+ itemSize: 3,
138
+ };
139
+ if (attributes.uv)
140
+ _attributes[&quot;uv&quot;] = {
141
+ type: &quot;Float32Array&quot;,
142
+ array: Array.from(attributes.uv.array),
143
+ itemSize: 2,
144
+ };
145
+
146
+ const result = {
147
+ type: type,
148
+ attributes: _attributes,
149
+ };
150
+
151
+ if (index &amp;&amp; index.array) {
152
+ result[&quot;index&quot;] = {
153
+ type: &quot;Uint32Array&quot;,
154
+ array: Array.from(index.array),
155
+ itemSize: 1,
156
+ };
157
+ }
158
+
159
+ return result;
160
+ }
161
+
162
+ /**
163
+ * &#x53CD;&#x5E8F;&#x5217;&#x5316;&#x51E0;&#x4F55;&#x4F53;
164
+ * @param {Object} data - &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x51E0;&#x4F55;&#x4F53;&#x6570;&#x636E;
165
+ * @returns {THREE.BufferGeometry} &#x53CD;&#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x51E0;&#x4F55;&#x4F53;
166
+ */
167
+ reSerGeometry(data) {
168
+ const { type, attributes, index } = data;
169
+ const geometry = new THREE.BufferGeometry();
170
+ Object.keys(attributes).forEach((key) =&gt; {
171
+ const { type, array, itemSize } = attributes[key];
172
+ geometry.setAttribute(
173
+ key,
174
+ new THREE.BufferAttribute(new Float32Array(array), itemSize)
175
+ );
176
+ });
177
+
178
+ if (index) {
179
+ geometry.setIndex(index.array);
180
+ }
181
+ return geometry;
182
+ }
183
+
184
+ /**
185
+ * &#x5E8F;&#x5217;&#x5316;&#x6750;&#x8D28;
186
+ * @param {THREE.Material} material - &#x6750;&#x8D28;
187
+ * @returns {Object} &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x6750;&#x8D28;&#x6570;&#x636E;
188
+ */
189
+ serMaterial(material) {
190
+ return {
191
+ type: material.type,
192
+ color: material.color.getHex(),
193
+ map: material.map ? material.map.image.src : null,
194
+ opacity: material.opacity,
195
+ name: material.name,
196
+ depthTest: material.depthTest,
197
+ depthWrite: material.depthWrite,
198
+ transparent: material.transparent,
199
+ side: material.side,
200
+ roughness: material.roughness,
201
+ metalness: material.metalness,
202
+ emissive: material.emissive.getHex(),
203
+ };
204
+ }
205
+
206
+ /**
207
+ * &#x53CD;&#x5E8F;&#x5217;&#x5316;&#x6750;&#x8D28;
208
+ * @param {Object} data - &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x6750;&#x8D28;&#x6570;&#x636E;
209
+ * @returns {THREE.Material} &#x53CD;&#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x6750;&#x8D28;
210
+ */
211
+ reSerMaterial(data) {
212
+ // &#x540C;&#x540D;&#x6750;&#x8D28;&#x590D;&#x7528;
213
+ if (this.materialMap[data.name]) return this.materialMap[data.name];
214
+ const { type, ...rest } = data;
215
+
216
+ const materialType = type || &quot;MeshStandardMaterial&quot;;
217
+ const material = new THREE[materialType]({ ...rest });
218
+ if (data.map) {
219
+ const texture = new THREE.TextureLoader().load(data.map);
220
+ material.map = texture;
221
+ }
222
+ material.needsUpdate = true;
223
+
224
+ this.materialMap[data.name] = material;
225
+ return material;
226
+ }
227
+
228
+ /**
229
+ * &#x53CD;&#x5E8F;&#x5217;&#x5316; Three.js &#x5BF9;&#x8C61;
230
+ * @param {Object} data - &#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x6570;&#x636E;
231
+ * @returns {THREE.Object3D} &#x53CD;&#x5E8F;&#x5217;&#x5316;&#x540E;&#x7684;&#x5BF9;&#x8C61;
232
+ */
233
+ reSerObject3D(data) {
234
+ let object;
235
+
236
+ switch (data.type) {
237
+ case &quot;Mesh&quot;:
238
+ const geometry = this.reSerGeometry(data.geometry);
239
+ const material = this.reSerMaterial(data.material);
240
+ object = new THREE.Mesh(geometry, material);
241
+ break;
242
+ case &quot;Group&quot;:
243
+ object = new THREE.Group();
244
+ break;
245
+ case &quot;Object3D&quot;:
246
+ object = new THREE.Object3D();
247
+ break;
248
+ default:
249
+ console.warn(`Unsupported object type: ${data.type}`);
250
+ return null;
251
+ }
252
+
253
+ object.name = data.name;
254
+ object.position.fromArray(data.position);
255
+ object.rotation.fromArray(data.rotation);
256
+ object.scale.fromArray(data.scale);
257
+ object.visible = data.visible;
258
+
259
+ for (const childData of data.children) {
260
+ const child = this.reSerObject3D(childData);
261
+ if (child) {
262
+ object.add(child);
263
+ }
264
+ }
265
+
266
+ return object;
267
+ }
268
+
269
+ /**
270
+ * &#x7F13;&#x5B58;&#x6A21;&#x578B;&#x5230; IndexedDB
271
+ * @param {string} path - &#x4E3B;&#x952E;&#x503C;
272
+ * @param {THREE.Object3D} model - &#x8981;&#x7F13;&#x5B58;&#x7684;&#x6A21;&#x578B;
273
+ */
274
+ async cacheModel(path, model) {
275
+ const serializedData = this.serObject3D(model);
276
+ await this.db.table(&quot;models&quot;).put({ path, data: serializedData });
277
+ console.log(`Model &quot;${path}&quot; cached successfully in table models`);
278
+ }
279
+
280
+ /**
281
+ * &#x4ECE; IndexedDB &#x52A0;&#x8F7D;&#x7F13;&#x5B58;&#x7684;&#x6A21;&#x578B;
282
+ * @param {string} path - &#x4E3B;&#x952E;&#x503C;
283
+ * @returns {THREE.Object3D | null} &#x52A0;&#x8F7D;&#x7684;&#x6A21;&#x578B;
284
+ */
285
+ async loadCachedModel(path) {
286
+ const record = await this.db.table(&quot;models&quot;).get(path);
287
+ if (!record) {
288
+ console.warn(`Model &quot;${path}&quot; not found in table models`);
289
+ return null;
290
+ }
291
+ const deserializedModel = this.reSerObject3D(record.data);
292
+ console.log(`Model &quot;${path}&quot; loaded from table models`);
293
+ return deserializedModel;
294
+ }
295
+ }
296
+ </code></pre>
297
+
298
+ </div>
299
+
300
+ <footer class="footer">
301
+ Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
302
+ </footer>
303
+
304
+ <script src="script/search_index.js"></script>
305
+ <script src="script/search.js"></script>
306
+ <script src="script/pretty-print.js"></script>
307
+ <script src="script/inherited-summary.js"></script>
308
+ <script src="script/test-summary.js"></script>
309
+ <script src="script/inner-link.js"></script>
310
+ <script src="script/patch-for-local.js"></script>
311
+ </body>
312
+ </html>
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <base data-ice="baseUrl" href="../../../">
6
+ <title data-ice="title">src/instance/index.js | @ridp/threejs</title>
7
+ <link type="text/css" rel="stylesheet" href="css/style.css">
8
+ <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
9
+ <script src="script/prettify/prettify.js"></script>
10
+ <script src="script/manual.js"></script>
11
+ <link rel="stylesheet" href="./inject/css/0-cus-style.css"></head>
12
+ <body class="layout-container" data-ice="rootContainer">
13
+
14
+ <header>
15
+ <a href="./">Home</a>
16
+
17
+ <a href="identifiers.html">Reference</a>
18
+ <a href="source.html">Source</a>
19
+
20
+ <div class="search-box">
21
+ <span>
22
+ <img src="./image/search.png">
23
+ <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
24
+ </span>
25
+ <ul class="search-result"></ul>
26
+ </div>
27
+ </header>
28
+
29
+ <nav class="navigation" data-ice="nav"><div>
30
+ <ul>
31
+
32
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#hooks">hooks</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useGLTFLoader">useGLTFLoader</a></span></span></li>
33
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useObb">useObb</a></span></span></li>
34
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useRaycaster">useRaycaster</a></span></span></li>
35
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useThreeJs">useThreeJs</a></span></span></li>
36
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-intersectColor">intersectColor</a></span></span></li>
37
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-obbObjects">obbObjects</a></span></span></li>
38
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#instance">instance</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/instance/IDBCache.js~IDBCache.html">IDBCache</a></span></span></li>
39
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#utils">utils</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ImageLoader">ImageLoader</a></span></span></li>
40
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-initEnvImage">initEnvImage</a></span></span></li>
41
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getCommonParent">getCommonParent</a></span></span></li>
42
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createInfoPlane">createInfoPlane</a></span></span></li>
43
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createTagPlane">createTagPlane</a></span></span></li>
44
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-disposeThreeObject">disposeThreeObject</a></span></span></li>
45
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createArrowHelper">createArrowHelper</a></span></span></li>
46
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createAxesHelper">createAxesHelper</a></span></span></li>
47
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createBox3Helper">createBox3Helper</a></span></span></li>
48
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createCameraHelper">createCameraHelper</a></span></span></li>
49
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createGridHelper">createGridHelper</a></span></span></li>
50
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createMapControls">createMapControls</a></span></span></li>
51
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createOrbitControl">createOrbitControl</a></span></span></li>
52
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createRaycaster">createRaycaster</a></span></span></li>
53
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createStats">createStats</a></span></span></li>
54
+ </ul>
55
+ </div>
56
+ </nav>
57
+
58
+ <div class="content" data-ice="content"><h1 data-ice="title">src/instance/index.js</h1>
59
+ <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">export * from &quot;./IDBCache&quot;;
60
+ </code></pre>
61
+
62
+ </div>
63
+
64
+ <footer class="footer">
65
+ Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
66
+ </footer>
67
+
68
+ <script src="script/search_index.js"></script>
69
+ <script src="script/search.js"></script>
70
+ <script src="script/pretty-print.js"></script>
71
+ <script src="script/inherited-summary.js"></script>
72
+ <script src="script/test-summary.js"></script>
73
+ <script src="script/inner-link.js"></script>
74
+ <script src="script/patch-for-local.js"></script>
75
+ </body>
76
+ </html>
@@ -0,0 +1,118 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <base data-ice="baseUrl" href="../../../">
6
+ <title data-ice="title">src/utils/ImageLoader.js | @ridp/threejs</title>
7
+ <link type="text/css" rel="stylesheet" href="css/style.css">
8
+ <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
9
+ <script src="script/prettify/prettify.js"></script>
10
+ <script src="script/manual.js"></script>
11
+ <link rel="stylesheet" href="./inject/css/0-cus-style.css"></head>
12
+ <body class="layout-container" data-ice="rootContainer">
13
+
14
+ <header>
15
+ <a href="./">Home</a>
16
+
17
+ <a href="identifiers.html">Reference</a>
18
+ <a href="source.html">Source</a>
19
+
20
+ <div class="search-box">
21
+ <span>
22
+ <img src="./image/search.png">
23
+ <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
24
+ </span>
25
+ <ul class="search-result"></ul>
26
+ </div>
27
+ </header>
28
+
29
+ <nav class="navigation" data-ice="nav"><div>
30
+ <ul>
31
+
32
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#hooks">hooks</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useGLTFLoader">useGLTFLoader</a></span></span></li>
33
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useObb">useObb</a></span></span></li>
34
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useRaycaster">useRaycaster</a></span></span></li>
35
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useThreeJs">useThreeJs</a></span></span></li>
36
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-intersectColor">intersectColor</a></span></span></li>
37
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-obbObjects">obbObjects</a></span></span></li>
38
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#instance">instance</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/instance/IDBCache.js~IDBCache.html">IDBCache</a></span></span></li>
39
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#utils">utils</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ImageLoader">ImageLoader</a></span></span></li>
40
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-initEnvImage">initEnvImage</a></span></span></li>
41
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getCommonParent">getCommonParent</a></span></span></li>
42
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createInfoPlane">createInfoPlane</a></span></span></li>
43
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createTagPlane">createTagPlane</a></span></span></li>
44
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-disposeThreeObject">disposeThreeObject</a></span></span></li>
45
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createArrowHelper">createArrowHelper</a></span></span></li>
46
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createAxesHelper">createAxesHelper</a></span></span></li>
47
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createBox3Helper">createBox3Helper</a></span></span></li>
48
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createCameraHelper">createCameraHelper</a></span></span></li>
49
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createGridHelper">createGridHelper</a></span></span></li>
50
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createMapControls">createMapControls</a></span></span></li>
51
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createOrbitControl">createOrbitControl</a></span></span></li>
52
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createRaycaster">createRaycaster</a></span></span></li>
53
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createStats">createStats</a></span></span></li>
54
+ </ul>
55
+ </div>
56
+ </nav>
57
+
58
+ <div class="content" data-ice="content"><h1 data-ice="title">src/utils/ImageLoader.js</h1>
59
+ <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">import { RGBELoader } from &quot;three/examples/jsm/Addons.js&quot;;
60
+ import { EquirectangularReflectionMapping } from &quot;three&quot;;
61
+
62
+ const cacheHdr = {};
63
+
64
+ const rgbeLoader = new RGBELoader();
65
+ /**
66
+ * &#x73AF;&#x5883;&#x8D34;&#x56FE;&#x52A0;&#x8F7D; &amp;&amp; &#x7F13;&#x5B58; &amp;&amp; &#x8BBE;&#x7F6E;&#x5230; scene
67
+ * @param { THREE.Scene } scene threejs &#x573A;&#x666F;&#x5BF9;&#x8C61;
68
+ * @param { String } path &#x56FE;&#x7247;&#x5730;&#x5740;
69
+ * @returns
70
+ */
71
+ export async function initEnvImage(scene, path) {
72
+ if (!path) return;
73
+ if (cacheHdr[path]) {
74
+ const texture = cacheHdr[path];
75
+ scene.environment = texture;
76
+ return;
77
+ }
78
+
79
+ return new Promise((resolve, reject) =&gt; {
80
+ rgbeLoader.load(path, resolve, undefined, reject);
81
+ })
82
+ .then((texture) =&gt; {
83
+ texture.mapping = EquirectangularReflectionMapping;
84
+ scene.environment = texture;
85
+ cacheHdr[path] = texture;
86
+ })
87
+ .catch((e) =&gt; {
88
+ console.log(&quot; =====&gt; e:&quot;, e);
89
+ });
90
+ }
91
+
92
+ /**
93
+ * &#x56FE;&#x7247;&#x7EB9;&#x7406;&#x52A0;&#x8F7D;
94
+ * @param {*} path &#x56FE;&#x7247;&#x8DEF;&#x5F84;
95
+ * @returns
96
+ */
97
+ export async function ImageLoader(path) {
98
+ return new Promise((resolve, reject) =&gt; {
99
+ rgbeLoader.load(path, resolve, undefined, reject);
100
+ });
101
+ }
102
+ </code></pre>
103
+
104
+ </div>
105
+
106
+ <footer class="footer">
107
+ Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
108
+ </footer>
109
+
110
+ <script src="script/search_index.js"></script>
111
+ <script src="script/search.js"></script>
112
+ <script src="script/pretty-print.js"></script>
113
+ <script src="script/inherited-summary.js"></script>
114
+ <script src="script/test-summary.js"></script>
115
+ <script src="script/inner-link.js"></script>
116
+ <script src="script/patch-for-local.js"></script>
117
+ </body>
118
+ </html>
@@ -0,0 +1,102 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <base data-ice="baseUrl" href="../../../">
6
+ <title data-ice="title">src/utils/common.js | @ridp/threejs</title>
7
+ <link type="text/css" rel="stylesheet" href="css/style.css">
8
+ <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
9
+ <script src="script/prettify/prettify.js"></script>
10
+ <script src="script/manual.js"></script>
11
+ <link rel="stylesheet" href="./inject/css/0-cus-style.css"></head>
12
+ <body class="layout-container" data-ice="rootContainer">
13
+
14
+ <header>
15
+ <a href="./">Home</a>
16
+
17
+ <a href="identifiers.html">Reference</a>
18
+ <a href="source.html">Source</a>
19
+
20
+ <div class="search-box">
21
+ <span>
22
+ <img src="./image/search.png">
23
+ <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
24
+ </span>
25
+ <ul class="search-result"></ul>
26
+ </div>
27
+ </header>
28
+
29
+ <nav class="navigation" data-ice="nav"><div>
30
+ <ul>
31
+
32
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#hooks">hooks</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useGLTFLoader">useGLTFLoader</a></span></span></li>
33
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useObb">useObb</a></span></span></li>
34
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useRaycaster">useRaycaster</a></span></span></li>
35
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-useThreeJs">useThreeJs</a></span></span></li>
36
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-intersectColor">intersectColor</a></span></span></li>
37
+ <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-obbObjects">obbObjects</a></span></span></li>
38
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#instance">instance</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/instance/IDBCache.js~IDBCache.html">IDBCache</a></span></span></li>
39
+ <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#utils">utils</a><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ImageLoader">ImageLoader</a></span></span></li>
40
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-initEnvImage">initEnvImage</a></span></span></li>
41
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getCommonParent">getCommonParent</a></span></span></li>
42
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createInfoPlane">createInfoPlane</a></span></span></li>
43
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createTagPlane">createTagPlane</a></span></span></li>
44
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-disposeThreeObject">disposeThreeObject</a></span></span></li>
45
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createArrowHelper">createArrowHelper</a></span></span></li>
46
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createAxesHelper">createAxesHelper</a></span></span></li>
47
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createBox3Helper">createBox3Helper</a></span></span></li>
48
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createCameraHelper">createCameraHelper</a></span></span></li>
49
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createGridHelper">createGridHelper</a></span></span></li>
50
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createMapControls">createMapControls</a></span></span></li>
51
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createOrbitControl">createOrbitControl</a></span></span></li>
52
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createRaycaster">createRaycaster</a></span></span></li>
53
+ <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-createStats">createStats</a></span></span></li>
54
+ </ul>
55
+ </div>
56
+ </nav>
57
+
58
+ <div class="content" data-ice="content"><h1 data-ice="title">src/utils/common.js</h1>
59
+ <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">export const getCommonParent = (meshList, objectGroup) =&gt; {
60
+ const parentCount = {};
61
+
62
+ meshList.forEach((mesh) =&gt; {
63
+ let parent = mesh.parent;
64
+ while (parent) {
65
+ if (parentCount[parent.uuid]) {
66
+ parentCount[parent.uuid]++;
67
+ } else {
68
+ parentCount[parent.uuid] = 1;
69
+ }
70
+ parent = parent.parent;
71
+ }
72
+ });
73
+
74
+ let commonParent = null;
75
+ let maxCount = 0;
76
+
77
+ for (const uuid in parentCount) {
78
+ if (parentCount[uuid] &gt; maxCount) {
79
+ maxCount = parentCount[uuid];
80
+ commonParent = objectGroup.getObjectByProperty(&quot;uuid&quot;, uuid);
81
+ }
82
+ }
83
+
84
+ return commonParent;
85
+ };
86
+ </code></pre>
87
+
88
+ </div>
89
+
90
+ <footer class="footer">
91
+ Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.1.0)</span><img src="./image/esdoc-logo-mini-black.png"></a>
92
+ </footer>
93
+
94
+ <script src="script/search_index.js"></script>
95
+ <script src="script/search.js"></script>
96
+ <script src="script/pretty-print.js"></script>
97
+ <script src="script/inherited-summary.js"></script>
98
+ <script src="script/test-summary.js"></script>
99
+ <script src="script/inner-link.js"></script>
100
+ <script src="script/patch-for-local.js"></script>
101
+ </body>
102
+ </html>