добавь поддержку нескольких камер. с выбором текущей(активной)
package com.cgvsu;

import com.cgvsu.math.Matrix4f;
import com.cgvsu.math.Vector3f;
import com.cgvsu.model.Model;
import com.cgvsu.objreader.ObjReader;
import com.cgvsu.render_engine.Camera;
import com.cgvsu.render_engine.GraphicConveyor;
import com.cgvsu.render_engine.RenderEngine;
import com.cgvsu.render_engine.TransformationParameters;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.Duration;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class GuiController {


    final private float TRANSLATION = 0.5F;
    @FXML
    public CheckBox checkBoxUseFillPolygon;
    @FXML
    public CheckBox checkBoxUseIntrLighting;
    @FXML
    public CheckBox checkBoxUseFlatLighting;

    public CheckBox checkBoxWireframe;

    public CheckBox checkboxUsePolygonalGrid;



    @FXML
    private CheckBox checkBoxUseTexture;
    @FXML
    AnchorPane anchorPane;
    RenderEngine renderEngine = new RenderEngine();
    @FXML
    private Canvas canvas;
    @FXML
    private VBox modelsManager;
    @FXML
    private TextField textFieldScaleX;
    @FXML
    private TextField textFieldScaleY;
    @FXML
    private TextField textFieldScaleZ;
    @FXML
    private TextField textFieldRotationX;
    @FXML
    private TextField textFieldRotationY;
    @FXML
    private TextField textFieldRotationZ;
    @FXML
    private TextField textFieldTranslationX;
    @FXML
    private TextField textFieldTranslationY;
    @FXML
    private TextField textFieldTranslationZ;
    @FXML
    private VBox camerasManager;
    @FXML
    private TextField textFieldCameraPositionX;
    @FXML
    private TextField textFieldCameraPositionY;
    @FXML
    private TextField textFieldCameraPositionZ;
    @FXML
    private TextField textFieldCameraPointOfDirectionX;
    @FXML
    private TextField textFieldCameraPointOfDirectionY;
    @FXML
    private TextField textFieldCameraPointOfDirectionZ;
    @FXML
    private VBox lightingModelsManager;

    @FXML
    private TextField textFieldLightingModelDirectionX;
    @FXML
    private TextField textFieldLightingModelDirectionY;
    @FXML
    private TextField textFieldLightingModelDirectionZ;
    private Model mesh = null;
    private int counterModels = 0;
    private int counterCameras = 0;
    private int counterLightingModels = 0;

    private Camera camera = new Camera(
            new Vector3f(0, 0, 100),
            new Vector3f(0, 0, 0),
            0.3F, 1, 25F, 1000);

    private Timeline timeline;

    private boolean isLeftButtonPressed = false;
    private double lastMouseX, lastMouseY;
    private boolean isCtrlPressed = false;
    private float speed = 0.01F;
    private float distance = 100.0f; // Расстояние от камеры до цели
    private float azimuth = 0.0f;    // Азимут (горизонтальный угол)
    private float elevation = 0.0f;  // Склонение (вертикальный угол)

    @FXML
    private void loadModelFromFile() {
        FileChooser fileChooser = new FileChooser();
        fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Model (*.obj)", "*.obj"));
        fileChooser.setTitle("Load Model");

        File initialDirectory = new File("3DModels");
        if (initialDirectory.exists()) {
            fileChooser.setInitialDirectory(initialDirectory);
        }

        File file = fileChooser.showOpenDialog((Stage) canvas.getScene().getWindow());
        if (file == null) {
            return;
        }

        Path fileName = Path.of(file.getAbsolutePath());

        try {
            String fileContent = Files.readString(fileName);
            mesh = ObjReader.read(fileContent);

            mesh.triangulate();
            // todo: обработка ошибок
        } catch (IOException exception) {

        }
    }

    @FXML
    private void saveModelFromFile() {
        // objWriter
    }

    @FXML
    public void initialize() {
        this.azimuth = 0.0f;
        this.elevation = 0.0f;
        this.distance = 100.0f;

        // Устанавливаем начальное положение камеры

        canvas.setOnScroll(event -> {
            double delta = event.getDeltaY();
            float zoomSensitivity = 0.1f;
            distance -= (float) (delta * zoomSensitivity);
            distance = Math.max(10.0f, distance); // Минимальное расстояние
            updateCameraPosition();
            render();
        });

        // Создаем группу
        ToggleGroup toggleGroup = new ToggleGroup();

        // Добавляем RadioMenuItem в группу
        withParallelizationMenuItem.setToggleGroup(toggleGroup);
        withoutParallelizationMenuItem.setToggleGroup(toggleGroup);

        // Устанавливаем начальное состояние (по желанию)
        withParallelizationMenuItem.setSelected(true);

        canvas.setOnMousePressed(this::handleMousePressed);
        canvas.setOnMouseReleased(this::handleMouseReleased);
        canvas.setOnMouseDragged(this::handleMouseDragged);

        updateCameraPosition();
        startRendering();
    }


// вообще, по красоте, это все надо в камеру, наверное всунуть... раз уж мы будем делать несколько камер

    private void updateCameraPosition() {
        // Преобразуем сферические координаты в декартовы

        double radAzimuth = Math.toRadians(azimuth);
        double radElevation = Math.toRadians(elevation);


        float x = (float) (distance * Math.cos(radElevation) * Math.sin(radAzimuth));
        float y = (float) (distance * Math.sin(radElevation));
        float z = (float) (distance * Math.cos(radElevation) * Math.cos(radAzimuth));

        Vector3f newPosition = new Vector3f(x, y, z).add(camera.getTarget());
        camera.setPosition(newPosition);
    }

    private void handleMousePressed(MouseEvent event) {
        if (event.isPrimaryButtonDown()) {
            isLeftButtonPressed = true;
            lastMouseX = event.getX();
            lastMouseY = event.getY();
            isCtrlPressed = event.isControlDown();
        }
    }

    private void handleMouseReleased(MouseEvent event) {
        if (!event.isPrimaryButtonDown()) {
            isLeftButtonPressed = false;
        }
    }

    private void handleMouseDragged(MouseEvent event) {

        if (isLeftButtonPressed) {
            double deltaX = event.getX() - lastMouseX;
            double deltaY = event.getY() - lastMouseY;

            if (!isCtrlPressed) {
                float sensitivity = 0.5f; // Чувствительность вращения
                azimuth += (float) (deltaX * sensitivity);
                elevation += (float) (deltaY * sensitivity);


                // я манал, он зеркалит, а с этой фигней не вращает до конца... .... ... ... .. . . .. ..
                elevation = Math.max(-87, Math.min(87, elevation));

                azimuth = azimuth % 360;
                if (azimuth < 0) {
                    azimuth += 360;
                }
                updateCameraPosition();
            } else {

                // перемещение цели камеры
                float panSensitivity = 0.05f;
                Vector3f right = camera.getTarget().sub(camera.getPosition());
                right.normalize();

                Vector3f up = new Vector3f(0, 1, 0);
                right = right.cross(up);
                right.normalize();


                right.multiply((float) deltaX * panSensitivity);
                up.multiply((float) deltaY * panSensitivity);
                right = right.add(up);

                camera.setTarget(camera.getTarget().add(right));
                updateCameraPosition();
            }

            lastMouseX = event.getX();
            lastMouseY = event.getY();

            render();
        }
    }

    @FXML
    public void handleCameraForward(ActionEvent actionEvent) {
        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(0, 0, -TRANSLATION));
        camera.setPosition(newPosition);
    }

    @FXML
    public void handleCameraBackward(ActionEvent actionEvent) {

        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(0, 0, TRANSLATION));
        camera.setPosition(newPosition);
    }

    @FXML
    public void handleCameraLeft(ActionEvent actionEvent) {
        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(TRANSLATION, 0, 0));
        camera.setPosition(newPosition);
    }

    @FXML
    public void handleCameraRight(ActionEvent actionEvent) {
        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(-TRANSLATION, 0, 0));
        camera.setPosition(newPosition);
    }

    @FXML
    public void handleCameraUp(ActionEvent actionEvent) {
        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(0, TRANSLATION, 0));
        camera.setPosition(newPosition);
    }

    @FXML
    public void handleCameraDown(ActionEvent actionEvent) {
        Vector3f currentPosition = camera.getPosition();
        Vector3f newPosition = currentPosition.add(new Vector3f(0, -TRANSLATION, 0));
        camera.setPosition(newPosition);
    }


    private TransformationParameters parseParameters() throws NumberFormatException {
        TransformationParameters params = new TransformationParameters();
        params.setAlpha(Double.parseDouble(textFieldRotationX.getText()));
        params.setBeta(Double.parseDouble(textFieldRotationY.getText()));
        params.setGamma(Double.parseDouble(textFieldRotationZ.getText()));

        params.setTranslationX(Double.parseDouble(textFieldTranslationX.getText()));
        params.setTranslationY(Double.parseDouble(textFieldTranslationY.getText()));
        params.setTranslationZ(Double.parseDouble(textFieldTranslationZ.getText()));

        params.setScaleX(Double.parseDouble(textFieldScaleX.getText()));
        params.setScaleY(Double.parseDouble(textFieldScaleY.getText()));
        params.setScaleZ(Double.parseDouble(textFieldScaleZ.getText()));

        return params;
    }

    private void showErrorAlert(String title, String header, String content) {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle(title);
        alert.setHeaderText(header);
        alert.setContentText(content);
        alert.showAndWait();
    }


    @FXML
    private void recalculationOfNormals() {
        if (mesh != null) {
            TransformationParameters params;
            try {
                params = parseParameters();
            } catch (NumberFormatException e) {
                showErrorAlert("Ошибка ввода", "Некорректные данные",
                        "Пожалуйста, убедитесь, что все поля содержат числовые значения.");
                return;
            }

            Vector3f rota = new Vector3f((float) params.getAlpha(), (float) params.getBeta(), (float) params.getGamma());
            Vector3f scale = new Vector3f((float) params.getScaleX(), (float) params.getScaleY(), (float) params.getScaleZ());
            Vector3f trans = new Vector3f((float) params.getTranslationX(), (float) params.getTranslationY(), (float) params.getTranslationZ());


            Matrix4f MAT = GraphicConveyor.scaleRotateTranslate(rota, scale, trans);


            mesh.getVertices().replaceAll(vector3f -> GraphicConveyor.multiplyMatrix4ByVector3(MAT, vector3f));
            mesh.calculateNormals();
        }


    }

    @FXML
    private void addNewCamera() {
        // для кнопки
    }

    @FXML
    private void addNewLightingModel() {
        // для кнопки
    }


    private void startRendering() {
        if (timeline == null) {
            timeline = new Timeline(new KeyFrame(Duration.millis(20), event -> render()));
            timeline.setCycleCount(Animation.INDEFINITE);
            timeline.play();
        }
    }

    private void render() {
        double width = canvas.getWidth();
        double height = canvas.getHeight();

        canvas.getGraphicsContext2D().clearRect(0, 0, width, height);
        camera.setAspectRatio((float) (width / height));

        if (mesh != null) {
            renderEngine.render(canvas.getGraphicsContext2D(), camera, mesh, (int) width, (int) height);
        }

    }


    private void addModelControlButtons() {
        counterModels++;

        Button modelButton = new Button("Model " + counterModels);
        modelButton.setOnAction(event -> selectActiveModel(counterModels));


        Button addTextureButton = new Button("Add Texture");
        addTextureButton.setOnAction(event -> addTexture(counterModels));


        Button removeTextureButton = new Button("Remove Texture");
        removeTextureButton.setOnAction(event -> removeTexture(counterModels));


        Button deleteModelButton = new Button("Delete");
        deleteModelButton.setOnAction(event -> deleteModel(counterModels, modelButton));


        HBox modelControls = new HBox(5, modelButton, addTextureButton, removeTextureButton, deleteModelButton);


        modelsManager.getChildren().add(modelControls);
    }

    private void selectActiveModel(int modelId) {

    }

    private void addTexture(int modelId) {
        FileChooser fileChooser = new FileChooser();
        fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Model (*.png)", "*.png"));
        fileChooser.setTitle("Load Textrure");

        File initialDirectory = new File("3DModels");
        if (initialDirectory.exists()) {
            fileChooser.setInitialDirectory(initialDirectory);
        }

        File file = fileChooser.showOpenDialog((Stage) canvas.getScene().getWindow());
        if (file == null) {
            return;
        }
        String filePath = file.getAbsolutePath();

        mesh.loadTexture(filePath);

    }

    public void loadModel() {
        FileChooser fileChooser = new FileChooser();
        fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Model (*.obj)", "*.obj"));
        fileChooser.setTitle("Load Model");

        File initialDirectory = new File("3DModels");
        if (initialDirectory.exists()) {
            fileChooser.setInitialDirectory(initialDirectory);
        }

        File file = fileChooser.showOpenDialog((Stage) canvas.getScene().getWindow());
        if (file == null) {
            return;
        }

        try {
            String fileContent = Files.readString(Path.of(file.getAbsolutePath()));
            mesh = ObjReader.read(fileContent);
            mesh.calculateNormals();
            mesh.triangulate();

            addModelControlButtons();
            startRendering();
        } catch (IOException e) {
            showErrorAlert("Ошибка загрузки модели", null, "Не удалось загрузить модель: " + e.getMessage());
        }
    }

    private void removeTexture(int modelId) {
        mesh.clearTexture();
    }

    private void deleteModel(int modelId, Button modelButton) {
        // Удаление модели и её контролов
        mesh = null; // Убираем текущую модель
        modelsManager.getChildren().removeIf(node -> node instanceof HBox hBox && hBox.getChildren().contains(modelButton));
    }


    private void addCameraControlButtons() {
        counterCameras++;

        Button cameraButton = new Button("Camera " + counterCameras);
        // здесь возможность выбирать активную камеру, чтобы для нее вводить в поле настройки
        Button deleteCamera = new Button("Delete");
        // кнопку привязать к удалению
        HBox camera = new HBox(5, cameraButton, deleteCamera);

        camerasManager.getChildren().add(camera);
    }

    private void addLightModelControlButtons() {
        counterLightingModels++;

        Button lightModelButton = new Button("Light model " + counterLightingModels);
        // аналогично камере
        Button deleteLightButton = new Button("Delete");
        // кнопку к удалению
        HBox lightModel = new HBox(lightModelButton, deleteLightButton);

        lightingModelsManager.getChildren().add(lightModel);
    }

    @FXML
    public void onClickCanvas() {
        canvas.requestFocus();
    }


    @FXML
    private void returnToTheStartingPosition() {

    }


    @FXML
    private void moveToTheModel() {

    }


    @FXML
    private void handleCheckBoxDrawWireframe() {
        renderEngine.setEnableWireframe(checkBoxWireframe.isSelected());
        render();
    }

    @FXML
    private void handleCheckBoxUseTexture() {
        renderEngine.setEnableTextureMapping(checkBoxUseTexture.isSelected());
        render();
    }

    @FXML
    private void handleCheckBoxUseIntrLighting() {
        renderEngine.setEnableInterpolatedLighting(checkBoxUseIntrLighting.isSelected());
        render();
    }

    @FXML
    private void handleCheckBoxUseFlatLighting() {
        renderEngine.setEnableFlatLighting(checkBoxUseFlatLighting.isSelected());
        render();
    }

    @FXML
    private void handleCheckBoxFillPolygon() {
        renderEngine.setEnableFillPolygon(checkBoxUseFillPolygon.isSelected());
        render();
    }

    @FXML
    private void handleCheckBoxDrawPolygonalGrid() {
        renderEngine.setEnablePolygonalGrid(checkboxUsePolygonalGrid.isSelected());
    }


    @FXML
    private RadioMenuItem withParallelizationMenuItem;

    @FXML
    private RadioMenuItem withoutParallelizationMenuItem;

    @FXML
    private void toggleParallelization() {

        boolean isParallelizationEnabled = withParallelizationMenuItem.isSelected();
        renderEngine.setEnableParallelization(isParallelizationEnabled);
    }
}

и учти мою реализацию вектора 3ф
package com.cgvsu.math;

import java.util.Objects;

// Это заготовка для собственной библиотеки для работы с линейной алгеброй
public class Vector3f extends AbstractVector {
    private float[] components = new float[SIZE];
    private static final int SIZE = 3;

    private float length;

    public float[] getElements() {
        return components;
    }

    public void setElements(float[] components) {
        this.components = components;
    }

    public float getLength() {
        return length;
    }

    public void setLength(float length) {
        this.length = length;
    }

    // Конструкторы + getters and setters
    public Vector3f(float x, float y, float z) {
        this.components[0] = x;
        this.components[1] = y;
        this.components[2] = z;
        calcLength();
    }
    public Vector3f() {
        this.components[0] = 0;
        this.components[1] = 0;
        this.components[2] = 0;
        calcLength();
    }

    public float getX() {
        return components[0];
    }

    public void setX(float x) {
        components[0] = x;
        calcLength();
    }

    public float getY() {
        return components[1];
    }

    public void setY(float y) {
        components[1] = y;
        calcLength();
    }

    public float getZ() {
        return components[2];
    }

    public void setZ(float z) {
        components[2] = z;
        calcLength();
    }

    /**
     * Возвращает компонент вектора по индексу.
     *
     * @param a Индекс компонента (0 для x, 1 для y, 2 для z).
     * @return Значение компонента.
     * @throws IndexOutOfBoundsException если индекс не равен 0, 1 или 2.
     */
    public float getNum(int a) {
        if (a < 0 || a >= components.length) {
            throw new IndexOutOfBoundsException("Invalid index: " + a);
        }
        return components[a];
    }

    /**
     * Заменяет значения для x,y,z по индексу.
     *
     * @param a Индекс компонента (0 для x, 1 для y, 2 для z).
     * @param num Новое число для переменной
     * @throws IndexOutOfBoundsException если индекс не равен 0, 1 или 2.
     */
    public void setNum(int a, float num) {
        if (a < 0 || a >= components.length) {
            throw new IndexOutOfBoundsException("Invalid index: " + a);
        }
        components[a] = num;
    }

    // Метод для вычисления длины вектора
    private void calcLength() {
        length = (float) Math.sqrt(components[0] * components[0]
                + components[1] * components[1]
                + components[2] * components[2]);
    }

    @Override
    public float length() {
        return length;
    }

    // Метод для нормализации вектора
    private void calcNormalize() {
        calcLength();
        if (length == 0) {
            return;
        }
        divide(length);
    }

    @Override
    public void normalize() {
        calcNormalize();
    }


    // Метод сложения векторов
    @Override
    public Vector3f add(AbstractVector other) {
        if (!isVector3f(other)) {
            throw new IllegalArgumentException("Неверный тип вектора для сложения");
        }
        Vector3f o = (Vector3f) other;
        return new Vector3f(
                this.components[0] + o.components[0],
                this.components[1] + o.components[1],
                this.components[2] + o.components[2]
        );
    }

    // Метод вычитания векторов
    @Override
    public Vector3f sub(AbstractVector other) {
        if (!isVector3f(other)) {
            throw new IllegalArgumentException("Неверный тип вектора для вычитания");
        }
        Vector3f o = (Vector3f) other;
        return new Vector3f(
                this.components[0] - o.components[0],
                this.components[1] - o.components[1],
                this.components[2] - o.components[2]
        );
    }

    @Override
    public void sub(AbstractVector other, AbstractVector second) {
        if (!(isVector3f(other) && isVector3f(second))) {
            new Exception("не правильный тип векторов");
        }
        Vector3f o = (Vector3f) other;
        Vector3f s = (Vector3f) second;
        this.components[0] = o.getX() - s.getX();
        this.components[1] = o.getY() - s.getY();
        this.components[2] = o.getZ() - s.getZ();
    }

    // Метод умножения вектора на скаляр
    @Override
    public void multiply(float scalar) {
        for (int i = 0; i < components.length; i++) {
            this.components[i] *= scalar;
        }
        calcLength();
    }

    // Метод деления вектора на скаляр
    @Override
    public void divide(float scalar) {
        if (scalar == 0) throw new ArithmeticException("Деление на ноль");
        for (int i = 0; i < components.length; i++) {
            this.components[i] /= scalar;
        }
        calcLength();
    }

    // Метод скалярного произведения
    @Override
    public float dot(AbstractVector other) {
        if (!isVector3f(other)) {
            throw new IllegalArgumentException("Неверный тип вектора для скалярного произведения");
        }
        Vector3f o = (Vector3f) other;
        return this.components[0] * o.components[0]
                + this.components[1] * o.components[1]
                + this.components[2] * o.components[2];
    }

    // Метод векторного произведения
    public Vector3f cross(Vector3f other) {
        float x = this.components[1] * other.components[2] - this.components[2] * other.components[1];
        float y = this.components[2] * other.components[0] - this.components[0] * other.components[2];
        float z = this.components[0] * other.components[1] - this.components[1] * other.components[0];
        return new Vector3f(x, y, z);
    }

        // Проверка типа вектора
    private boolean isVector3f(AbstractVector other) {
        return other instanceof Vector3f;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (!(obj instanceof Vector3f)) return false;
        Vector3f other = (Vector3f) obj;
        return Float.compare(components[0], other.components[0]) == 0 &&
                Float.compare(components[1], other.components[1]) == 0 &&
                Float.compare(components[2], other.components[2]) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(components[0], components[1], components[2]);
    }

    @Override
    public String toString() {
        return "Vector3f{" +
                "x=" + components[0] +
                ", y=" + components[1] +
                ", z=" + components[2] +
                '}';
    }

}