ohzi-core 6.8.0 → 6.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "6.8.0",
3
+ "version": "6.9.0",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
package/src/index.js CHANGED
@@ -100,6 +100,7 @@ import OBJLoader from './resource_loader/OBJLoader';
100
100
  import PointArrayLoader from './resource_loader/PointArrayLoader';
101
101
  import RGBETextureLoader from './resource_loader/RGBETextureLoader';
102
102
  import TextLoader from './resource_loader/TextLoader';
103
+ import AsyncTextureLoader from './resource_loader/AsyncTextureLoader';
103
104
  import TextureLoader from './resource_loader/TextureLoader';
104
105
  import VideoLoader from './resource_loader/VideoLoader';
105
106
 
@@ -205,6 +206,7 @@ export {
205
206
  PointArrayLoader,
206
207
  RGBETextureLoader,
207
208
  TextLoader,
209
+ AsyncTextureLoader,
208
210
  TextureLoader,
209
211
  VideoLoader,
210
212
 
@@ -0,0 +1,35 @@
1
+ import AbstractLoader from './AbstractLoader';
2
+
3
+ import { Texture } from 'three';
4
+
5
+ export default class AsyncTextureLoader extends AbstractLoader
6
+ {
7
+ constructor(resource_id, url, size)
8
+ {
9
+ super(resource_id, url, size);
10
+ }
11
+
12
+ on_preloaded_finished(resource_container)
13
+ {
14
+ const texture = new Texture();
15
+ const image = new Image();
16
+
17
+ image.src = this.url;
18
+
19
+ image.onload = () =>
20
+ {
21
+ texture.image = image;
22
+ texture.needsUpdate = true;
23
+
24
+ resource_container.set_resource(this.resource_id, this.url, texture);
25
+
26
+ this.__update_downloaded_bytes(1, 1);
27
+ this.__loading_ended();
28
+ };
29
+
30
+ image.onerror = () =>
31
+ {
32
+ console.error('Error loading texture. Maybe the resource is not an image?', this.url);
33
+ };
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ import { AbstractLoader } from "./AbstractLoader";
2
+
3
+ export class AsyncTextureLoader extends AbstractLoader {
4
+ constructor(resource_id: any, url: any, size: any);
5
+ loader: any;
6
+ }
@@ -1,6 +1,6 @@
1
1
  import { AbstractLoader } from "./AbstractLoader";
2
2
 
3
3
  export class BasisLoader extends AbstractLoader {
4
- constructor(resource_id: any, url: any, renderer: any, loader: any, size: any);
4
+ constructor(resource_id: any, url: any, loader: any, size: any);
5
5
  loader: any;
6
6
  }