mirror of
https://github.com/hannobraun/Fornjot
synced 2025-11-26 09:22:09 +00:00
Update formatting
This commit is contained in:
parent
10a8f84d84
commit
8db2894181
@ -88,22 +88,22 @@ impl TextRenderer {
|
|||||||
transform.inner().transform_point(&label.position);
|
transform.inner().transform_point(&label.position);
|
||||||
|
|
||||||
// The transform above has transformed the point into normalized
|
// The transform above has transformed the point into normalized
|
||||||
// device coordinates, but we need pixel coordinates. Let's start
|
// device coordinates, but we need pixel coordinates. Let's
|
||||||
// with moving the coordinate system origin to the upper-left
|
// start with moving the coordinate system origin to the upper-
|
||||||
// corner.
|
// left corner.
|
||||||
point += Vector::from([1., -1., 0.]);
|
point += Vector::from([1., -1., 0.]);
|
||||||
|
|
||||||
// Normalized device coordinates cover the range from -1 to 1.
|
// Normalized device coordinates cover the range from -1 to 1.
|
||||||
// Before we can multiply that with the screen size, we need to get
|
// Before we can multiply that with the screen size, we need to
|
||||||
// a range from 0 to 1. While we're at that, also invert the y-axis,
|
// get a range from 0 to 1. While we're at that, also invert the
|
||||||
// to match the pixel coordinate system that we need.
|
// y-axis, to match the pixel coordinate system that we need.
|
||||||
point.x *= 0.5;
|
point.x *= 0.5;
|
||||||
point.y *= -0.5;
|
point.y *= -0.5;
|
||||||
|
|
||||||
// At this point, we've transformed the position into a normalized
|
// At this point, we've transformed the position into a
|
||||||
// coordinate system (with range 0 to 1) with the origin in the
|
// normalized coordinate system (with range 0 to 1) with the
|
||||||
// upper- left corner. All that's left is to multiply by the screen
|
// origin in the upper-left corner. All that's left is to
|
||||||
// size, and we have pixel coordinates.
|
// multiply by the screen size, and we have pixel coordinates.
|
||||||
point.x *= surface_config.width as f64;
|
point.x *= surface_config.width as f64;
|
||||||
point.y *= surface_config.height as f64;
|
point.y *= surface_config.height as f64;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user