@onerjs/core 8.35.1 → 8.35.3
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/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js +11 -0
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Textures/texture.js +6 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Misc/fileTools.d.ts +1 -1
- package/Misc/fileTools.js +33 -22
- package/Misc/fileTools.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +1 -1
- package/scene.js.map +1 -1
package/Loading/sceneLoader.d.ts
CHANGED
|
@@ -277,7 +277,7 @@ type DefaultPluginOptions<BasePluginOptions> = {
|
|
|
277
277
|
enabled?: boolean;
|
|
278
278
|
} & BasePluginOptions;
|
|
279
279
|
export type PluginOptions = ISceneLoaderOptions["pluginOptions"];
|
|
280
|
-
type SceneSource = string | File | ArrayBufferView;
|
|
280
|
+
type SceneSource = string | File | ArrayBufferView | object;
|
|
281
281
|
/**
|
|
282
282
|
* Defines common options for loading operations performed by SceneLoader.
|
|
283
283
|
*/
|
package/Loading/sceneLoader.js
CHANGED
|
@@ -107,6 +107,10 @@ async function loadDataAsync(fileInfo, scene, onSuccess, onProgress, onError, on
|
|
|
107
107
|
// eslint-disable-next-line no-throw-literal
|
|
108
108
|
throw "When using ArrayBufferView to load data the file extension must be provided.";
|
|
109
109
|
}
|
|
110
|
+
if (fileInfo.jsonData && !pluginExtension) {
|
|
111
|
+
// eslint-disable-next-line no-throw-literal
|
|
112
|
+
throw "When using object to load data the file extension must be provided.";
|
|
113
|
+
}
|
|
110
114
|
const fileExtension = !directLoad && !pluginExtension ? getFilenameExtension(fileInfo.url) : "";
|
|
111
115
|
let registeredPlugin = pluginExtension
|
|
112
116
|
? getPluginForExtension(pluginExtension, true)
|
|
@@ -254,6 +258,7 @@ function GetFileInfo(rootUrl, sceneSource) {
|
|
|
254
258
|
let name;
|
|
255
259
|
let file = null;
|
|
256
260
|
let rawData = null;
|
|
261
|
+
let jsonData = null;
|
|
257
262
|
if (!sceneSource) {
|
|
258
263
|
url = rootUrl;
|
|
259
264
|
name = Tools.GetFilename(rootUrl);
|
|
@@ -269,6 +274,11 @@ function GetFileInfo(rootUrl, sceneSource) {
|
|
|
269
274
|
name = RandomGUID();
|
|
270
275
|
rawData = sceneSource;
|
|
271
276
|
}
|
|
277
|
+
else if (typeof sceneSource === "object") {
|
|
278
|
+
url = "";
|
|
279
|
+
name = RandomGUID();
|
|
280
|
+
jsonData = sceneSource;
|
|
281
|
+
}
|
|
272
282
|
else if (sceneSource.startsWith("data:")) {
|
|
273
283
|
url = sceneSource;
|
|
274
284
|
name = "";
|
|
@@ -293,6 +303,7 @@ function GetFileInfo(rootUrl, sceneSource) {
|
|
|
293
303
|
name: name,
|
|
294
304
|
file: file,
|
|
295
305
|
rawData,
|
|
306
|
+
jsonData,
|
|
296
307
|
};
|
|
297
308
|
}
|
|
298
309
|
/**
|