Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/renderers/common/Textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ class Textures extends DataMap {
target.height = image.videoHeight || 1;
target.depth = 1;

} else if ( image instanceof VideoFrame ) {

target.width = image.displayWidth || 1;
target.height = image.displayHeight || 1;
target.depth = 1;

} else {

target.width = image.width || 1;
Expand Down
12 changes: 11 additions & 1 deletion src/textures/Source.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,23 @@ class Source {

}

/**
* Returns the dimensions of the source into the given target vector.
*
* @param {(Vector2|Vector3)} target - The target object the result is written into.
* @return {(Vector2|Vector3)} The dimensions of the source.
*/
getSize( target ) {

const data = this.data;

if ( data instanceof HTMLVideoElement ) {

target.set( data.videoWidth, data.videoHeight );
target.set( data.videoWidth, data.videoHeight, 0 );

} else if ( data instanceof VideoFrame ) {

target.set( data.displayHeight, data.displayWidth, 0 );

} else if ( data !== null ) {

Expand Down