Skip to content

⬅️ Back to Table of Contents

📄 NodeSampledTexture.js

📊 Analysis Summary

Metric Count
🔧 Functions 1
🧱 Classes 3
📦 Imports 1

📚 Table of Contents

🛠️ File Location:

📂 src/renderers/common/nodes/NodeSampledTexture.js

📦 Imports

Name Source
SampledTexture ../SampledTexture.js

Functions

NodeSampledTexture.update(): boolean

JSDoc:

/**
     * Updates the binding.
     *
     * @return {boolean} Whether the texture has been updated and must be
     * uploaded to the GPU.
     */

Returns: boolean

Calls:

  • super.update
Code
update() {

        const { textureNode } = this;

        if ( this.texture !== textureNode.value ) {

            this.texture = textureNode.value;

            return true;

        }

        return super.update();

    }

Classes

NodeSampledTexture

Class Code
class NodeSampledTexture extends SampledTexture {

    /**
     * Constructs a new node-based sampled texture.
     *
     * @param {string} name - The textures's name.
     * @param {TextureNode} textureNode - The texture node.
     * @param {UniformGroupNode} groupNode - The uniform group node.
     * @param {?string} [access=null] - The access type.
     */
    constructor( name, textureNode, groupNode, access = null ) {

        super( name, textureNode ? textureNode.value : null );

        /**
         * The texture node.
         *
         * @type {TextureNode}
         */
        this.textureNode = textureNode;

        /**
         * The uniform group node.
         *
         * @type {UniformGroupNode}
         */
        this.groupNode = groupNode;

        /**
         * The access type.
         *
         * @type {?string}
         * @default null
         */
        this.access = access;

    }

    /**
     * Updates the binding.
     *
     * @return {boolean} Whether the texture has been updated and must be
     * uploaded to the GPU.
     */
    update() {

        const { textureNode } = this;

        if ( this.texture !== textureNode.value ) {

            this.texture = textureNode.value;

            return true;

        }

        return super.update();

    }

}

Methods

update(): boolean
Code
update() {

        const { textureNode } = this;

        if ( this.texture !== textureNode.value ) {

            this.texture = textureNode.value;

            return true;

        }

        return super.update();

    }

NodeSampledCubeTexture

Class Code
class NodeSampledCubeTexture extends NodeSampledTexture {

    /**
     * Constructs a new node-based sampled cube texture.
     *
     * @param {string} name - The textures's name.
     * @param {TextureNode} textureNode - The texture node.
     * @param {UniformGroupNode} groupNode - The uniform group node.
     * @param {?string} [access=null] - The access type.
     */
    constructor( name, textureNode, groupNode, access = null ) {

        super( name, textureNode, groupNode, access );

        /**
         * This flag can be used for type testing.
         *
         * @type {boolean}
         * @readonly
         * @default true
         */
        this.isSampledCubeTexture = true;

    }

}

NodeSampledTexture3D

Class Code
class NodeSampledTexture3D extends NodeSampledTexture {

    /**
     * Constructs a new node-based sampled 3D texture.
     *
     * @param {string} name - The textures's name.
     * @param {TextureNode} textureNode - The texture node.
     * @param {UniformGroupNode} groupNode - The uniform group node.
     * @param {?string} [access=null] - The access type.
     */
    constructor( name, textureNode, groupNode, access = null ) {

        super( name, textureNode, groupNode, access );

        /**
         * This flag can be used for type testing.
         *
         * @type {boolean}
         * @readonly
         * @default true
         */
        this.isSampledTexture3D = true;

    }

}