1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

LibGL: Fix clipping and interpolate vertex attributes

The previous clipping implementation was problematic especially when
clipping against the near plane. Triangles are now correctly clipped
using homogenous coordinates against all frustum planes.

Texture coordinates and vertex colors are now correctly interpolated.
The earier implementation was just a placeholder.
This commit is contained in:
Stephan Unverwerth 2021-08-16 19:22:08 +02:00 committed by Andreas Kling
parent 39ff1459f8
commit 220ac5eb02
6 changed files with 111 additions and 205 deletions

View file

@ -7,6 +7,8 @@
#pragma once
#include "GL/gl.h"
#include <LibGfx/Vector2.h>
#include <LibGfx/Vector4.h>
namespace GL {
@ -15,9 +17,9 @@ struct GLColor {
};
struct GLVertex {
GLfloat x, y, z, w;
GLfloat r, g, b, a;
GLfloat u, v;
FloatVector4 position;
FloatVector4 color;
FloatVector2 tex_coord;
};
struct GLTriangle {