#pragma once

#include "canvas_modes.h"
#include "util.h"

class Canvas;

namespace pp::panopainter {

bool legacy_canvas_point_trace(Canvas& canvas, glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
    glm::vec3& hit_pos, glm::vec2& fb_pos, glm::vec3& hit_normal, int& out_plane_id);
bool legacy_canvas_point_trace_plane(Canvas& canvas, glm::vec2 loc, glm::vec3& ray_origin, glm::vec3& ray_dir,
    glm::vec3& hit_pos, glm::vec3& hit_normal, glm::vec2& hit_fb_pos, int plane_id);
void legacy_canvas_point_unproject(glm::vec2 loc, glm::vec4 vp, glm::mat4 camera, glm::mat4 proj,
    glm::vec3& out_origin, glm::vec3& out_dir);
void legacy_canvas_point_unproject(Canvas& canvas, glm::vec2 loc, glm::vec3& out_origin, glm::vec3& out_dir);
glm::vec3 legacy_canvas_point_trace(Canvas& canvas, glm::vec2 loc);
void legacy_canvas_project_2d_points(Canvas& canvas, std::vector<vertex_t>& vertices);
glm::vec3 legacy_canvas_project_2d_point(Canvas& canvas, glm::vec2 pt);
std::vector<glm::vec2> legacy_canvas_face_to_shape_2d(const Canvas& canvas, int plane_index);
void legacy_canvas_push_camera(Canvas& canvas);
void legacy_canvas_pop_camera(Canvas& canvas);
CameraData legacy_canvas_get_camera(const Canvas& canvas);
void legacy_canvas_set_camera(Canvas& canvas, const CameraData& camera);

} // namespace pp::panopainter
