mirror of
https://github.com/galacean/engine.git
synced 2026-06-09 01:03:09 +08:00
@@ -8,6 +8,10 @@ export class SystemInfo {
|
||||
static platform: Platform = Platform.Unknown;
|
||||
/** The operating system is running on. */
|
||||
static operatingSystem: string = "";
|
||||
|
||||
/** @internal */
|
||||
static _isBrowser = true;
|
||||
|
||||
/** Whether the system support SIMD. */
|
||||
private static _simdSupported: boolean | null = null;
|
||||
|
||||
@@ -24,6 +28,7 @@ export class SystemInfo {
|
||||
static _initialize(): void {
|
||||
{
|
||||
if (typeof navigator == "undefined") {
|
||||
SystemInfo._isBrowser = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Texture2D } from "@galacean/engine-core";
|
||||
import { SystemInfo, Texture2D } from "@galacean/engine-core";
|
||||
import type { ITexture } from "../GLTFSchema";
|
||||
import { registerGLTFExtension } from "../parser/GLTFParser";
|
||||
import { GLTFParserContext } from "../parser/GLTFParserContext";
|
||||
@@ -15,10 +15,15 @@ class EXT_texture_webp extends GLTFExtensionParser {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
const testCanvas = document.createElement("canvas");
|
||||
|
||||
testCanvas.width = testCanvas.height = 1;
|
||||
this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
|
||||
// @ts-ignore
|
||||
if (SystemInfo._isBrowser) {
|
||||
const testCanvas = document.createElement("canvas");
|
||||
testCanvas.width = testCanvas.height = 1;
|
||||
this._supportWebP = testCanvas.toDataURL("image/webp").indexOf("data:image/webp") == 0;
|
||||
} else {
|
||||
this._supportWebP = false;
|
||||
}
|
||||
}
|
||||
|
||||
override async createAndParse(
|
||||
|
||||
Reference in New Issue
Block a user