model tool progress: initial selection

This commit is contained in:
veclavtalica
2025-03-08 00:50:47 +03:00
parent f5e55bb997
commit c07e16490e
3 changed files with 97 additions and 35 deletions

View File

@ -437,9 +437,6 @@ void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom,
if (!orthographic && fov >= (float)(M_PI))
log_warn("Invalid fov given (%f)", (double)fov);
/* inital zoom = 1.0 correlates to perspective from this */
zoom *= 0.1f;
float const aspect = (float)ctx.base_render_width / (float)ctx.base_render_height;
Camera const camera = {
@ -448,8 +445,8 @@ void draw_camera(Vec3 position, Vec3 direction, Vec3 up, float fov, float zoom,
.target = vec3_norm(direction),
.up = up,
.viewbox = {
aspect/-zoom, aspect/zoom,
1/zoom, 1/-zoom
-aspect/zoom, aspect/zoom,
1/zoom, -1/zoom
},
.far_z = draw_distance
};
@ -511,9 +508,6 @@ DrawCameraUnprojectResult draw_camera_unproject(Vec2 point,
if (!orthographic && fov >= (float)(M_PI))
log_warn("Invalid fov given (%f)", (double)fov);
/* inital zoom = 1.0 correlates to perspective from this */
zoom *= 0.1f;
float const aspect = (float)ctx.base_render_width / (float)ctx.base_render_height;
Camera const camera = {
.fov = fov,
@ -521,8 +515,8 @@ DrawCameraUnprojectResult draw_camera_unproject(Vec2 point,
.target = vec3_norm(direction),
.up = up,
.viewbox = {
aspect/-zoom, aspect/zoom,
1/zoom, 1/-zoom
-aspect/zoom, aspect/zoom,
1/zoom, -1/zoom
},
.far_z = draw_distance
};
@ -534,13 +528,6 @@ DrawCameraUnprojectResult draw_camera_unproject(Vec2 point,
point.y = (float)ctx.base_render_height - point.y;
if (!orthographic) {
point = (Vec2) {
point.x,
point.y,
};
}
Vec4 v;
v.x = 2.0f * point.x / (float)ctx.base_render_width - 1.0f;
v.y = 2.0f * point.y / (float)ctx.base_render_height - 1.0f;