We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e64c9c1 commit 87bb0d2Copy full SHA for 87bb0d2
1 file changed
src/renderer/rasterizer/rasterizer.h
@@ -156,8 +156,8 @@ namespace cg::renderer
156
157
// Viewport transform в экранные целочисленные координаты пикселя [web:57]
158
auto to_screen = [&](const float3& p){
159
- int sx = int((p.x + 1.f) * 0.5f * float(width - 1));
160
- int sy = int((1.f - (p.y + 1.f) * 0.5f) * float(height - 1)); // инверсия Y [web:12]
+ int sx = int((p.x + 1.f) * 0.5f * float(width));
+ int sy = int((1.f - (p.y + 1.f) * 0.5f) * float(height));
161
return int3{ sx, sy, int(std::round(p.z * 2147483647.0f)) }; // z хранить как float ниже; тут int3 только для удобства xy
162
};
163
int3 sa = to_screen(pa_ndc);
0 commit comments