Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ac23d85
init nodematerial webgpu
sunag Sep 26, 2020
f738e6a
init: minimalist new nodematerial system
sunag Sep 28, 2020
6e1bca1
Merge remote-tracking branch 'upstream/dev' into nodematerial-webgpu
sunag Sep 28, 2020
901534b
Merge remote-tracking branch 'upstream/dev' into nodematerial-webgpu
sunag Sep 28, 2020
bc1f1ec
init implement uniforms and auto type convertion
sunag Sep 29, 2020
5f511a9
cleanup
sunag Sep 29, 2020
806eb90
add opacityNode and rename to colorNode property
sunag Sep 29, 2020
535a449
move nodes to webgpu_sandbox example
sunag Sep 29, 2020
99cced5
add PointsMaterial node system
sunag Sep 29, 2020
338842f
PointsMaterial: node opacity
sunag Sep 29, 2020
cc8b95f
Merge branch 'dev' into nodematerial-webgpu
sunag Nov 15, 2020
d68021b
rename createUniform to getUniform
sunag Nov 25, 2020
d0664b7
rename createUniform to getUniform (2)
sunag Nov 25, 2020
07bf1f8
comment transparent
sunag Nov 25, 2020
fc1288f
cleanup debug code
sunag Nov 25, 2020
911722f
update node snippets
sunag Nov 25, 2020
24ccdf0
mrdoob approves
sunag Nov 25, 2020
c566026
rename getNodeBindings to getBindings
sunag Nov 26, 2020
6793b34
rename uniformGroup to uniform
sunag Nov 26, 2020
a7a305f
fix rename https://github.com/mrdoob/three.js/pull/20421/commits/6793…
sunag Dec 22, 2020
f5d4881
fix rename (2)
sunag Dec 22, 2020
07bad2f
rename gpuUniform to webgpuUniform in nodeData
sunag Dec 22, 2020
e56128b
template string
sunag Jan 7, 2021
8622549
wip texturenode
sunag Jan 7, 2021
99e60ad
AttributeNode WIP
sunag Jan 10, 2021
28b246f
move shaderlib
sunag Jan 20, 2021
a138da6
new nodes
sunag Jan 20, 2021
86db129
nodematerial webgpu
sunag Jan 20, 2021
de4ed0c
update webgpu examples
sunag Jan 20, 2021
0342a26
Merge branch 'dev' into nodematerial-webgpu
sunag Jan 20, 2021
b0a7b5d
remove unused var
sunag Jan 20, 2021
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
38 changes: 38 additions & 0 deletions examples/jsm/renderers/nodes/accessors/UVNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import AttributeNode from '../core/AttributeNode.js';

class UVNode extends AttributeNode {

constructor( index = 0 ) {

super( 'vec2' );

this.index = index;

}

getIndexProperty( prefix ) {

return prefix + ( this.index > 0 ? this.index + 1 : '' );

}

getAttributeName( /*builder*/ ) {

return this.getIndexProperty( 'uv' );

}

getAttributeProperty( builder ) {

// customize 'uv' property
const property = this.getIndexProperty( 'vUv' );

this.setAttributeProperty( property );

return super.getAttributeProperty( builder );

}

}

export default UVNode;
54 changes: 54 additions & 0 deletions examples/jsm/renderers/nodes/core/AttributeNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Node from './Node.js';

class AttributeNode extends Node {

constructor( type, name = null, property = null ) {

super( type );

this.name = name;
this.property = property;

}

setAttributeName( name ) {

this.name = name;

return this;

}

getAttributeName( /*builder*/ ) {

return this.name;

}

setAttributeProperty( name ) {

this.property = name;

return this;

}

getAttributeProperty( builder ) {

const attribute = builder.getAttribute( this.getType( builder ), this.getAttributeName( builder ), this.property );

return attribute.property;

}

generate( builder, output ) {

const attributeProperty = this.getAttributeProperty( builder );

return builder.format( attributeProperty, this.getType( builder ), output );

}

}

export default AttributeNode;
56 changes: 56 additions & 0 deletions examples/jsm/renderers/nodes/core/InputNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Node from './Node.js';

class InputNode extends Node {

constructor( type ) {

super( type );

this.constant = false;

Object.defineProperty( this, 'isInputNode', { value: true } );

}

setConst( value ) {

this.constant = value;

return this;

}

getConst() {

return this.constant;

}

generateConst( builder ) {

return builder.getConst( this.getType( builder ), this.value );

}

generate( builder, output ) {

const type = this.getType( builder );

if ( this.constant === true ) {

return builder.format( this.generateConst( builder ), type, output );

} else {

const nodeUniform = builder.getUniformFromNode( this, builder.shaderStage, this.getType( builder ) );
const propertyName = builder.getPropertyName( nodeUniform );

return builder.format( propertyName, type, output );

}

}

}

export default InputNode;
41 changes: 41 additions & 0 deletions examples/jsm/renderers/nodes/core/Node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class Node {

constructor( type = null ) {

this.type = type;

this.needsUpdate = false;

Object.defineProperty( this, 'isNode', { value: true } );

}

getType( /*builder*/ ) {

return this.type;

}

update( /*frame*/ ) {

console.warn( "Abstract function." );

}

generate( /*builder, output*/ ) {

console.warn( "Abstract function." );

}

build( builder, output ) {

builder.addNode( this );

return this.generate( builder, output );

}

}

export default Node;
Loading