void HudGaugeRadarDradis::drawBlipsSorted(int distort) { matrix base_tilt = vmd_identity_matrix; vm_angle_2_matrix(&base_tilt, -PI/6, 0); for(int is_bright = 0; is_bright < 2; is_bright++) { sub_y_clip = true; g3_start_instance_matrix(&vmd_zero_vector, /*&Player_obj->orient*/&base_tilt, true); drawBlips(BLIP_TYPE_BOMB, is_bright, distort); drawBlips(BLIP_TYPE_JUMP_NODE, is_bright, distort); drawBlips(BLIP_TYPE_NORMAL_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_TAGGED_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_WARPING_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_NAVBUOY_CARGO, is_bright, distort); g3_done_instance(true); drawOutlinesHtl(); sub_y_clip = false; g3_start_instance_matrix(&vmd_zero_vector, /*&Player_obj->orient*/&base_tilt, true); drawBlips(BLIP_TYPE_BOMB, is_bright, distort); drawBlips(BLIP_TYPE_JUMP_NODE, is_bright, distort); drawBlips(BLIP_TYPE_NORMAL_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_TAGGED_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_WARPING_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_NAVBUOY_CARGO, is_bright, distort); g3_done_instance(true); } }
//instance at specified point with specified orientation //if angles==NULL, don't modify matrix. This will be like doing an offset void g3_start_instance_angles(vms_vector *pos, vms_angvec *angles) { vms_matrix tm; if (angles == NULL) { g3_start_instance_matrix(pos, NULL); return; } vm_angles_2_matrix(&tm, angles); g3_start_instance_matrix(pos, &tm); }
void HudGaugeRadarOrb::drawOutlines() { int i; vertex center; // vertex extents[6]; vertex proj_orb_lines_xy[NUM_ORB_RING_SLICES]; vertex proj_orb_lines_xz[NUM_ORB_RING_SLICES]; vertex proj_orb_lines_yz[NUM_ORB_RING_SLICES]; g3_start_instance_matrix(&vmd_zero_vector, &view_perturb, false); g3_start_instance_matrix(&vmd_zero_vector, &Player_obj->orient, false); g3_rotate_vertex(¢er, &vmd_zero_vector); g3_rotate_vertex(&proj_orb_lines_xy[0], &orb_ring_xy[0]); g3_rotate_vertex(&proj_orb_lines_yz[0], &orb_ring_yz[0]); g3_rotate_vertex(&proj_orb_lines_xz[0], &orb_ring_xz[0]); g3_project_vertex(¢er); gr_set_color(255,255,255); g3_draw_sphere(¢er, .05f); g3_project_vertex(&proj_orb_lines_xy[0]); g3_project_vertex(&proj_orb_lines_yz[0]); g3_project_vertex(&proj_orb_lines_xz[0]); for (i=1; i < NUM_ORB_RING_SLICES; i++) { g3_rotate_vertex(&proj_orb_lines_xy[i], &orb_ring_xy[i]); g3_rotate_vertex(&proj_orb_lines_yz[i], &orb_ring_yz[i]); g3_rotate_vertex(&proj_orb_lines_xz[i], &orb_ring_xz[i]); g3_project_vertex(&proj_orb_lines_xy[i]); g3_project_vertex(&proj_orb_lines_yz[i]); g3_project_vertex(&proj_orb_lines_xz[i]); gr_set_color(192,96,32); g3_draw_sphere(&proj_orb_lines_xy[i-1], .01f); g3_draw_sphere(&proj_orb_lines_xz[i-1], .01f); g3_draw_line(&proj_orb_lines_xy[i-1],&proj_orb_lines_xy[i]); g3_draw_line(&proj_orb_lines_xz[i-1],&proj_orb_lines_xz[i]); gr_set_color(112,16,192); g3_draw_sphere(&proj_orb_lines_yz[i-1], .01f); g3_draw_line(&proj_orb_lines_yz[i-1],&proj_orb_lines_yz[i]); } g3_done_instance(false); }
void draw_morph_object(object *obj) { // int save_light; polymodel *po; fix light; morph_data *md; md = find_morph_data(obj); Assert(md != NULL); Assert(obj->rtype.pobj_info.model_num < N_polygon_models); po=&Polygon_models[obj->rtype.pobj_info.model_num]; light = compute_object_light(obj,NULL); g3_start_instance_matrix(&obj->pos,&obj->orient); g3_set_interp_points(robot_points); draw_model(po,0,obj->rtype.pobj_info.anim_angles,light,md); g3_done_instance(); #ifdef NEWDEMO if (Newdemo_state == ND_STATE_RECORDING) newdemo_record_morph_frame(md); #endif }
void HudGaugeRadarDradis::drawOutlinesHtl() { matrix base_tilt = vmd_identity_matrix; vec3d base_tilt_norm; if ((xy_plane == -1) || (xz_yz_plane == -1)) return; g3_start_instance_matrix(&vmd_zero_vector, /*&Player_obj->orient*/&vmd_identity_matrix, true); // Tilt the base disc component of DRADIS-style radar 30 degrees down vm_angle_2_matrix(&base_tilt, PI/6, 0); vm_vec_rotate(&base_tilt_norm, &vmd_y_vector, &base_tilt); //gr_set_bitmap(xy_plane, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f); // base //g3_draw_polygon(&vmd_zero_vector, &base_tilt_norm, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); material mat_params; material_set_unlit(&mat_params, xy_plane, 1.0f, true, false); g3_render_rect_oriented(&mat_params, &vmd_zero_vector, &base_tilt_norm, scale, scale); //gr_set_bitmap(xz_yz_plane, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f); //g3_draw_polygon(&vmd_zero_vector, &vmd_x_vector, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // forward facing ring //g3_draw_polygon(&vmd_zero_vector, &vmd_z_vector, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // side facing ring material_set_unlit(&mat_params, xz_yz_plane, 1.0f, true, false); g3_render_rect_oriented(&mat_params, &vmd_zero_vector, &vmd_x_vector, scale, scale); // forward facing ring g3_render_rect_oriented(&mat_params, &vmd_zero_vector, &vmd_z_vector, scale, scale); // side facing ring g3_done_instance(true); }
//instance at specified point with specified orientation //if angles==NULL, don't modify matrix. This will be like doing an offset void g3_start_instance_angles(vector *pos,angles *orient) { matrix tm; Assert( G3_count == 1 ); if (orient==NULL) { g3_start_instance_matrix(pos,NULL); return; } vm_angles_2_matrix(&tm,orient); g3_start_instance_matrix(pos,&tm, false); if(!Cmdline_nohtl)gr_start_angles_instance_matrix(pos, orient); }
render_external_scene(fix eye_offset) { Viewer_eye = Viewer->pos; if (eye_offset) vm_vec_scale_add2(&Viewer_eye,&Viewer->orient.rvec,eye_offset); g3_set_view_matrix(&Viewer->pos,&Viewer->orient,Render_zoom); //g3_draw_horizon(BM_XRGB(0,0,0),BM_XRGB(16,16,16)); //,-1); gr_clear_canvas(BM_XRGB(0,0,0)); g3_start_instance_matrix(&vmd_zero_vector,&surface_orient); draw_stars(); g3_done_instance(); { //draw satellite vms_vector delta; g3s_point p,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; //p.p3_flags &= ~PF_PROJECTED; //g3_project_point(&p); if (! (p.p3_flags & PF_OVERFLOW)) { Interpolation_method = 0; //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; } } } #ifdef STATION_ENABLED draw_polygon_model(&station_pos,&vmd_identity_matrix,NULL,station_modelnum,0,f1_0,NULL,NULL); #endif render_terrain(&mine_ground_exit_point,exit_point_bmx,exit_point_bmy); draw_exit_model(); if (ext_expl_playing) draw_fireball(&external_explosion); Lighting_on=0; render_object(ConsoleObject); Lighting_on=1; }
void HudGaugeRadarOrb::drawOutlinesHtl() { int i, last = NUM_ORB_RING_SLICES - 1; g3_start_instance_matrix(&vmd_zero_vector, &view_perturb, true); g3_start_instance_matrix(&vmd_zero_vector, &Player_obj->orient, true); gr_set_color(255, 255, 255); g3_render_sphere(&vmd_zero_vector, .05f); gr_set_line_width(2.0f); for (i = 0; i < NUM_ORB_RING_SLICES; i++) { gr_init_alphacolor(&Orb_color_orange, 192, 96, 32, calcAlpha(&orb_ring_xy[last])); gr_set_color_fast(&Orb_color_orange); //g3_draw_htl_line(&orb_ring_xy[last],&orb_ring_xy[i]); g3_render_line_3d(false, &orb_ring_xy[last],&orb_ring_xy[i]); gr_init_alphacolor(&Orb_color_teal, 48, 160, 96, calcAlpha(&orb_ring_xz[last])); gr_set_color_fast(&Orb_color_teal); //g3_draw_htl_line(&orb_ring_xz[last],&orb_ring_xz[i]); g3_render_line_3d(false, &orb_ring_xz[last],&orb_ring_xz[i]); gr_init_alphacolor(&Orb_color_purple, 112, 16, 192, calcAlpha(&orb_ring_yz[last])); gr_set_color_fast(&Orb_color_purple); //g3_draw_htl_line(&orb_ring_yz[last],&orb_ring_yz[i]); g3_render_line_3d(false, &orb_ring_yz[last],&orb_ring_yz[i]); last = i; } gr_set_line_width(1.0f); g3_done_instance(true); g3_done_instance(true); }
void HudGaugeRadarOrb::drawBlipsSorted(int distort) { g3_start_instance_matrix(&vmd_zero_vector, &view_perturb, false); vm_vec_zero(&target_position); // draw dim blips first, then bright blips for (int is_bright = 0; is_bright < 2; is_bright++) { drawBlips(BLIP_TYPE_JUMP_NODE, is_bright, distort); drawBlips(BLIP_TYPE_WARPING_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_NAVBUOY_CARGO, is_bright, distort); drawBlips(BLIP_TYPE_NORMAL_SHIP, is_bright, distort); drawBlips(BLIP_TYPE_BOMB, is_bright, distort); drawBlips(BLIP_TYPE_TAGGED_SHIP, is_bright, distort); } if (radar_target_id_flags & RTIF_CROSSHAIRS) { drawCrosshairs(target_position); } g3_done_instance(false); }
void HudGaugeRadarDradis::drawSweeps() { if (sweep_plane == -1) return; sweep_percent = (fmod(((float)game_get_overall_frametime() / (float)65536), sweep_duration) / sweep_duration) * PI * 2; // convert to radians from 0 <-> 1 float sweep_perc_z = sweep_percent * -0.5f; vec3d sweep_a; vec3d sweep_b; vec3d sweep_c; vm_rot_point_around_line(&sweep_a, &vmd_y_vector, sweep_percent, &vmd_zero_vector, &vmd_z_vector); // Sweep line: XZ vm_rot_point_around_line(&sweep_b, &vmd_y_vector, sweep_percent, &vmd_zero_vector, &vmd_x_vector); // Sweep line: YZ vm_rot_point_around_line(&sweep_c, &vmd_x_vector, sweep_perc_z, &vmd_zero_vector, &vmd_y_vector); // Sweep line: XY vm_vec_copy_scale(&sweep_normal_x, &sweep_a, 1.0f); vm_vec_copy_scale(&sweep_normal_y, &sweep_b, 1.0f); g3_start_instance_matrix(&vmd_zero_vector, /*&Player_obj->orient*/&vmd_identity_matrix, true); gr_set_bitmap(sweep_plane, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f); g3_draw_polygon(&vmd_zero_vector, &sweep_a, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); g3_draw_polygon(&vmd_zero_vector, &sweep_b, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); g3_draw_polygon(&vmd_zero_vector, &sweep_c, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); float rotation = sweep_percent; vm_rot_point_around_line(&sweep_a, &vmd_y_vector, rotation, &vmd_zero_vector, &vmd_z_vector); // Sweep line: XZ vm_rot_point_around_line(&sweep_b, &vmd_y_vector, rotation, &vmd_zero_vector, &vmd_x_vector); // Sweep line: YZ vm_rot_point_around_line(&sweep_c, &vmd_x_vector,sweep_perc_z, &vmd_zero_vector, &vmd_y_vector); // Sweep line: YZ gr_set_bitmap(sweep_plane, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL); g3_draw_polygon(&vmd_zero_vector, &sweep_a, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // Sweep line: XZ g3_draw_polygon(&vmd_zero_vector, &sweep_b, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // Sweep line: YZ g3_draw_polygon(&vmd_zero_vector, &sweep_c, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); /*int dist = 90; for(int i = 1; i < dist; i++) { float rotation = sweep_percent - (i * RADIANS_PER_DEGREE); float alpha = (1.0f - (float)((float)i / (float)dist)) * 0.25f; //if (i < 2) //alpha = 1.0f; gr_set_bitmap(sweep_plane, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, alpha); vm_rot_point_around_line(&sweep_a, &vmd_y_vector, rotation, &vmd_zero_vector, &vmd_z_vector); // Sweep line: XZ vm_rot_point_around_line(&sweep_b, &vmd_y_vector, rotation, &vmd_zero_vector, &vmd_x_vector); // Sweep line: YZ g3_draw_polygon(&vmd_zero_vector, &sweep_a, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // Sweep line: XZ g3_draw_polygon(&vmd_zero_vector, &sweep_b, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); // Sweep line: YZ if (i < (dist * 0.5f)) { vm_rot_point_around_line(&sweep_c, &vmd_x_vector,sweep_perc_z + (i * RADIANS_PER_DEGREE), &vmd_zero_vector, &vmd_y_vector); // Sweep line: YZ g3_draw_polygon(&vmd_zero_vector, &sweep_c, scale, scale, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT); } }*/ g3_done_instance(true); }
void draw_polygon_model(vms_vector *pos,vms_matrix *orient,vms_angvec *anim_angles,int model_num,int flags,g3s_lrgb light,fix *glow_values,bitmap_index alt_textures[]) { polymodel *po; int i; if (model_num < 0) return; Assert(model_num < N_polygon_models); po=&Polygon_models[model_num]; //check if should use simple model if (po->simpler_model ) //must have a simpler model if (flags==0) //can't switch if this is debris //!!if (!alt_textures) { //alternate textures might not match //alt textures might not match, but in the one case we're using this //for on 11/14/94, they do match. So we leave it in. { int cnt=1; fix depth; depth = g3_calc_point_depth(pos); //gets 3d depth while (po->simpler_model && depth > cnt++ * Simple_model_threshhold_scale * po->rad) po = &Polygon_models[po->simpler_model-1]; } if (alt_textures) for (i=0;i<po->n_textures;i++) { texture_list_index[i] = alt_textures[i]; texture_list[i] = &GameBitmaps[alt_textures[i].index]; } else for (i=0;i<po->n_textures;i++) { texture_list_index[i] = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]]; texture_list[i] = &GameBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index]; } // Make sure the textures for this object are paged in... piggy_page_flushed = 0; for (i=0;i<po->n_textures;i++) PIGGY_PAGE_IN( texture_list_index[i] ); // Hmmm... cache got flushed in the middle of paging all these in, // so we need to reread them all in. if (piggy_page_flushed) { piggy_page_flushed = 0; for (i=0;i<po->n_textures;i++) PIGGY_PAGE_IN( texture_list_index[i] ); } // Make sure that they can all fit in memory. Assert( piggy_page_flushed == 0 ); g3_start_instance_matrix(pos,orient); g3_set_interp_points(robot_points); if (flags == 0) //draw entire object g3_draw_polygon_model(po->model_data,texture_list,anim_angles,light,glow_values); else { int i; for (i=0;flags;flags>>=1,i++) if (flags & 1) { vms_vector ofs; Assert(i < po->n_models); //if submodel, rotate around its center point, not pivot point vm_vec_avg(&ofs,&po->submodel_mins[i],&po->submodel_maxs[i]); vm_vec_negate(&ofs); g3_start_instance_matrix(&ofs,NULL); g3_draw_polygon_model(&po->model_data[po->submodel_ptrs[i]],texture_list,anim_angles,light,glow_values); g3_done_instance(); } } g3_done_instance(); }
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d) { vec3d center; vec3d vecs[5]; vertex verts[5]; int saved_gr_zbuffering = gr_zbuffer_get(); gr_zbuffer_set(GR_ZBUFF_READ); vm_vec_scale_add( ¢er, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f ); if (Warp_glow_bitmap >= 0) { float r = radius; bool render_it = true; #define OUT_PERCENT1 0.80f #define OUT_PERCENT2 0.90f #define IN_PERCENT1 0.10f #define IN_PERCENT2 0.20f if (Cmdline_warp_flash) { if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) { r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1); //render_it = true; } else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) { r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1); //render_it = true; } } if (render_it) { // Add in noise int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES; r *= (0.40f + Noise[noise_frame] * 0.30f); // Bobboau's warp thingie, toggled by cmdline if (Cmdline_warp_flash) { r += powf((2.0f * life_percent) - 1.0f, 24.0f) * max_radius * 1.5f; } vecs[4] = center; verts[4].texture_position.u = 0.5f; verts[4].texture_position.v = 0.5f; if (Cmdline_nohtl) { g3_rotate_vertex( &verts[4], &vecs[4] ); } else { g3_transfer_vertex( &verts[4], &vecs[4] ); } float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f; gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, alpha ); g3_draw_bitmap( &verts[4], 0, r, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT ); } } if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) { float scale = radius / 25.0f; model_set_warp_globals(scale, scale, scale, texture_bitmap_num, (radius/max_radius) ); float dist = vm_vec_dist_quick( pos, &Eye_position ); model_set_detail_level((int)(dist / (radius * 10.0f))); model_render( Warp_model, orient, pos, MR_LOCK_DETAIL | MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL ); model_set_warp_globals(); } else { float Grid_depth = radius/2.5f; gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f ); vm_vec_scale_add( &vecs[0], ¢er, &orient->vec.uvec, radius ); vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius ); vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth ); vm_vec_scale_add( &vecs[1], ¢er, &orient->vec.uvec, radius ); vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius ); vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth ); vm_vec_scale_add( &vecs[2], ¢er, &orient->vec.uvec, -radius ); vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius ); vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth ); vm_vec_scale_add( &vecs[3], ¢er, &orient->vec.uvec, -radius ); vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius ); vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth ); // vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth ); vecs[4] = center; verts[0].texture_position.u = 0.01f; verts[0].texture_position.v = 0.01f; verts[1].texture_position.u = 0.99f; verts[1].texture_position.v = 0.01f; verts[2].texture_position.u = 0.99f; verts[2].texture_position.v = 0.99f; verts[3].texture_position.u = 0.01f; verts[3].texture_position.v = 0.99f; verts[4].texture_position.u = 0.5f; verts[4].texture_position.v = 0.5f; if (Cmdline_nohtl) { g3_rotate_vertex( &verts[0], &vecs[0] ); g3_rotate_vertex( &verts[1], &vecs[1] ); g3_rotate_vertex( &verts[2], &vecs[2] ); g3_rotate_vertex( &verts[3], &vecs[3] ); g3_rotate_vertex( &verts[4], &vecs[4] ); } else { g3_transfer_vertex( &verts[0], &vecs[0] ); g3_transfer_vertex( &verts[1], &vecs[1] ); g3_transfer_vertex( &verts[2], &vecs[2] ); g3_transfer_vertex( &verts[3], &vecs[3] ); g3_transfer_vertex( &verts[4], &vecs[4] ); } int cull = gr_set_cull(0); // fixes rendering problem in D3D - taylor draw_face( &verts[0], &verts[4], &verts[1] ); draw_face( &verts[1], &verts[4], &verts[2] ); draw_face( &verts[4], &verts[3], &verts[2] ); draw_face( &verts[0], &verts[3], &verts[4] ); gr_set_cull(cull); } if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) { flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f); float adg = (2.0f * life_percent) - 1.0f; float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f; if (pct > 0.00001f) { g3_start_instance_matrix(pos, orient, true); gr_set_bitmap(Warp_ball_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f); warp_ball.render(max_radius * pct * 0.5f, adg * adg, adg * adg * 6.0f); g3_done_instance(true); } } gr_zbuffer_set( saved_gr_zbuffering ); }
void draw_model(polymodel *pm,int submodel_num,vms_angvec *anim_angles,fix light,morph_data *md) { int i,mn; int facing; int sort_list[MAX_SUBMODELS],sort_n; //first, sort the submodels sort_list[0] = submodel_num; sort_n = 1; for (i=0;i<pm->n_models;i++) if (md->submodel_active[i] && pm->submodel_parents[i]==submodel_num) { facing = g3_check_normal_facing(&pm->submodel_pnts[i],&pm->submodel_norms[i]); if (!facing) sort_list[sort_n++] = i; else { //put at start int t; for (t=sort_n;t>0;t--) sort_list[t] = sort_list[t-1]; sort_list[0] = i; sort_n++; } } //now draw everything for (i=0;i<sort_n;i++) { mn = sort_list[i]; if (mn == submodel_num) { int i; for (i=0;i<pm->n_textures;i++) { texture_list_index[i] = ObjBitmaps[ObjBitmapPtrs[pm->first_texture+i]]; texture_list[i] = &GameBitmaps[ObjBitmaps[ObjBitmapPtrs[pm->first_texture+i]].index]; } #ifdef PIGGY_USE_PAGING // Make sure the textures for this object are paged in... piggy_page_flushed = 0; for (i=0;i<pm->n_textures;i++) PIGGY_PAGE_IN( texture_list_index[i] ); // Hmmm... cache got flushed in the middle of paging all these in, // so we need to reread them all in. if (piggy_page_flushed) { piggy_page_flushed = 0; for (i=0;i<pm->n_textures;i++) PIGGY_PAGE_IN( texture_list_index[i] ); } // Make sure that they can all fit in memory. Assert( piggy_page_flushed == 0 ); #endif g3_draw_morphing_model(&pm->model_data[pm->submodel_ptrs[submodel_num]],texture_list,anim_angles,light,&md->morph_vecs[md->submodel_startpoints[submodel_num]]); } else { vms_matrix orient; vm_angles_2_matrix(&orient,&anim_angles[mn]); g3_start_instance_matrix(&pm->submodel_offsets[mn],&orient); draw_model(pm,mn,anim_angles,light,md); g3_done_instance(); } } }