-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_info_light.c
52 lines (48 loc) · 1.37 KB
/
get_info_light.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_light.c for get_info_light in /home/nicolas/Modules/gfx_raytracer1
**
** Made by menett_a
** Login <[email protected]>
**
** Started on Tue Mar 8 15:53:28 2016 menett_a
** Last update Wed Mar 9 17:26:49 2016 menett_a
*/
#include <lapin.h>
#include <math.h>
#include "struct.h"
#include "proto.h"
char *get_ini_fields_light(t_bunny_ini *ini, t_info *info, int *nb, int l)
{
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "light", *nb),
&info->light[l].pos_x) == -1)
return ("Error while getting info of light's pos_x\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "light", *nb),
&info->light[l].pos_y) == -1)
return ("Error while getting info of light's pos_x\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "light", *nb),
&info->light[l].pos_z) == -1)
return ("Error while getting info of light's pos_x\n");
*nb = *nb + 1;
if (my_getnbr(bunny_ini_get_field(ini, "raytracer1", "light", *nb),
&info->light[l].brt) == -1)
return ("Error while getting info of light's brightness\n");
*nb = *nb + 1;
return (NULL);
}
char *get_info_light(t_bunny_ini *ini, t_info *info)
{
char *str;
int l;
int nb;
nb = 1;
l = 0;
while (l < info->nb_light)
{
if ((str = get_ini_fields_light(ini, info, &nb, l)) != NULL)
return (str);
l = l + 1;
}
return (NULL);
}