shithub: wipeout

Download patch

ref: 41399234f6694133bbd64910b86ff61bce67367a
parent: e9f91c57f02a38b84516721fdd95b2d6e84a01dd
parent: 6170976e6aab9a3747d08cef1b6ae3e36557227f
author: Dominic Szablewski <dominic@phoboslab.org>
date: Wed Aug 23 19:31:43 EDT 2023

Merge pull request #37 from jantlo/avoid_draw_sections_more_than_once

Avoid rendering more than once those track sections in tracks with alternative paths.

--- a/src/wipeout/track.c
+++ b/src/wipeout/track.c
@@ -271,28 +271,14 @@
 	vec3_t cam_pos = camera->position;
 
 	section_t *s = g.track.sections;
-	section_t *j = NULL;
-	do {
+	for(int32_t i = 0; i < g.track.section_count; ++i, ++s)
+	{
 		vec3_t d = vec3_sub(cam_pos, s->center);
 		float dist_sq = d.x * d.x + d.y * d.y + d.z * d.z;
 		if (dist_sq <  max_dist_sq) {
 			track_draw_section(s);
 		}
-
-		if (s->junction) { // start junction
-			j = s->junction;
-			do {
-				vec3_t d = vec3_sub(cam_pos, j->center);
-				float dist_sq = d.x * d.x + d.y * d.y + d.z * d.z;
-				if (dist_sq <  max_dist_sq) {
-					track_draw_section(j);
-				}
-				j = j->next;
-			} while (!j->junction); // end junction
-		}
-		s = s->next;
-	} while (s != g.track.sections);
-	
+	}
 }
 
 void track_cycle_pickups() {