@@ -370,6 +370,44 @@ describe(
370
370
renderMaterial ( material ) ;
371
371
} ) ;
372
372
373
+ it ( "creates a material with an image offscreen canvas uniform" , function ( ) {
374
+ const canvas = new OffscreenCanvas ( 1 , 1 ) ;
375
+ const context2D = canvas . getContext ( "2d" ) ;
376
+ context2D . fillStyle = "rgb(0,0,255)" ;
377
+ context2D . fillRect ( 0 , 0 , 1 , 1 ) ;
378
+
379
+ const material = new Material ( {
380
+ strict : true ,
381
+ fabric : {
382
+ type : "DiffuseMap" ,
383
+ uniforms : {
384
+ image : canvas ,
385
+ } ,
386
+ } ,
387
+ } ) ;
388
+
389
+ renderMaterial ( material ) ;
390
+ } ) ;
391
+
392
+ it ( "creates a material with an image bitmap" , function ( ) {
393
+ const canvas = new OffscreenCanvas ( 1 , 1 ) ;
394
+ const context2D = canvas . getContext ( "2d" ) ;
395
+ context2D . fillStyle = "rgb(0,0,255)" ;
396
+ context2D . fillRect ( 0 , 0 , 1 , 1 ) ;
397
+
398
+ const material = new Material ( {
399
+ strict : true ,
400
+ fabric : {
401
+ type : "DiffuseMap" ,
402
+ uniforms : {
403
+ image : canvas . transferToImageBitmap ( ) ,
404
+ } ,
405
+ } ,
406
+ } ) ;
407
+
408
+ renderMaterial ( material ) ;
409
+ } ) ;
410
+
373
411
it ( "creates a material with an KTX2 compressed image uniform" , function ( ) {
374
412
let compressedUrl ;
375
413
if ( FeatureDetection . supportsBasis ( scene ) ) {
0 commit comments