mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:02:45 +00:00 
			
		
		
		
	 220ac5eb02
			
		
	
	
		220ac5eb02
		
	
	
	
	
		
			
			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.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			502 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			502 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Jesse Buhagiar <jooster669@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include "GL/gl.h"
 | |
| #include <LibGfx/Vector2.h>
 | |
| #include <LibGfx/Vector4.h>
 | |
| 
 | |
| namespace GL {
 | |
| 
 | |
| struct GLColor {
 | |
|     GLclampf r, g, b, a;
 | |
| };
 | |
| 
 | |
| struct GLVertex {
 | |
|     FloatVector4 position;
 | |
|     FloatVector4 color;
 | |
|     FloatVector2 tex_coord;
 | |
| };
 | |
| 
 | |
| struct GLTriangle {
 | |
|     GLVertex vertices[3];
 | |
| };
 | |
| 
 | |
| struct GLEdge {
 | |
|     GLfloat x1;
 | |
|     GLfloat y1;
 | |
|     GLfloat x2;
 | |
|     GLfloat y2;
 | |
| };
 | |
| 
 | |
| }
 |