void game_mesh::print(int ident) { pprintf("%*cMesh name '%s'",ident,' ',name); pprintf("%*cMesh parent name '%s'",ident,' ',render_hierarchy_parent_get() ? render_hierarchy_parent_get()->name_get() : "None"); pprintf("%*cMaterial name '%s'",ident,' ',p_mat ? p_mat->name_get() : "NULL"); GLMATRIX *p_world = world_get(); p_world->print("Global world matrix",ident); p_world = world_get(); p_world->print("Local world matrix",ident); /* pprintf("%*cMesh vertexes",ident,' '); MESH_GEOMETRY *p_geom = lock(LOCK_READ); if(p_geom) { int num = p_geom->vertexnum_get(); VECT *p_pos = p_geom->position_get(); int i; for(i = 0; i < num; i++, p_pos++) { pprintf("%*c[V:%d][%f,%f,%f]",ident,' ',i,p_pos->x,p_pos->y,p_pos->z); } } unlock(FALSE); */ }
void do_world(void){ world_t *w = world_get(); world_setup_iterators(w); keyboard_frame(); next_time(); do_physics(w); do_think(w); do_graphics(w); do_sounds(w); do_garbage_collect(w); wait_frame(); }
int saveWorldText(char* file, struct world* world) { int fd = open(file, O_RDWR | O_CREAT, 0644); if (fd < 0) return -1; char tline[world->width + 1]; tline[world->width] = 0; for (size_t y = 0; y < world->height; y++) { for (size_t x = 0; x < world->width; x++) { uint8_t v = world_get(world->data, world->width, x, y); char c = ' '; if (v == CELL_WIRE) c = '#'; else if (v == CELL_HEAD) c = '@'; else if (v == CELL_TAIL) c = '~'; tline[x] = c; } writeLine(fd, tline, world->width); } close(fd); return 0; }