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
1 change: 1 addition & 0 deletions src/Three.Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js';
export { CubeTexture } from './textures/CubeTexture.js';
export { CanvasTexture } from './textures/CanvasTexture.js';
export { DepthTexture } from './textures/DepthTexture.js';
export { ExternalTexture } from './textures/ExternalTexture.js';
export { Texture } from './textures/Texture.js';
export * from './geometries/Geometries.js';
export * from './materials/Materials.js';
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/common/Textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class Textures extends DataMap {

//

if ( isRenderTarget || texture.isStorageTexture === true ) {
if ( isRenderTarget || texture.isStorageTexture === true || texture.isExternalTexture === true ) {

backend.createSampler( texture );
backend.createTexture( texture, options );
Expand Down
9 changes: 9 additions & 0 deletions src/renderers/webgpu/utils/WebGPUTextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ class WebGPUTextureUtils {

}

if ( texture.isExternalTexture ) {

textureData.texture = texture.sourceTexture;
textureData.initialized = true;

return;

}

if ( options.needsMipmaps === undefined ) options.needsMipmaps = false;
if ( options.levels === undefined ) options.levels = 1;
if ( options.depth === undefined ) options.depth = 1;
Expand Down
9 changes: 5 additions & 4 deletions src/textures/ExternalTexture.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Texture } from './Texture.js';

/**
* Represents a texture created externally from the renderer context.
* Represents a texture created externally with the same renderer context.
*
* This may be a texture from a protected media stream, device camera feed,
* or other data feeds like a depth sensor.
*
* Note that this class is only supported in {@link WebGLRenderer} right now.
* Note that this class is only supported in {@link WebGLRenderer}, and in
* the {@link WebGPURenderer} WebGPU backend.
*
* @augments Texture
*/
Expand All @@ -15,7 +16,7 @@ class ExternalTexture extends Texture {
/**
* Creates a new raw texture.
*
* @param {?WebGLTexture} [sourceTexture=null] - The external texture.
* @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture.
*/
constructor( sourceTexture = null ) {

Expand All @@ -24,7 +25,7 @@ class ExternalTexture extends Texture {
/**
* The external source texture.
*
* @type {?WebGLTexture}
* @type {?(WebGLTexture|GPUTexture)}
* @default null
*/
this.sourceTexture = sourceTexture;
Expand Down
Loading