Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Blending revision 1/2 #26455

Merged
merged 4 commits into from
Jul 19, 2023
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
30 changes: 26 additions & 4 deletions examples/jsm/nodes/accessors/TextureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class TextureNode extends UniformNode {
this.levelNode = levelNode;
this.compareNode = compareNode;

this.updateType = NodeUpdateType.FRAME;
this.updateMatrix = uvNode === null;

this.setUpdateMatrix( this.updateMatrix );

}

Expand All @@ -44,17 +46,29 @@ class TextureNode extends UniformNode {

}

getDefaultUV() {
getDefaultUV( uvNode = null ) {

const texture = this.value;

return uniform( texture.matrix ).mul( vec3( uv( texture.channel ), 1 ) );
if ( uvNode === null ) uvNode = uv( texture.channel );

return uniform( texture.matrix ).mul( vec3( uvNode, 1 ) );

}

setUpdateMatrix( value ) {

this.updateMatrix = value;
this.updateType = value ? NodeUpdateType.FRAME : NodeUpdateType.NONE;

return this;

}

construct( builder ) {

const properties = builder.getNodeProperties( this );
const texture = this.value;

//

Expand All @@ -66,7 +80,15 @@ class TextureNode extends UniformNode {

}

uvNode || ( uvNode = this.getDefaultUV() );
if ( this.updateMatrix ) {

uvNode = this.getDefaultUV( uvNode );

} else if ( ! uvNode ) {

uvNode = uv( texture.channel );

}

//

Expand Down
302 changes: 0 additions & 302 deletions examples/jsm/renderers/common/nodes/NodeRender.js

This file was deleted.

2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Nodes extends DataMap {

}

backgroundNode = texture( background, nodeUV );
backgroundNode = texture( background, nodeUV ).setUpdateMatrix( true );

} else if ( background.isColor !== true ) {

Expand Down
12 changes: 6 additions & 6 deletions examples/jsm/renderers/webgpu/utils/WebGPUConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ export const GPUFilterMode = {
export const GPUBlendFactor = {
Zero: 'zero',
One: 'one',
SrcColor: 'src-color',
OneMinusSrcColor: 'one-minus-src-color',
Src: 'src',
OneMinusSrc: 'one-minus-src',
SrcAlpha: 'src-alpha',
OneMinusSrcAlpha: 'one-minus-src-alpha',
DstColor: 'dst-color',
OneMinusDstColor: 'one-minus-dst-color',
Dst: 'dst',
OneMinusDstColor: 'one-minus-dst',
DstAlpha: 'dst-alpha',
OneMinusDstAlpha: 'one-minus-dst-alpha',
SrcAlphaSaturated: 'src-alpha-saturated',
BlendColor: 'blend-color',
OneMinusBlendColor: 'one-minus-blend-color'
Constant: 'constant',
OneMinusConstant: 'one-minus-constant'
};

export const GPUBlendOperation = {
Expand Down
Loading