Skip to content

Commit 96662ca

Browse files
authored
Textures: Fix dimensions of video frames. (#31425)
* Textures: Fix dimensions of video frames. * Source: Fix `getSize()`. * Source: Fix z coordinate for video-like sources.
1 parent e3853ed commit 96662ca

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/renderers/common/Textures.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ class Textures extends DataMap {
372372
target.height = image.videoHeight || 1;
373373
target.depth = 1;
374374

375+
} else if ( image instanceof VideoFrame ) {
376+
377+
target.width = image.displayWidth || 1;
378+
target.height = image.displayHeight || 1;
379+
target.depth = 1;
380+
375381
} else {
376382

377383
target.width = image.width || 1;

src/textures/Source.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ class Source {
7373

7474
}
7575

76+
/**
77+
* Returns the dimensions of the source into the given target vector.
78+
*
79+
* @param {(Vector2|Vector3)} target - The target object the result is written into.
80+
* @return {(Vector2|Vector3)} The dimensions of the source.
81+
*/
7682
getSize( target ) {
7783

7884
const data = this.data;
7985

8086
if ( data instanceof HTMLVideoElement ) {
8187

82-
target.set( data.videoWidth, data.videoHeight );
88+
target.set( data.videoWidth, data.videoHeight, 0 );
89+
90+
} else if ( data instanceof VideoFrame ) {
91+
92+
target.set( data.displayHeight, data.displayWidth, 0 );
8393

8494
} else if ( data !== null ) {
8595

0 commit comments

Comments
 (0)