-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_info_cylinder.c
52 lines (48 loc) · 1.38 KB
/
get_info_cylinder.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
43
44
45
46
47
48
49
50
51
52
/*
** get_info_cylinder.c for get_info_cylinder in /home/nicolas/Modules/gfx_raytracer1
**
** Made by menett_a
** Login <[email protected]>
**
** Started on Sat Mar 5 16:27:18 2016 menett_a
** Last update Wed Mar 9 17:28:44 2016 menett_a
*/
#include <lapin.h>
#include <math.h>
#include "struct.h"
#include "proto.h"
char *get_ini_fields_cyli(t_bunny_ini *ini, t_info *info, int *nb, int cyli)
{
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "cyli", *nb),
&info->cyli[cyli].pos_y) == -1)
return ("Error while getting cylinder's pos_y\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "cyli", *nb),
&info->cyli[cyli].pos_z) == -1)
return ("Error while getting cylinder's pos_z\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "cyli", *nb),
&info->cyli[cyli].radius) == -1)
return ("Error while getting cylinder's radius\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "cyli", *nb),
&info->cyli[cyli].color) == -1)
return ("Error while getting cylinder's color\n");
*nb = *nb + 1;
return (NULL);
}
char *get_info_cylinder(t_bunny_ini *ini, t_info *info)
{
char *str;
int cyli;
int nb;
nb = 1;
cyli = 0;
while (cyli < info->nb_cyli)
{
if ((str = get_ini_fields_cyli(ini, info, &nb, cyli)) != NULL)
return (str);
cyli = cyli + 1;
}
return (NULL);
}