1 /*
2  * File:         polygon.h
3  *
4  * Description:  header file for polygon.c
5  *
6  *
7  * This source code is part of kludge3d, and is released under the
8  * GNU General Public License.
9  *
10  *
11  */
12 
13 #ifndef POLYGON_H
14 #define POLYGON_H
15 
16 #include "geo.h"
17 #include "mesh.h"
18 #include "globals.h"
19 #include "vertex.h"
20 #include "texture.h"
21 
22 /* the maximum number of vertices allowed in a polygon */
23 #define POLY_MAX_VERTS	10
24 
25 Poly * poly_new( void );
26 void poly_delete( Poly *p );
27 void poly_remove( Poly *p ) ;
28 Poly * poly_dup( Poly * );
29 void poly_add_vertex( Poly *p, Vertex *v ) ;
30 void poly_add_vertex_nth( Poly *p, Vertex *v, int vert_index ) ;
31 void poly_remove_vertex( Poly *p, Vertex *v ) ;
32 void poly_replace_vertex( Poly *p, Vertex *v, int vert_index ) ;
33 
34 int poly_has_vertex( Poly *p, Vertex *v ) ;
35 
36 void poly_reverse_winding( Poly *p );
37 void poly_find_normal( Poly * p ) ;
38 void poly_find_center_point( float *v, Poly * p ) ;
39 
40 GSList * polys_get_verts_unique( GSList *polys ) ;
41 GSList * polys_get_verts( GSList *polys ) ;
42 
43 int polys_count_vertex_usage( GSList *polys, Vertex *v ) ;
44 int polys_count_edge_usage( GSList *polys, Vertex *v1, Vertex *v2 ) ;
45 int poly_has_edge( Poly *p, Vertex *v1, Vertex *v2 ) ;
46 
47 TexCoord * poly_get_texcoord( Poly *p, Vertex *v ) ;
48 void texcoord_change_values( TexCoord *tc, float u, float v );
49 
50 #endif
51