Skip to content

Commit

Permalink
Add Extension to CubemapLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
fedegratti committed Mar 25, 2023
1 parent 240cfe7 commit 34309fb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v9.4.0
v9.4.1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ohzi-core",
"version": "9.4.0",
"version": "9.4.1",
"description": "OHZI Core Library",
"source": "src/index.js",
"module": "build/index.module.js",
Expand Down
4 changes: 2 additions & 2 deletions src/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Browser

get has_webm()
{
return this.is_chrome || this.is_firefox || this.is_edge_chromium;
return !!(this.is_chrome || this.is_firefox || this.is_edge_chromium);
}

get has_hvec()
Expand Down Expand Up @@ -98,7 +98,7 @@ class Browser
if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]);
version = M.join(' ');

return version.split(' ')[1];
return Number(version.split(' ')[1]);
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/resource_loader/CubemapLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { CubeTextureLoader } from 'three';

class CubemapLoader extends AbstractLoader
{
constructor(resource_id, url, size)
constructor(resource_id, url, extension, size)
{
super(resource_id, url, size);
this.loader = new CubeTextureLoader();
this.loader.setPath(url + '/');
this.urls = [
'px.png',
'nx.png',
'py.png',
'ny.png',
'pz.png',
'nz.png'
`px.${extension}`,
`nx.${extension}`,
`py.${extension}`,
`ny.${extension}`,
`pz.${extension}`,
`nz.${extension}`
];
}

Expand Down
2 changes: 2 additions & 0 deletions types/Browser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ declare class Browser {
init(): void;
browser_name: string;
agent: string;
version: number;
get name(): string;
get is_safari(): boolean;
get is_chrome(): boolean;
Expand All @@ -12,4 +13,5 @@ declare class Browser {
get has_webm(): boolean;
get has_hvec(): boolean;
get preferred_video_extension(): "webm" | "hvec.mp4" | "mp4";
get_version(): number;
}
2 changes: 2 additions & 0 deletions types/resource_loader/AsyncTextureLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export class AsyncTextureLoader extends AbstractLoader {
constructor(resource_id: any, url: any, size: any);
on_preloaded_finished(resource_container: any): void;
load_with_old_method(resource_container: any): void;
load_with_new_method(resource_container: any): void;
}
import { AbstractLoader } from "./AbstractLoader";
2 changes: 1 addition & 1 deletion types/resource_loader/CubemapLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export class CubemapLoader extends AbstractLoader {
constructor(resource_id: any, url: any, size: any);
constructor(resource_id: any, url: any, extension: any, size: any);
loader: any;
urls: string[];
on_preloaded_finished(resource_container: any): void;
Expand Down

0 comments on commit 34309fb

Please sign in to comment.