Example #1
0
t_scene	*get_scene(int fd, char *buffer)
{
  t_scene	*scene;
  int	error;

  if ((error = check_balise(buffer, "scene")) < 0)
    return (NULL);
  scene = malloc(sizeof(*scene));
  scene->attr = get_attr(buffer, scene);
  buffer = get_cam(fd, &(scene->cam), scene);
  if (scene->cam == NULL)
    return (NULL);
  if ((error = check_balise(buffer, "object")) == ERROR_NO_DEF_NAME
      && check_balise(buffer, "light") == ERROR_NO_DEF_NAME)
    return (NULL);
  buffer = get_object(fd, &(scene->obj), scene);
  if (scene->obj == NULL)
    return (NULL);
  buffer = get_next_line(fd);
  if ((error = check_balise(buffer, "light")) == ERROR_NO_DEF_NAME)
    return (NULL);
  buffer = get_light(fd, &(scene->light), scene);
  if (scene->light == NULL)
    return (NULL);
  return (scene);
}
Example #2
0
File: init.c Project: NegMozzie/42
t_lex			*get_gen(t_env *env, t_lex *lex)
{
	while (lex)
	{
		if (!ft_strcmp(lex->str, "<EYE>") && (lex = get_cam(&env->cam, lex->next)))
			continue ;
		else if (!ft_strcmp(lex->str, "<A.A>") && (lex = lex->next))
			env->aa = get_nbr(lex->str);
		else if (!ft_strcmp(lex->str, "<A.T>") && (lex = lex->next))
			env->at = get_nbr(lex->str);
		else if (!ft_strcmp(lex->str, "<AMB>") && (lex = lex->next))
			env->amb = get_nbr(lex->str);
		else
			break;
		lex = lex->next;
	}
	return (lex);
}