Ejemplo n.º 1
0
static void			la_norme_a_pas_dit_bonjour(char **line, t_obj *object,
												int i, int fd)
{
	if ((*line)[i] && strncmp(*line + i, "brightness", 10) == 0)
		object->brightness = parse_brightness(fd);
	else if ((*line)[i] && strncmp(*line + i, "sphere", 6) == 0)
		create_sphere(object, fd);
	else if ((*line)[i] && strncmp(*line + i, "cylinder", 8) == 0)
		create_cylinder(object, fd);
	else if ((*line)[i] && strncmp(*line + i, "cone", 4) == 0)
		create_cone(object, fd);
	else if ((*line)[i] && strncmp(*line + i, "para", 4) == 0)
		create_para(object, fd);
	else if ((*line)[i] && strncmp(*line + i, "plan", 4) == 0)
		create_plan(object, fd);
	else if ((*line)[i] && strncmp(*line + i, "spec", 4) == 0)
		object->spec = parse_brightness(fd);
	else if ((*line)[i] && strncmp(*line + i, "transpa", 7) == 0)
		object->transpa = parse_brightness(fd);
	else if ((*line)[i] && strncmp(*line + i, "indice", 6) == 0)
		object->indice = parse_brightness(fd);
	else if ((*line)[i] && strncmp(*line + i, "texture", 7) == 0)
		object->texture = parse_texture(fd);
	else if ((*line)[i] && strncmp(*line + i, "normal", 6) == 0)
		object->normal_map = parse_normal_map(fd);
	else if ((*line)[i] && strncmp(*line + i, "rep", 3) == 0)
		object->rep = parse_object_rep(fd);
}
Ejemplo n.º 2
0
void parse_world(FILE *fp, World *w)
{
    char tokenbuf[STRING_TOKEN_MAX_LENGTH];

    while (get_string_token(fp, tokenbuf) != Token_EOF) {
        if (strcmp(tokenbuf, "texture") == 0)
            parse_texture(fp, w);
        else if (strcmp(tokenbuf, "wall") == 0)
            parse_wall(fp, w);
        else if (strcmp(tokenbuf, "region") == 0)
            parse_region(fp, w);
        else if (strcmp(tokenbuf, "vertex") == 0)
            parse_vertex(fp, w);
        else
            parse_error("unknown structure type");
    }
}