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

Commit e30e19c

Browse files
Update multiple viewers
1 parent a1aaa8e commit e30e19c

File tree

6 files changed

+78
-0
lines changed

6 files changed

+78
-0
lines changed

viewers/templates/ASSIMP Viewer.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4662,6 +4662,19 @@
46624662
img.src = image.src;
46634663
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
46644664
let blob = new Blob( [ image.data ], { type: m_type } );
4665+
img.src = URL.createObjectURL( blob );
4666+
URL.revokeObjectURL( blob );
4667+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
4668+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
4669+
let a2b = atob( base64data );
4670+
let buff = new Uint8Array( a2b.length );
4671+
4672+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
4673+
buff[ i ] = a2b.charCodeAt( i );
4674+
}
4675+
4676+
let blob = new Blob( [ buff ], { type: 'image/png' } );
4677+
46654678
img.src = URL.createObjectURL( blob );
46664679
URL.revokeObjectURL( blob );
46674680
} else {

viewers/templates/GLTF Viewer.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,19 @@
43124312
img.src = image.src;
43134313
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
43144314
let blob = new Blob( [ image.data ], { type: m_type } );
4315+
img.src = URL.createObjectURL( blob );
4316+
URL.revokeObjectURL( blob );
4317+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
4318+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
4319+
let a2b = atob( base64data );
4320+
let buff = new Uint8Array( a2b.length );
4321+
4322+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
4323+
buff[ i ] = a2b.charCodeAt( i );
4324+
}
4325+
4326+
let blob = new Blob( [ buff ], { type: 'image/png' } );
4327+
43154328
img.src = URL.createObjectURL( blob );
43164329
URL.revokeObjectURL( blob );
43174330
} else {

viewers/templates/GLTF WebGPU.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,6 +4266,19 @@
42664266
img.src = image.src;
42674267
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
42684268
let blob = new Blob( [ image.data ], { type: m_type } );
4269+
img.src = URL.createObjectURL( blob );
4270+
URL.revokeObjectURL( blob );
4271+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
4272+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
4273+
let a2b = atob( base64data );
4274+
let buff = new Uint8Array( a2b.length );
4275+
4276+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
4277+
buff[ i ] = a2b.charCodeAt( i );
4278+
}
4279+
4280+
let blob = new Blob( [ buff ], { type: 'image/png' } );
4281+
42694282
img.src = URL.createObjectURL( blob );
42704283
URL.revokeObjectURL( blob );
42714284
} else {

viewers/templates/GLTFS Viewer.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,6 +4169,19 @@
41694169
img.src = image.src;
41704170
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
41714171
let blob = new Blob( [ image.data ], { type: m_type } );
4172+
img.src = URL.createObjectURL( blob );
4173+
URL.revokeObjectURL( blob );
4174+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
4175+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
4176+
let a2b = atob( base64data );
4177+
let buff = new Uint8Array( a2b.length );
4178+
4179+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
4180+
buff[ i ] = a2b.charCodeAt( i );
4181+
}
4182+
4183+
let blob = new Blob( [ buff ], { type: 'image/png' } );
4184+
41724185
img.src = URL.createObjectURL( blob );
41734186
URL.revokeObjectURL( blob );
41744187
} else {

viewers/templates/OBJ WebGPU.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5243,6 +5243,19 @@
52435243
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
52445244
let blob = new Blob( [ image.data ], { type: m_type } );
52455245

5246+
img.src = URL.createObjectURL( blob );
5247+
URL.revokeObjectURL( blob );
5248+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
5249+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
5250+
let a2b = atob( base64data );
5251+
let buff = new Uint8Array( a2b.length );
5252+
5253+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
5254+
buff[ i ] = a2b.charCodeAt( i );
5255+
}
5256+
5257+
let blob = new Blob( [ buff ], { type: 'image/png' } );
5258+
52465259
img.src = URL.createObjectURL( blob );
52475260
URL.revokeObjectURL( blob );
52485261
} else {

viewers/templates/PDB WebGPU.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,19 @@
35053505
img.src = image.src;
35063506
} else if ( image.data && (img_ext === true || pass_to_img === true) ) {
35073507
let blob = new Blob( [ image.data ], { type: m_type } );
3508+
img.src = URL.createObjectURL( blob );
3509+
URL.revokeObjectURL( blob );
3510+
} else if (texture.source.data.nodeName && texture.source.data.nodeName.toLowerCase() === 'canvas') {
3511+
let base64data = texture.source.data.toDataURL( 'image/png', 1 ).split( ',' )[ 1 ];
3512+
let a2b = atob( base64data );
3513+
let buff = new Uint8Array( a2b.length );
3514+
3515+
for ( let i = 0, l = buff.length; i < l; i ++ ) {
3516+
buff[ i ] = a2b.charCodeAt( i );
3517+
}
3518+
3519+
let blob = new Blob( [ buff ], { type: 'image/png' } );
3520+
35083521
img.src = URL.createObjectURL( blob );
35093522
URL.revokeObjectURL( blob );
35103523
} else {

0 commit comments

Comments
 (0)