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: Texture2D Array #27190

Merged
merged 6 commits into from
Nov 16, 2023
Prev Previous commit
Next Next commit
Simplifies the name of IBL context functions
  • Loading branch information
sunag committed Nov 16, 2023
commit 814e346a4280b5b17c3cb36974eac7b93d42d7b7
12 changes: 6 additions & 6 deletions examples/jsm/nodes/accessors/TextureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class TextureNode extends UniformNode {

let uvNode = this.uvNode;

if ( ( uvNode === null || builder.context.forceUVContext === true ) && builder.context.getUVNode ) {
if ( ( uvNode === null || builder.context.forceUVContext === true ) && builder.context.getUV ) {

uvNode = builder.context.getUVNode( this );
uvNode = builder.context.getUV( this );

}

Expand All @@ -104,15 +104,15 @@ class TextureNode extends UniformNode {

let levelNode = this.levelNode;

if ( levelNode === null && builder.context.getTextureLevelNode ) {
if ( levelNode === null && builder.context.getTextureLevel ) {

levelNode = builder.context.getTextureLevelNode( this );
levelNode = builder.context.getTextureLevel( this );

}

if ( levelNode !== null && builder.context.getTextureLevelAlgorithmNode !== undefined ) {
if ( levelNode !== null && builder.context.getTextureLevelAlgorithm !== undefined ) {

levelNode = builder.context.getTextureLevelAlgorithmNode( this, levelNode );
levelNode = builder.context.getTextureLevelAlgorithm( this, levelNode );

}

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/display/BumpMapNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const dHdxy_fwd = tslFn( ( { textureNode, bumpScale } ) => {
const uvNode = texNode.uvNode || uv();

// It's used to preserve the same TextureNode instance
const sampleTexture = ( uv ) => textureNode.cache().context( { getUVNode: () => uv, forceUVContext: true } );
const sampleTexture = ( uv ) => textureNode.cache().context( { getUV: () => uv, forceUVContext: true } );

return vec2(
float( sampleTexture( uvNode.add( uvNode.dFdx() ) ) ).sub( Hll ),
Expand Down
12 changes: 6 additions & 6 deletions examples/jsm/nodes/lighting/EnvironmentNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const createRadianceContext = ( roughnessNode, normalViewNode ) => {
let textureUVNode = null;

return {
getUVNode: ( textureNode ) => {
getUV: ( textureNode ) => {

let node = null;

Expand Down Expand Up @@ -121,12 +121,12 @@ const createRadianceContext = ( roughnessNode, normalViewNode ) => {
return node;

},
getTextureLevelNode: () => {
getTextureLevel: () => {

return roughnessNode;

},
getTextureLevelAlgorithmNode: ( textureNode, levelNode ) => {
getTextureLevelAlgorithm: ( textureNode, levelNode ) => {

return specularMIPLevel( textureNode, levelNode );

Expand All @@ -140,7 +140,7 @@ const createIrradianceContext = ( normalWorldNode ) => {
let textureUVNode = null;

return {
getUVNode: ( textureNode ) => {
getUV: ( textureNode ) => {

let node = null;

Expand All @@ -166,12 +166,12 @@ const createIrradianceContext = ( normalWorldNode ) => {
return node;

},
getTextureLevelNode: () => {
getTextureLevel: () => {

return float( 1 );

},
getTextureLevelAlgorithmNode: ( textureNode, levelNode ) => {
getTextureLevelAlgorithm: ( textureNode, levelNode ) => {

return specularMIPLevel( textureNode, levelNode );

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/renderers/common/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class Background extends DataMap {

this.backgroundMeshNode = context( backgroundNode, {
// @TODO: Add Texture2D support using node context
getUVNode: () => normalWorld,
getSamplerLevelNode: () => backgroundBlurriness
getUV: () => normalWorld,
getTextureLevel: () => backgroundBlurriness
} ).mul( backgroundIntensity );

let viewProj = modelViewProjection();
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_cubemap_adjustments.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
scene.environmentNode = getEnvironmentNode( reflectVector, positionWorld );

scene.backgroundNode = getEnvironmentNode( positionWorldDirection, positionLocal ).context( {
getTextureLevelNode: ( textureNode ) => blurNode.mul( maxMipLevel( textureNode ) )
getTextureLevel: ( textureNode ) => blurNode.mul( maxMipLevel( textureNode ) )
} );

// scene objects
Expand Down
2 changes: 1 addition & 1 deletion examples/webgpu_cubemap_mix.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
scene.environmentNode = mix( cubeTexture( cube2Texture ), cubeTexture( cube1Texture ), oscSine( timerLocal( .1 ) ) );

scene.backgroundNode = scene.environmentNode.context( {
getTextureLevelNode: ( textureNode ) => maxMipLevel( textureNode )
getTextureLevel: ( textureNode ) => maxMipLevel( textureNode )
} );

const loader = new GLTFLoader().setPath( 'models/gltf/DamagedHelmet/glTF/' );
Expand Down