import { ForwardPlusThreeMaterial } from "./ForwardPlusThreeMaterial.js";

export class ForwardPlusThreeShaderMaterial extends ForwardPlusThreeMaterial {
    /**
     *
     * @param {ShaderMaterial} source
     */
    constructor(source) {
        super(source);

        // copy extensions
        for (const extensionsKey in source.extensions) {
            this.extensions[extensionsKey] = source.extensions[extensionsKey];
        }
    }

    copy_basic(material) {
        // copy uniforms
        const other_uniforms = material.uniforms;
        const this_uniforms = this.uniforms;

        for (const uniformsKey in other_uniforms) {
            const u_this = this_uniforms[uniformsKey];
            const u_that = other_uniforms[uniformsKey];

            if (u_that !== undefined && u_this !== undefined) {
                this_uniforms[uniformsKey] = u_that;
            }
        }
    }
}
