import { NormalBlending, ShaderMaterial } from "three";
import { ScreenSpaceQuadShader } from "../../shaders/ScreenSpaceQuadShader.js";
import { renderScreenSpace } from "./renderScreenSpace.js";

const uniforms = {
    tTexture: {
        type: 't',
        value: null
    }
};

const material = new ShaderMaterial({
    uniforms,
    vertexShader: ScreenSpaceQuadShader.vertexShader(),
    fragmentShader: ScreenSpaceQuadShader.fragmentShader(),
    blending: NormalBlending,
    lights: false,
    fog: false,
    depthTest: false,
    depthWrite: false,
    transparent: true,
    vertexColors: false
});

export function renderTextureToScreenQuad(texture, renderer) {
    uniforms.tTexture.value = texture;

    renderScreenSpace(renderer, material);
}
