Skip to content

Commit

Permalink
WebGPUBindings: Improve comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Sep 13, 2020
1 parent 12d17f2 commit c95ea0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
22 changes: 13 additions & 9 deletions examples/jsm/renderers/webgpu/WebGPUBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ class WebGPUBindings {

const bindings = [];

// ubos
// UBOs

// model

const modelViewUniform = new Matrix4Uniform( 'modelMatrix' );
const modelViewMatrixUniform = new Matrix4Uniform( 'modelViewMatrix' );
Expand All @@ -243,12 +245,14 @@ class WebGPUBindings {

} );

// opacity

const opacityUniform = new FloatUniform( 'opacity', 1 );
// camera

const cameraGroup = this.sharedUniformsGroups.get( 'cameraUniforms' );

// material (opacity for testing)

const opacityUniform = new FloatUniform( 'opacity', 1 );

const opacityGroup = new WebGPUUniformsGroup();
opacityGroup.setName( 'opacityUniforms' );
opacityGroup.addUniform( opacityUniform );
Expand All @@ -262,17 +266,17 @@ class WebGPUBindings {

} );

// samplers
// sampler

const diffuseSampler = new WebGPUSampler();
diffuseSampler.setName( 'map' );

// textures
// texture

const diffuseTexture = new WebGPUSampledTexture();
diffuseTexture.setName( 'map' );

//
// the order of WebGPUBinding objects must match the binding order in the shader

bindings.push( modelGroup );
bindings.push( cameraGroup );
Expand All @@ -288,7 +292,7 @@ class WebGPUBindings {

const bindings = [];

// ubos
// UBOs

const modelViewUniform = new Matrix4Uniform( 'modelMatrix' );
const modelViewMatrixUniform = new Matrix4Uniform( 'modelViewMatrix' );
Expand Down Expand Up @@ -319,7 +323,7 @@ class WebGPUBindings {

const bindings = [];

// ubos
// UBOs

const modelViewUniform = new Matrix4Uniform( 'modelMatrix' );
const modelViewMatrixUniform = new Matrix4Uniform( 'modelViewMatrix' );
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/renderers/webgpu/WebGPUUniformsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class WebGPUUniformsGroup extends WebGPUBinding {
super();

this.name = '';

// the order of uniforms in this array must match the order of uniforms in the shader

this.uniforms = [];

this.onBeforeUpdate = function () {};
Expand Down

0 comments on commit c95ea0b

Please sign in to comment.