int main(int argc, char **argv) { Poly *l, *p, *q = poly_alloc(3); Hpoly *t = hpoly_alloc(3); Item *i; init_sdl(); s = scene_read(); init_render(); for (o = s->objs; o != NULL; o = o->next) { for (l = prim_uv_decomp(o->u.prim, 1.); l != NULL; l = l->next) { p = poly_transform(prim_polys(o->u.prim, l), mclip); if (!is_backfacing(p, v3_unit(v3_scale(-1, poly_centr(p))))) hither_clip(0, p, z_store, plist_free); } } z = z_sort(z); for (i = z->head; i != NULL; i = i->next) { t = hpoly_polyxform(t, S(i), mdpy); q = poly_wz_hpoly(q, W(i), t); texture_wscale(W(i), T(i)); scan_spoly3(q, 2, texture_shadepaint, texture_set(td,W(i),T(i),P(i),N(i),DU(i),DV(i),rc,M(i))); } img_write(s->img, "stdout", 0); exit(0); }
void draw_primitive_begin_texture(int dink,unsigned tex) { texture_set(tex); GLenum kind = ptypes_by_id[ dink & 15 ]; glBegin(kind); }
void d3d_primitive_begin_texture(int kind, int texId) { texture_set(get_texture(texId)); glBegin(ptypes_by_id[kind]); }
void d3d_primitive_begin(int kind) { // This has to be done because these immediate mode vertex functions will // blend with the texture whether or specify texture coordinates or not. texture_set(0); glBegin(ptypes_by_id[kind]); }
void CShipTexturesDlg::OnOK() { int i, k, write_index, z, not_found, temp_bmp, temp_frames, temp_fps; CString missing_files, message; char buf[10]; // update, in case of a last-minute edit OnSelchangeOldTextureList(); // quick skip if nothing modified if (query_modified()) { // sort according to new sort_textures(SORT_NEW); // check for filenames not found not_found = 0; missing_files = _T(""); for (i=0; i<texture_count; i++) { // make sure we have a texture if (strlen(new_texture_name[i])) { // try loading it (bmpman should take care of eventually unloading them) temp_bmp = bm_load( new_texture_name[i] ); // if PCX not found, look for ANI if (temp_bmp < 0) { temp_bmp = bm_load_animation(new_texture_name[i], &temp_frames, &temp_fps, NULL, 1); } // check if loaded if (temp_bmp < 0) { not_found++; missing_files += " "; missing_files += new_texture_name[i]; missing_files += '\n'; } } } // alert user if any textures were not found if (not_found) { sprintf(buf, "%d", not_found); message = "FRED was unable to find "; message += buf; message += ((not_found > 1) ? " files:\n" : " file:\n"); message += missing_files; message += "\nContinue anyway?"; z = MessageBox(message, ((not_found > 1) ? "Some textures were not found." : "A texture was not found."), MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2); if (z == IDCANCEL) { return; } } // re-sort according to old sort_textures(); // overwrite old stuff k = 0; write_index = 0; while (k<(MAX_SHIPS * MAX_REPLACEMENT_TEXTURES)) { //WMC - This loop will go on for a REALLY LONG TIME //I don't think we need to copy empty entries. if(!strlen(Fred_texture_replacements[k].ship_name)) break; if (stricmp(Fred_texture_replacements[k].ship_name, Ships[self_ship].ship_name)) { // move up, but when copying, src and dest can't be the same if (k != write_index) { texture_set(&Fred_texture_replacements[write_index], &Fred_texture_replacements[k]); } write_index++; } k++; } Fred_num_texture_replacements = write_index; // finally, assign duplicate textures to Fred array for (i=0; i<texture_count; i++) { // make sure there is an entry if (strlen(new_texture_name[i])) { // assign to global FRED array strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].old_texture, old_texture_name[i]); strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].new_texture, new_texture_name[i]); strcpy_s(Fred_texture_replacements[Fred_num_texture_replacements].ship_name, Ships[self_ship].ship_name); // increment Fred_num_texture_replacements++; } } } // skipped here if nothing modified CDialog::OnOK(); }
void CShipTexturesDlg::OnOK() { int i, z, not_found, temp_bmp, temp_frames, temp_fps; CString missing_files, message; char buf[10]; // update, in case of a last-minute edit OnSelchangeOldTextureList(); // quick skip if nothing modified if (query_modified()) { // sort according to new sort_textures(SORT_NEW); // check for filenames not found not_found = 0; missing_files = _T(""); for (i=0; i<texture_count; i++) { // make sure we have a texture if (strlen(new_texture_name[i])) { // allow invisible textures without doing a file check if (!stricmp(new_texture_name[i], "invisible")) continue; // try loading the texture (bmpman should take care of eventually unloading it) temp_bmp = bm_load( new_texture_name[i] ); // if PCX not found, look for ANI if (temp_bmp < 0) { temp_bmp = bm_load_animation(new_texture_name[i], &temp_frames, &temp_fps, NULL, 1); } // check if loaded if (temp_bmp < 0) { not_found++; missing_files += " "; missing_files += new_texture_name[i]; missing_files += '\n'; } } } // alert user if any textures were not found if (not_found) { sprintf(buf, "%d", not_found); message = "FRED was unable to find "; message += buf; message += ((not_found > 1) ? " files:\n" : " file:\n"); message += missing_files; message += "\nContinue anyway?"; z = MessageBox(message, ((not_found > 1) ? "Some textures were not found." : "A texture was not found."), MB_OKCANCEL | MB_ICONEXCLAMATION | MB_DEFBUTTON2); if (z == IDCANCEL) { return; } } // re-sort according to old sort_textures(); // overwrite all the old entries that refer to this ship SCP_vector<texture_replace>::iterator ii, end; end = Fred_texture_replacements.end(); for (ii = Fred_texture_replacements.begin(); ii != end; ++ii) { if (!stricmp(ii->ship_name, Ships[self_ship].ship_name)) { end--; if (end == ii) break; texture_set(&(*ii), &(*end)); } } if (end != Fred_texture_replacements.end()) Fred_texture_replacements.erase(end); // now put the new entries on the end of the list for (i=0; i<texture_count; i++) { // make sure there is an entry if (strlen(new_texture_name[i])) { texture_replace tr; strcpy_s(tr.old_texture, old_texture_name[i]); strcpy_s(tr.new_texture, new_texture_name[i]); strcpy_s(tr.ship_name, Ships[self_ship].ship_name); tr.new_texture_id = -1; // assign to global FRED array Fred_texture_replacements.push_back(tr); } } } // skipped here if nothing modified CDialog::OnOK(); }