package eu.jonahbauer.raytracing.render.renderer;

import eu.jonahbauer.raytracing.render.camera.Camera;
import eu.jonahbauer.raytracing.render.canvas.Canvas;
import eu.jonahbauer.raytracing.render.canvas.Image;
import eu.jonahbauer.raytracing.scene.Scene;
import org.jetbrains.annotations.NotNull;

public interface Renderer {
    default @NotNull Image render(@NotNull Camera camera, @NotNull Scene scene) {
        var image = new Image(camera.getWidth(), camera.getHeight());
        render(camera, scene, image);
        return image;
    }

    /**
     * Renders the {@code scene} as seen by the {@code camera} to the {@code canvas}.
     */
    void render(@NotNull Camera camera, @NotNull Scene scene, @NotNull Canvas canvas);
}
