void draw_stars() { int i; int intensity=31; g3s_point p; for (i=0;i<MAX_STARS;i++) { if ((i&63) == 0) { gr_setcolor(BM_XRGB(intensity,intensity,intensity)); intensity-=3; } //g3_rotate_point(&p,&stars[i]); g3_rotate_delta_vec(&p.p3_vec,&stars[i]); g3_code_point(&p); if (p.p3_codes == 0) { p.p3_flags &= ~PF_PROJECTED; g3_project_point(&p); #ifndef OGL gr_pixel(f2i(p.p3_sx),f2i(p.p3_sy)); #else g3_draw_sphere(&p,F1_0*3); #endif } } //@@ { //@@ vms_vector delta; //@@ g3s_point top_pnt; //@@ //@@ g3_rotate_point(&p,&satellite_pos); //@@ g3_rotate_delta_vec(&delta,&satellite_upvec); //@@ //@@ g3_add_delta_vec(&top_pnt,&p,&delta); //@@ //@@ if (! (p.p3_codes & CC_BEHIND)) { //@@ int save_im = Interpolation_method; //@@ Interpolation_method = 0; //@@ //p.p3_flags &= ~PF_PROJECTED; //@@ g3_project_point(&p); //@@ if (! (p.p3_flags & PF_OVERFLOW)) //@@ //gr_bitmapm(f2i(p.p3_sx)-32,f2i(p.p3_sy)-32,satellite_bitmap); //@@ g3_draw_rod_tmap(satellite_bitmap,&p,SATELLITE_WIDTH,&top_pnt,SATELLITE_WIDTH,f1_0); //@@ Interpolation_method = save_im; //@@ } //@@ } }
void circle_in_bitmap( grs_bitmap * bmp ) { int i, x, y; for ( i=0; i < 10; i++ ) { for ( y=0; y<200; y++ ) { for ( x=0; x<319; x++ ) { gr_setcolor(getpixel1(bmp,x,y)); gr_pixel( x, y ); } } myx += 2; getch(); } }
//for looking for segment under a mouse click void check_segment(segment *seg) { short *svp; int nv; g3s_codes cc; med_get_vertex_list(seg,&nv,&svp); // set nv = number of vertices, svp = pointer to vertex indices cc=rotate_list(nv,svp); if (! cc.and) { //all off screen? int fn; gr_setcolor(0); gr_pixel(Search_x,Search_y); //set our search pixel to color zero gr_setcolor(1); //and render in color one for (fn=0;fn<6;fn++) { g3s_point *vert_list[4]; vert_list[0] = &Segment_points[seg->verts[Side_to_verts[fn][0]]]; vert_list[1] = &Segment_points[seg->verts[Side_to_verts[fn][1]]]; vert_list[2] = &Segment_points[seg->verts[Side_to_verts[fn][2]]]; g3_check_and_draw_poly(3,vert_list,NULL,NULL); vert_list[1] = &Segment_points[seg->verts[Side_to_verts[fn][2]]]; vert_list[2] = &Segment_points[seg->verts[Side_to_verts[fn][3]]]; g3_check_and_draw_poly(3,vert_list,NULL,NULL); } if (gr_ugpixel(&grd_curcanv->cv_bitmap,Search_x,Search_y) == 1) { if (N_found_segs < MAX_FOUND_SEGS) Found_segs[N_found_segs++] = SEG_PTR_2_NUM(seg); else Warning("Found too many segs! (limit=%d)",MAX_FOUND_SEGS); } } }
int gr_circle(fix xc1,fix yc1,fix r1) { int p,x, y, xc, yc, r; r = f2i(r1); xc = f2i(xc1); yc = f2i(yc1); p=3-(r*2); x=0; y=r; // Big clip if ( (xc+r) < 0 ) return 1; if ( (xc-r) > GWIDTH ) return 1; if ( (yc+r) < 0 ) return 1; if ( (yc-r) > GHEIGHT ) return 1; while(x<y) { // Draw the first octant gr_pixel( xc-y, yc-x ); gr_pixel( xc+y, yc-x ); gr_pixel( xc-y, yc+x ); gr_pixel( xc+y, yc+x ); if (p<0) p=p+(x<<2)+6; else { // Draw the second octant gr_pixel( xc-x, yc-y ); gr_pixel( xc+x, yc-y ); gr_pixel( xc-x, yc+y ); gr_pixel( xc+x, yc+y ); p=p+((x-y)<<2)+10; y--; } x++; } if(x==y) { gr_pixel( xc-x, yc-y ); gr_pixel( xc+x, yc-y ); gr_pixel( xc-x, yc+y ); gr_pixel( xc+x, yc+y ); } return 0; }