-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebGPURenderer: Backdrop Node - Part 1/3 (#25903)
* WebGPURenderer: Fix re-configure context * WebGPURenderer: Improve state in favor of access WebGPU encoders * NodeMaterial: Reduce duplicate initialization of properties * WebGPUTextures: Support RenderTargetTexture mipmaps if necessary. * WebGPUBackground: Move to renderState * WebGPUNodes: .updateBefore() fixes * WebGPURenderer: Added .copyFramebufferToRenderTarget() * NodeMaterial: Added backdropNode * Added webgpu_backdrop example * update title * cleanup * rotate just on idle * WebGPURenderList: Update include
- Loading branch information
Showing
21 changed files
with
464 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import ViewportTextureNode from './ViewportTextureNode.js'; | ||
import { addNodeClass } from '../core/Node.js'; | ||
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js'; | ||
import { viewportTopLeft } from './ViewportNode.js'; | ||
|
||
let rtt = null; | ||
|
||
class ViewportSharedTextureNode extends ViewportTextureNode { | ||
|
||
constructor( uv = viewportTopLeft ) { | ||
|
||
super( uv ); | ||
|
||
} | ||
|
||
constructRTT( builder ) { | ||
|
||
return rtt || ( rtt = builder.getRenderTarget() ); | ||
|
||
} | ||
|
||
} | ||
|
||
export default ViewportSharedTextureNode; | ||
|
||
export const viewportSharedTexture = nodeProxy( ViewportSharedTextureNode ); | ||
|
||
addNodeElement( 'viewportSharedTexture', viewportSharedTexture ); | ||
|
||
addNodeClass( ViewportSharedTextureNode ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import TextureNode from '../accessors/TextureNode.js'; | ||
import { NodeUpdateType } from '../core/constants.js'; | ||
import { addNodeClass } from '../core/Node.js'; | ||
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js'; | ||
import { viewportTopLeft } from './ViewportNode.js'; | ||
import { Vector2 } from 'three'; | ||
|
||
let size = new Vector2(); | ||
|
||
class ViewportTextureNode extends TextureNode { | ||
|
||
constructor( uv = viewportTopLeft, level = null ) { | ||
|
||
super( null, uv, level ); | ||
|
||
this.rtt = null; | ||
|
||
this.isOutputTextureNode = true; | ||
|
||
this.updateBeforeType = NodeUpdateType.FRAME; | ||
|
||
} | ||
|
||
constructRTT( builder ) { | ||
|
||
return builder.getRenderTarget(); | ||
|
||
} | ||
|
||
construct( builder ) { | ||
|
||
if ( this.rtt === null ) this.rtt = this.constructRTT( builder ); | ||
|
||
this.value = this.rtt.texture; | ||
|
||
return super.construct( builder ); | ||
|
||
} | ||
|
||
updateBefore( frame ) { | ||
|
||
const rtt = this.rtt; | ||
|
||
const renderer = frame.renderer; | ||
renderer.getDrawingBufferSize( size ); | ||
|
||
rtt.setSize( size.width, size.height ); | ||
|
||
renderer.copyFramebufferToRenderTarget( rtt ); | ||
|
||
} | ||
|
||
} | ||
|
||
export default ViewportTextureNode; | ||
|
||
export const viewportTexture = nodeProxy( ViewportTextureNode ); | ||
|
||
addNodeElement( 'viewportTexture', viewportTexture ); | ||
|
||
addNodeClass( ViewportTextureNode ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.