void traverse_commit_list(struct rev_info *revs, void (*show_commit)(struct commit *), void (*show_object)(struct object_array_entry *)) { int i; struct commit *commit; struct object_array objects = { 0, 0, NULL }; while ((commit = get_revision(revs)) != NULL) { process_tree(revs, commit->tree, &objects, NULL, ""); show_commit(commit); } for (i = 0; i < revs->pending.nr; i++) { struct object_array_entry *pending = revs->pending.objects + i; struct object *obj = pending->item; const char *name = pending->name; if (obj->flags & (UNINTERESTING | SEEN)) continue; if (obj->type == OBJ_TAG) { obj->flags |= SEEN; add_object_array(obj, name, &objects); continue; } if (obj->type == OBJ_TREE) { process_tree(revs, (struct tree *)obj, &objects, NULL, name); continue; } if (obj->type == OBJ_BLOB) { process_blob(revs, (struct blob *)obj, &objects, NULL, name); continue; } die("unknown pending object %s (%s)", sha1_to_hex(obj->sha1), name); } for (i = 0; i < objects.nr; i++) show_object(&objects.objects[i]); free(objects.objects); if (revs->pending.nr) { free(revs->pending.objects); revs->pending.nr = 0; revs->pending.alloc = 0; revs->pending.objects = NULL; } }
void doFrame(size_t fNum, scene_info_t *scene, wave_object_t *obj) { RtInt on = 1; char buffer[256]; RtString on_string = "on"; RtInt samples = 2; RtPoint lightPos = {40,80,40}; RiFrameBegin(fNum); RtColor bgcolor = {0.2,0.8,0.2}; RiImager("background", "color background", bgcolor, RI_NULL); sprintf(buffer, "images/%s%05lu.tif", scene->fprefix, fNum); RiDisplay(buffer,(char*)"file",(char*)"rgba",RI_NULL); RiFormat(800, 600, 1.25); RiProjection((char*)"perspective",RI_NULL); PlaceCamera(&scene->cam); /* RiAttribute("visibility", "int trace", &on, RI_NULL); */ RiAttribute( "visibility", "int camera", (RtPointer)&on, "int transmission", (RtPointer)&on, "int diffuse", (RtPointer)&on, "int specular", (RtPointer)&on, "int photon", (RtPointer)&on, RI_NULL ); RiAttribute( "light", (RtToken)"shadows", (RtPointer)&on_string, (RtToken)"samples", (RtPointer)&samples, RI_NULL ); RiAttribute((RtToken)"light", "string shadow", (RtPointer)"on", RI_NULL); RiLightSource("distantlight", (RtToken)"from", (RtPointer)lightPos, RI_NULL); RiWorldBegin(); RiSurface((char*)"matte", RI_NULL); show_object(obj); RiWorldEnd(); RiFrameEnd(); }
int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct object_array_entry *objects; int i, count, ret = 0; git_config(git_log_config, NULL); if (diff_use_color_default == -1) diff_use_color_default = git_use_color_default; init_revisions(&rev, prefix); rev.diff = 1; rev.combine_merges = 1; rev.dense_combined_merges = 1; rev.always_show_header = 1; rev.ignore_merges = 0; rev.no_walk = 1; cmd_log_init(argc, argv, prefix, &rev); count = rev.pending.nr; objects = rev.pending.objects; for (i = 0; i < count && !ret; i++) { struct object *o = objects[i].item; const char *name = objects[i].name; switch (o->type) { case OBJ_BLOB: ret = show_object(o->sha1, 0, NULL); break; case OBJ_TAG: { struct tag *t = (struct tag *)o; if (rev.shown_one) putchar('\n'); printf("%stag %s%s\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); rev.shown_one = 1; if (ret) break; o = parse_object(t->tagged->sha1); if (!o) ret = error("Could not read object %s", sha1_to_hex(t->tagged->sha1)); objects[i].item = o; i--; break; } case OBJ_TREE: if (rev.shown_one) putchar('\n'); printf("%stree %s%s\n\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); read_tree_recursive((struct tree *)o, "", 0, 0, NULL, show_tree_object, NULL); rev.shown_one = 1; break; case OBJ_COMMIT: rev.pending.nr = rev.pending.alloc = 0; rev.pending.objects = NULL; add_object_array(o, name, &rev.pending); ret = cmd_log_walk(&rev); break; default: ret = error("Unknown type: %d", o->type); } } free(objects); return ret; }
int cmd_show(int argc, const char **argv, const char *prefix) { struct rev_info rev; struct object_array_entry *objects; struct setup_revision_opt opt; struct pathspec match_all; int i, count, ret = 0; git_config(git_log_config, NULL); init_pathspec(&match_all, NULL); init_revisions(&rev, prefix); rev.diff = 1; rev.always_show_header = 1; rev.no_walk = 1; memset(&opt, 0, sizeof(opt)); opt.def = "HEAD"; opt.tweak = show_rev_tweak_rev; cmd_log_init(argc, argv, prefix, &rev, &opt); count = rev.pending.nr; objects = rev.pending.objects; for (i = 0; i < count && !ret; i++) { struct object *o = objects[i].item; const char *name = objects[i].name; switch (o->type) { case OBJ_BLOB: ret = show_object(o->sha1, 0, NULL); break; case OBJ_TAG: { struct tag *t = (struct tag *)o; if (rev.shown_one) putchar('\n'); printf("%stag %s%s\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); rev.shown_one = 1; if (ret) break; o = parse_object(t->tagged->sha1); if (!o) ret = error(_("Could not read object %s"), sha1_to_hex(t->tagged->sha1)); objects[i].item = o; i--; break; } case OBJ_TREE: if (rev.shown_one) putchar('\n'); printf("%stree %s%s\n\n", diff_get_color_opt(&rev.diffopt, DIFF_COMMIT), name, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); read_tree_recursive((struct tree *)o, "", 0, 0, &match_all, show_tree_object, NULL); rev.shown_one = 1; break; case OBJ_COMMIT: rev.pending.nr = rev.pending.alloc = 0; rev.pending.objects = NULL; add_object_array(o, name, &rev.pending); ret = cmd_log_walk(&rev); break; default: ret = error(_("Unknown type: %d"), o->type); } } free(objects); return ret; }