Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Commit 29dc15c

Browse files
Update multiple viewers
1 parent 62f59a0 commit 29dc15c

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

viewers/templates/GLTF WebGPU.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
var mouse_down, mouse_wheel, reset_rotation, events_initialized, wireframe_enabled;
4848
var gui, gui_set = false, guiExposure, params, toneMappingOptions, draco_material;
4949
var variants, variant_materials, current_variant, variants_available, link;
50-
var ambientLight, directionalLight, isMobile, isNewiPad, isFirefoxNightly;
50+
var ambientLight, directionalLight, isMobile, isNewiPad;
5151
var ww = window.innerWidth, wh = window.innerHeight, equi_enabled;
5252
var animation_running, extra_running, gif_export, object_is_points;
5353
var rot_x = 0, rot_y = 0, rot_z = 0, initial_rotation;
@@ -1923,11 +1923,27 @@
19231923
mouse_wheel = true;
19241924

19251925
let image_name = (document.getElementById('file_image_input').value).toUpperCase();
1926-
let exr = image_name.endsWith( '.EXR' );
1927-
let hdr = image_name.endsWith( '.HDR' );
1928-
let hd_gpu = ((exr === true || hdr === true) && gpu === true);
1926+
let exr = (image_name.endsWith( '.EXR' ) === true);
1927+
let hdr = (image_name.endsWith( '.HDR' ) === true);
1928+
let hd = (exr === true || hdr === true);
19291929

1930-
const options = { imageOrientation: (bg_flip === true ? (hd_gpu === false ? 'flipY' : 'none') : (hd_gpu === false ? 'none' : 'flipY')) };
1930+
let image_orientation;
1931+
1932+
if (bg_flip === true) {
1933+
if (hd === false) {
1934+
image_orientation = 'flipY';
1935+
} else {
1936+
image_orientation = 'none';
1937+
}
1938+
} else {
1939+
if (hd === false) {
1940+
image_orientation = 'none';
1941+
} else {
1942+
image_orientation = 'flipY';
1943+
}
1944+
}
1945+
1946+
const options = { imageOrientation: image_orientation };
19311947
const imageBitmap = await createImageBitmap( scene_bgnd.image, options );
19321948
const clone = new THREE.CanvasTexture( imageBitmap );
19331949
clone.colorSpace = ((exr === true || hdr === true) ? THREE.LinearSRGBColorSpace : THREE.SRGBColorSpace);
@@ -5086,8 +5102,6 @@
50865102
isNewiPad = (/iPad/.test( navigator.platform ) && (/Mac OS X/i.test( navigator.userAgent ))) ||
50875103
(navigator.maxTouchPoints !== undefined && navigator.maxTouchPoints > 2 && /MacIntel/.test( navigator.platform ));
50885104

5089-
isFirefoxNightly = (gpu === true) && (/Firefox/i.test( navigator.userAgent )) && (/Gecko/i.test( navigator.userAgent ));
5090-
50915105
isMobile = (isNewiPad === false) && ((/iPhone|iPad|iPod/.test( navigator.platform )) ||
50925106
(/Android|webOS|iPhone|iPad|iPod|BlackBerry|CriOS|IEMobile|Opera Mini/i.test( navigator.userAgent )));
50935107

viewers/templates/OBJ WebGPU.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,11 +2805,27 @@
28052805
mouse_wheel = true;
28062806

28072807
let image_name = (document.getElementById('file_image_input').value).toUpperCase();
2808-
let exr = image_name.endsWith( '.EXR' );
2809-
let hdr = image_name.endsWith( '.HDR' );
2810-
let hd_gpu = ((exr === true || hdr === true) && gpu === true);
2808+
let exr = (image_name.endsWith( '.EXR' ) === true);
2809+
let hdr = (image_name.endsWith( '.HDR' ) === true);
2810+
let hd = (exr === true || hdr === true);
28112811

2812-
const options = { imageOrientation: (bg_flip === true ? (hd_gpu === false ? 'flipY' : 'none') : (hd_gpu === false ? 'none' : 'flipY')) };
2812+
let image_orientation;
2813+
2814+
if (bg_flip === true) {
2815+
if (hd === false) {
2816+
image_orientation = 'flipY';
2817+
} else {
2818+
image_orientation = 'none';
2819+
}
2820+
} else {
2821+
if (hd === false) {
2822+
image_orientation = 'none';
2823+
} else {
2824+
image_orientation = 'flipY';
2825+
}
2826+
}
2827+
2828+
const options = { imageOrientation: image_orientation };
28132829
const imageBitmap = await createImageBitmap( scene_bgnd.image, options );
28142830
const clone = new THREE.CanvasTexture( imageBitmap );
28152831
clone.colorSpace = ((exr === true || hdr === true) ? THREE.LinearSRGBColorSpace : THREE.SRGBColorSpace);

viewers/templates/PDB WebGPU.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,11 +1631,27 @@
16311631
mouse_wheel = true;
16321632

16331633
let image_name = (document.getElementById('file_image_input').value).toUpperCase();
1634-
let exr = image_name.endsWith( '.EXR' );
1635-
let hdr = image_name.endsWith( '.HDR' );
1636-
let hd_gpu = ((exr === true || hdr === true) && gpu === true);
1634+
let exr = (image_name.endsWith( '.EXR' ) === true);
1635+
let hdr = (image_name.endsWith( '.HDR' ) === true);
1636+
let hd = (exr === true || hdr === true);
16371637

1638-
const options = { imageOrientation: (bg_flip === true ? (hd_gpu === false ? 'flipY' : 'none') : (hd_gpu === false ? 'none' : 'flipY')) };
1638+
let image_orientation;
1639+
1640+
if (bg_flip === true) {
1641+
if (hd === false) {
1642+
image_orientation = 'flipY';
1643+
} else {
1644+
image_orientation = 'none';
1645+
}
1646+
} else {
1647+
if (hd === false) {
1648+
image_orientation = 'none';
1649+
} else {
1650+
image_orientation = 'flipY';
1651+
}
1652+
}
1653+
1654+
const options = { imageOrientation: image_orientation };
16391655
const imageBitmap = await createImageBitmap( scene_bgnd.image, options );
16401656
const clone = new THREE.CanvasTexture( imageBitmap );
16411657
clone.colorSpace = ((exr === true || hdr === true) ? THREE.LinearSRGBColorSpace : THREE.SRGBColorSpace);

0 commit comments

Comments
 (0)