1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibGL: Implement glDepthRange

This commit is contained in:
Stephan Unverwerth 2021-08-16 17:52:12 +02:00 committed by Andreas Kling
parent 3dd9efd35f
commit a97dbd2317
7 changed files with 26 additions and 1 deletions

View file

@ -260,6 +260,8 @@ static void rasterize_triangle(const RasterizerOptions& options, Gfx::Bitmap& re
auto barycentric = FloatVector3(coords.x(), coords.y(), coords.z()) * one_over_area;
float z = interpolate(triangle.vertices[0].z, triangle.vertices[1].z, triangle.vertices[2].z, barycentric);
z = options.depth_min + (options.depth_max - options.depth_min) * (z + 1) / 2;
if (z >= *depth) {
pixel_mask[y] ^= 1 << x;
continue;