void remote_draw_names_render(void) { int n,x,y,text_size; d3col col; obj_type *obj; if (!net_setup.client.joined) return; if (!setup.network.show_names) return; gl_2D_view_interface(); glDisable(GL_DEPTH_TEST); // draw all names text_size=-1; obj=server.objs; for (n=0;n!=server.count.obj;n++) { if (obj->draw.remote_name.on) { // get 2D position in screen resolution x=obj->draw.remote_name.proj_pnt.x; y=setup.screen.y_sz-obj->draw.remote_name.proj_pnt.y; // covert to interface resolution x=(x*hud.scale_x)/setup.screen.x_sz; y=(y*hud.scale_y)/setup.screen.y_sz; // draw text if (text_size!=obj->draw.remote_name.size) { text_size=obj->draw.remote_name.size; gl_text_start(text_size); } object_get_tint(obj,&col); gl_text_draw(x,y,obj->name,tx_center,FALSE,&col,obj->draw.remote_name.fade); } obj++; } gl_text_end(); // can call end without a start }
void view_pause_draw(void) { d3col col; gl_frame_start(NULL); gl_2D_view_screen(); col.r=col.g=col.b=1.0f; gl_text_start(hud.font.text_size_small); gl_text_draw(2,(setup.screen.y_sz-2),"[paused]",tx_left,FALSE,&col,1.0f); gl_text_draw((setup.screen.x_sz-2),(setup.screen.y_sz-2),"[click to resume]",tx_right,FALSE,&col,1.0f); gl_text_end(); gl_frame_end(); }
void view_draw_debug_info(d3pnt *pnt,d3pnt *size,int count,char *strs) { int n,x,y,dist; d3col col; d3pnt spt,ept,win_pnt; ray_trace_contact_type contact; // only show closer objects dist=distance_get(pnt->x,pnt->y,pnt->z,view.render->camera.pnt.x,view.render->camera.pnt.y,view.render->camera.pnt.z); if (dist>25000) return; // ray trace check spt.x=pnt->x; spt.y=pnt->y-size->y; spt.z=pnt->z; ept.x=view.render->camera.pnt.x; ept.y=view.render->camera.pnt.y; ept.z=view.render->camera.pnt.z; contact.obj.on=FALSE; contact.proj.on=FALSE; contact.origin=poly_ray_trace_origin_object; if (ray_trace_map_by_point(&spt,&ept,&contact)) return; // project the mid point win_pnt.x=pnt->x; win_pnt.y=pnt->y-size->y; win_pnt.z=pnt->z; gl_project_point(&win_pnt); // draw the info gl_2D_view_interface(); glDisable(GL_DEPTH_TEST); // covert to interface resolution x=(win_pnt.x*iface.scale_x)/view.screen.x_sz; y=((view.screen.y_sz-win_pnt.y)*iface.scale_y)/view.screen.y_sz; y-=(iface.font.text_size_small*count); // draw text col.r=col.b=1.0f; col.g=0.0f; gl_text_start(font_hud_index,iface.font.text_size_small,FALSE); for (n=0;n!=count;n++) { y+=iface.font.text_size_small; gl_text_draw(x,y,(char*)&strs[n*128],tx_center,FALSE,&col,1.0f); } gl_text_end(); glEnable(GL_DEPTH_TEST); // restore original projection gl_3D_view(); gl_3D_rotate(&view.render->camera.pnt,&view.render->camera.ang); }
void metrics_draw(void) { int y,wid,high,count; char str[256],str2[256]; d3col col; obj_type *obj; if ((setup.no_hud) || (!setup.metrics_on)) return; // set up view gl_2D_view_interface(); glDisable(GL_DEPTH_TEST); // text height high=gl_text_get_char_height(metrics_txt_sz)-1; y=(high+2)+8; // background wid=(int)(((float)iface.scale_x)*0.18f); count=9; if (net_setup.mode==net_mode_client) count++; if (map.optimize.ray_trace_obscure) count++; col.r=col.g=col.b=0.0f; view_primitive_2D_color_quad(&col,0.5f,2,wid,2,((count*high)+(high/2))); // fps gl_text_start(font_hud_index,metrics_txt_sz,FALSE); hud_texts_fps(str); metrics_draw_single(y,"FPS:",str); y+=high; // latency if (net_setup.mode==net_mode_client) { if (net_setup.client.latency>=100) { strcat(str,"---"); } else { sprintf(str,"%d",net_setup.client.latency); } metrics_draw_single(y,"Latency:",str); y+=high; } // meshes and polys sprintf(str,"%d.%d",view.count.mesh,view.count.mesh_poly); metrics_draw_single(y,"Meshes:",str); y+=high; // liquids sprintf(str,"%d.%d",view.count.liquid,view.count.liquid_poly); metrics_draw_single(y,"Liquids:",str); y+=high; // models sprintf(str,"%d.%d",view.count.model,view.count.model_poly); metrics_draw_single(y,"Models:",str); y+=high; // shadows sprintf(str,"%d.%d",view.count.shadow,view.count.shadow_poly); metrics_draw_single(y,"Shadows:",str); y+=high; // effects sprintf(str,"%d",view.count.effect); metrics_draw_single(y,"Effects:",str); y+=high; // lights sprintf(str,"%d",view.render->light.count); metrics_draw_single(y,"Lights:",str); y+=high; // obscure if (map.optimize.ray_trace_obscure) { sprintf(str,"%d%%",view.count.obscure_percent); metrics_draw_single(y,"Obscure:",str); y+=high; } // object projectile hits obj=server.obj_list.objs[server.player_obj_idx]; str[0]=0x0; if (obj->contact.obj_idx==-1) { strcat(str,"- "); } else { sprintf(str2,"%d ",obj->contact.obj_idx); strcat(str,str2); } if (obj->contact.proj_idx==-1) { strcat(str,"- "); } else { sprintf(str2,"%d ",obj->contact.proj_idx); strcat(str,str2); } metrics_draw_single(y,"Hit:",str); y+=high; // map contacts str[0]=0x0; if (obj->contact.hit_poly.mesh_idx==-1) { strcat(str,"- "); } else { sprintf(str2,"%d.%d ",obj->contact.hit_poly.mesh_idx,obj->contact.hit_poly.poly_idx); strcat(str,str2); } if (obj->contact.stand_poly.mesh_idx==-1) { strcat(str,"- "); } else { sprintf(str2,"%d.%d ",obj->contact.stand_poly.mesh_idx,obj->contact.stand_poly.poly_idx); strcat(str,str2); } if (obj->contact.liquid_idx==-1) { strcat(str,"- "); } else { sprintf(str2,"%d ",obj->contact.liquid_idx); strcat(str,str2); } metrics_draw_single(y,"Contact:",str); gl_text_end(); }