MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / TCAMRenderTerrain

Function TCAMRenderTerrain

Descent3/TelComAutoMap.cpp:614–663  ·  view source on GitHub ↗

Renders the low-res terrain for the automap

Source from the content-addressed store, hash-verified

612
613// Renders the low-res terrain for the automap
614void TCAMRenderTerrain() {
615 int nt;
616 int render_width, render_height;
617 float w2, h2;
618
619 int save_check = Terrain_occlusion_checksum;
620 int save_pix = Detail_settings.Pixel_error;
621 float save_dist = Detail_settings.Terrain_render_distance;
622
623 Detail_settings.Pixel_error = 31;
624 Detail_settings.Terrain_render_distance = 300 * TERRAIN_SIZE;
625 Terrain_occlusion_checksum = -1;
626
627 // Get the size of the current render window
628 rend_GetProjectionParameters(&render_width, &render_height);
629 w2 = ((float)render_width - 1) / 2.0;
630 h2 = ((float)render_height - 1) / 2.0;
631
632 // Set up vars for (psuedo-)clipping window
633 Check_terrain_portal = 0;
634
635 Clip_scale_left = 0;
636 Clip_scale_right = render_width - 1;
637 Clip_scale_top = 0;
638 Clip_scale_bot = render_height - 1;
639
640 Terrain_from_mine = 0;
641
642 VisibleTerrainZ = (Detail_settings.Terrain_render_distance) * Matrix_scale.z;
643
644 // Set up our z wall
645 g3_SetFarClipZ(VisibleTerrainZ);
646
647 vector viewer_eye;
648 matrix viewer_orient;
649 // Get scaled matrix
650 g3_GetViewPosition(&viewer_eye);
651 g3_GetViewMatrix(&viewer_orient);
652
653 // Get all of the cells visible to us
654 nt = GetVisibleTerrain(&viewer_eye, &viewer_orient);
655
656 // And display!
657 if (nt > 0)
658 DisplayTerrainList(nt, 1);
659
660 Detail_settings.Pixel_error = save_pix;
661 Detail_settings.Terrain_render_distance = save_dist;
662 Terrain_occlusion_checksum = save_check;
663}
664
665#define AM_BLINK_TIME .25f
666

Callers 1

TCAMCallbackFunction · 0.85

Calls 6

g3_SetFarClipZFunction · 0.85
g3_GetViewPositionFunction · 0.85
g3_GetViewMatrixFunction · 0.85
GetVisibleTerrainFunction · 0.85
DisplayTerrainListFunction · 0.85

Tested by

no test coverage detected