three 基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
715 B

2 years ago
import { WebGLRenderTarget } from 'three';
class WebGPUTextureRenderer {
constructor( renderer, options = {} ) {
this.renderer = renderer;
// @TODO: Consider to introduce WebGPURenderTarget or rename WebGLRenderTarget to just RenderTarget
this.renderTarget = new WebGLRenderTarget( options );
}
getTexture() {
return this.renderTarget.texture;
}
setSize( width, height ) {
this.renderTarget.setSize( width, height );
}
render( scene, camera ) {
const renderer = this.renderer;
const renderTarget = this.renderTarget;
renderer.setRenderTarget( renderTarget );
renderer.render( scene, camera );
renderer.setRenderTarget( null );
}
}
export default WebGPUTextureRenderer;