raa
This commit is contained in:
		
							parent
							
								
									75f9f7fbb2
								
							
						
					
					
						commit
						042c004341
					
				
					 2 changed files with 13 additions and 8 deletions
				
			
		
							
								
								
									
										4
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -1,7 +1,7 @@ | |||
| CC = gcc | ||||
| CFLAGS = -g | ||||
| CFLAGS = -pg -O2 | ||||
| LDFLAGS = -pg | ||||
| LDLIBS = -lraylib -lm | ||||
| 
 | ||||
| objects  = c3d.o | ||||
| 
 | ||||
| c3d: $(objects) | ||||
|  |  | |||
							
								
								
									
										17
									
								
								c3d.c
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								c3d.c
									
										
									
									
									
								
							|  | @ -74,17 +74,17 @@ struct Tri2DArray { | |||
| }; | ||||
| typedef struct Tri2DArray Tri2DArray; | ||||
| 
 | ||||
| float Sign(Vector2 v1, Vector2 v2, Vector2 v3) { | ||||
|     return (v1.x - v3.x) * (v2.y - v3.y) - (v2.x - v3.x) * (v1.y - v3.y); | ||||
| float Sign(Vector2* v1, Vector2* v2, Vector2* v3) { | ||||
|     return (v1->x - v3->x) * (v2->y - v3->y) - (v2->x - v3->x) * (v1->y - v3->y); | ||||
| } | ||||
| 
 | ||||
| bool IsInTri(Tri2D tri, Vector2 p) { | ||||
| inline bool IsInTri(Tri2D tri, Vector2 p) { | ||||
|     float d1, d2, d3; | ||||
|     bool has_neg, has_pos; | ||||
| 
 | ||||
|     d1 = Sign(p, tri.a, tri.b); | ||||
|     d2 = Sign(p, tri.b, tri.c); | ||||
|     d3 = Sign(p, tri.c, tri.a); | ||||
|     d1 = Sign(&p, &tri.a, &tri.b); | ||||
|     d2 = Sign(&p, &tri.b, &tri.c); | ||||
|     d3 = Sign(&p, &tri.c, &tri.a); | ||||
| 
 | ||||
|     has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0); | ||||
|     has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0); | ||||
|  | @ -381,6 +381,11 @@ int main() { | |||
| 
 | ||||
| 	BeginDrawing(); | ||||
| 	DrawTexturePro(renderTexture.texture, (Rectangle){0,0,renderTexture.texture.width,-renderTexture.texture.height},(Rectangle){0,0,SCREENWIDTH,SCREENHEIGHT},(Vector2){0,0},0,WHITE); | ||||
| 
 | ||||
| 	char fpstext[40]; | ||||
| 	sprintf(fpstext,"%d",GetFPS()); | ||||
| 	DrawText( fpstext  ,0,0,20,WHITE); | ||||
| 	 | ||||
| 	EndDrawing(); | ||||
| 	 | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue