Skip to content

⬅️ Back to Table of Contents

📄 BumpMapNode.js

📊 Analysis Summary

Metric Count
🔧 Functions 10
🧱 Classes 1
📦 Imports 9
📊 Variables & Constants 2

📚 Table of Contents

🛠️ File Location:

📂 src/nodes/display/BumpMapNode.js

📦 Imports

Name Source
TempNode ../core/TempNode.js
uv ../accessors/UV.js
normalView ../accessors/Normal.js
positionView ../accessors/Position.js
faceDirection ./FrontFacingNode.js
Fn ../tsl/TSLBase.js
nodeProxy ../tsl/TSLBase.js
float ../tsl/TSLBase.js
vec2 ../tsl/TSLBase.js

Variables & Constants

Name Type Kind Value Exported
vN any let/var surf_norm
bumpScale any let/var this.scaleNode !== null ? this.scaleNode : 1

Functions

sampleTexture(callback: any): any

Parameters:

  • callback any

Returns: any

Calls:

  • textureNode.cache().context
Code
( callback ) => textureNode.cache().context( { getUV: ( texNode ) => callback( texNode.uvNode || uv() ), forceUVContext: true } )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

getUV(texNode: any): any

Parameters:

  • texNode any

Returns: any

Calls:

  • callback
Code
( texNode ) => callback( texNode.uvNode || uv() )

BumpMapNode.setup(): void

Returns: void

Calls:

  • dHdxy_fwd
  • perturbNormalArb
Code
setup() {

        const bumpScale = this.scaleNode !== null ? this.scaleNode : 1;
        const dHdxy = dHdxy_fwd( { textureNode: this.textureNode, bumpScale } );

        return perturbNormalArb( {
            surf_pos: positionView,
            surf_norm: normalView,
            dHdxy
        } );

    }

Classes

BumpMapNode

Class Code
class BumpMapNode extends TempNode {

    static get type() {

        return 'BumpMapNode';

    }

    /**
     * Constructs a new bump map node.
     *
     * @param {Node<float>} textureNode - Represents the bump map data.
     * @param {?Node<float>} [scaleNode=null] - Controls the intensity of the bump effect.
     */
    constructor( textureNode, scaleNode = null ) {

        super( 'vec3' );

        /**
         * Represents the bump map data.
         *
         * @type {Node<float>}
         */
        this.textureNode = textureNode;

        /**
         * Controls the intensity of the bump effect.
         *
         * @type {?Node<float>}
         * @default null
         */
        this.scaleNode = scaleNode;

    }

    setup() {

        const bumpScale = this.scaleNode !== null ? this.scaleNode : 1;
        const dHdxy = dHdxy_fwd( { textureNode: this.textureNode, bumpScale } );

        return perturbNormalArb( {
            surf_pos: positionView,
            surf_norm: normalView,
            dHdxy
        } );

    }

}

Methods

setup(): void
Code
setup() {

        const bumpScale = this.scaleNode !== null ? this.scaleNode : 1;
        const dHdxy = dHdxy_fwd( { textureNode: this.textureNode, bumpScale } );

        return perturbNormalArb( {
            surf_pos: positionView,
            surf_norm: normalView,
            dHdxy
        } );

    }