Skip to content

Commit 9cdcaa3

Browse files
committed
specs
1 parent 1f962e6 commit 9cdcaa3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/engine/Specs/Scene/MaterialSpec.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,44 @@ describe(
370370
renderMaterial(material);
371371
});
372372

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+
373411
it("creates a material with an KTX2 compressed image uniform", function () {
374412
let compressedUrl;
375413
if (FeatureDetection.supportsBasis(scene)) {

0 commit comments

Comments
 (0)