ohzi-core 10.6.2 → 10.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "10.6.2",
3
+ "version": "10.6.3",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
@@ -1,18 +1,22 @@
1
+ import { Browser } from '../Browser';
1
2
  import { AbstractLoader } from './AbstractLoader';
2
3
 
3
- import { Texture } from 'three';
4
- import { Browser } from '../Browser';
4
+ import { NoColorSpace, SRGBColorSpace, Texture } from 'three';
5
5
 
6
6
  class AsyncTextureLoader extends AbstractLoader
7
7
  {
8
- constructor(resource_id, url, size)
8
+ constructor(resource_id, url, size, flipY = true, premultiplyAlpha = false, colorSpaceConversion = true)
9
9
  {
10
10
  super(resource_id, url, size);
11
+
12
+ this.colorSpaceConversion = colorSpaceConversion;
13
+ this.premultiplyAlpha = premultiplyAlpha;
14
+ this.flipY = flipY;
11
15
  }
12
16
 
13
17
  on_preloaded_finished(resource_container)
14
18
  {
15
- if (Browser.is_safari && Browser.version < 15)
19
+ if (Browser.is_safari) // && Browser.version < 15
16
20
  {
17
21
  this.load_with_old_method(resource_container);
18
22
  }
@@ -34,6 +38,9 @@ class AsyncTextureLoader extends AbstractLoader
34
38
  image.onload = () =>
35
39
  {
36
40
  texture.image = image;
41
+ texture.flipY = this.flipY;
42
+ texture.premultiplyAlpha = this.premultiplyAlpha;
43
+ texture.colorSpace = this.colorSpaceConversion ? SRGBColorSpace : NoColorSpace;
37
44
  texture.needsUpdate = true;
38
45
 
39
46
  resource_container.set_resource(this.resource_id, this.url, texture);
@@ -69,7 +76,11 @@ class AsyncTextureLoader extends AbstractLoader
69
76
  return res.blob();
70
77
  }).then((blob) =>
71
78
  {
72
- return createImageBitmap(blob, { colorSpaceConversion: 'none' });
79
+ return createImageBitmap(blob, {
80
+ colorSpaceConversion: this.colorSpaceConversion ? 'default' : 'none',
81
+ imageOrientation: this.flipY ? 'flipY' : 'none',
82
+ premultiplyAlpha: this.premultiplyAlpha ? 'premultiply' : 'none'
83
+ });
73
84
  }).then((imageBitmap) =>
74
85
  {
75
86
  const texture = new Texture(imageBitmap);
@@ -1,5 +1,8 @@
1
1
  export class AsyncTextureLoader extends AbstractLoader {
2
- constructor(resource_id: any, url: any, size: any);
2
+ constructor(resource_id: any, url: any, size: any, flipY?: boolean, premultiplyAlpha?: boolean, colorSpaceConversion?: boolean);
3
+ colorSpaceConversion: boolean;
4
+ premultiplyAlpha: boolean;
5
+ flipY: boolean;
3
6
  on_preloaded_finished(resource_container: any): void;
4
7
  load_with_old_method(resource_container: any): void;
5
8
  load_with_new_method(resource_container: any): void;
@@ -1,6 +0,0 @@
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
- }