| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -41,7 +41,7 @@ const mat3 intrinsic_matrix = (mat3){{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// Projects a point in car to space to the corresponding point in full frame
 | 
					 | 
					 | 
					 | 
					// Projects a point in car to space to the corresponding point in full frame
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// image space.
 | 
					 | 
					 | 
					 | 
					// image space.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, float *out_x, float *out_y, float margin) { | 
					 | 
					 | 
					 | 
					bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_z, vertex_data *out, float margin) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const vec4 car_space_projective = (vec4){{in_x, in_y, in_z, 1.}}; | 
					 | 
					 | 
					 | 
					  const vec4 car_space_projective = (vec4){{in_x, in_y, in_z, 1.}}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // We'll call the car space point p.
 | 
					 | 
					 | 
					 | 
					  // We'll call the car space point p.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // First project into normalized image coordinates with the extrinsics matrix.
 | 
					 | 
					 | 
					 | 
					  // First project into normalized image coordinates with the extrinsics matrix.
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -52,10 +52,10 @@ bool car_space_to_full_frame(const UIState *s, float in_x, float in_y, float in_ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const vec3 KEp = matvecmul3(intrinsic_matrix, Ep); | 
					 | 
					 | 
					 | 
					  const vec3 KEp = matvecmul3(intrinsic_matrix, Ep); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // Project.
 | 
					 | 
					 | 
					 | 
					  // Project.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  *out_x = KEp.v[0] / KEp.v[2]; | 
					 | 
					 | 
					 | 
					  out->x = KEp.v[0] / KEp.v[2]; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  *out_y = KEp.v[1] / KEp.v[2]; | 
					 | 
					 | 
					 | 
					  out->y = KEp.v[1] / KEp.v[2]; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return *out_x >= -margin && *out_x <= s->fb_w + margin && *out_y >= -margin && *out_y <= s->fb_h + margin; | 
					 | 
					 | 
					 | 
					  return out->x >= -margin && out->x <= s->fb_w + margin && out->y >= -margin && out->y <= s->fb_h + margin; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -68,11 +68,10 @@ static void ui_draw_text(NVGcontext *vg, float x, float y, const char* string, f | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void draw_chevron(UIState *s, float x_in, float y_in, float sz, | 
					 | 
					 | 
					 | 
					static void draw_chevron(UIState *s, float x_in, float y_in, float sz, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                          NVGcolor fillColor, NVGcolor glowColor) { | 
					 | 
					 | 
					 | 
					                          NVGcolor fillColor, NVGcolor glowColor) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  float x, y; | 
					 | 
					 | 
					 | 
					  vertex_data out; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (!car_space_to_full_frame(s, x_in, y_in, 0.0, &x, &y)) { | 
					 | 
					 | 
					 | 
					  if (!car_space_to_full_frame(s, x_in, y_in, 0.0, &out)) return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  auto [x, y] = out; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  sz = std::clamp((sz * 30) / (x_in / 3 + 30), 15.0f, 30.0f); | 
					 | 
					 | 
					 | 
					  sz = std::clamp((sz * 30) / (x_in / 3 + 30), 15.0f, 30.0f); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // glow
 | 
					 | 
					 | 
					 | 
					  // glow
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |