-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresize_objects.c
42 lines (39 loc) · 1.39 KB
/
resize_objects.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* resize_objects.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: khlavaty <khlavaty@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/12 19:52:54 by khlavaty #+# #+# */
/* Updated: 2024/09/12 19:53:14 by khlavaty ### ########.fr */
/* */
/* ************************************************************************** */
#include "minirt.h"
void resize_objects(t_win *win, int keysym)
{
t_obj *obj;
float scale_factor;
t_sp *sphere;
t_cy *cylinder;
obj = win->map->objects;
if (keysym == KEY_NUMPAD_PLUS)
scale_factor = 1.1;
else
scale_factor = 0.9;
while (obj)
{
if (obj->type == SPHERE)
{
sphere = (t_sp *)obj->object;
sphere->dia *= scale_factor;
}
else if (obj->type == CYLINDER)
{
cylinder = (t_cy *)obj->object;
cylinder->dia *= scale_factor;
cylinder->hth *= scale_factor;
}
obj = obj->next;
}
}