/*<html><pre>*/
#ifndef V_PGRID_H
#define V_PGRID_H

typedef s32_t	itriple_t[3];

typedef struct tripatch_s
{
	int			numvert;
	int			numtri;
	int			extinfo;	/* == 0 if no extended information */
	int			hsplit;
	int			vsplit;
	vec3_t		base[4];
	vec3_t		basenormal;
	vec3_t		*vlist;		/* vertex list */
	itriple_t	*tlist;		/* triangular faces (indices of vertices) */
	/*			Extended information */
	color4b_t	*clist;		/* vertex colors */
	vec3_t		*nlist;		/* vertex normals */
	vec3_t		*fnlist;	/* face normals */
	vec2_t		*uvlist;	/* texture coords */
}	tripatch_t, *tripatch_p;

#ifdef	__cplusplus
extern "C" {
#endif	/* __cplusplus */
	tripatch_p	V_GLOBAL	patAlloc(int numvert,int numtri,int fullsize);
	tripatch_p	V_GLOBAL	patDuplicate(tripatch_p ref);
	void		V_GLOBAL	patFree(tripatch_p patch);
	void		V_GLOBAL	patDefaultGeometry(tripatch_p patch);
	tripatch_p	V_GLOBAL	patCreateRectangular(vec_t l,vec_t t,vec_t r,vec_t b,
								int hsplit,int vsplit,int extinfo);
	tripatch_p	V_GLOBAL	patCreateTriangular(vec3_t a,vec3_t b,vec3_t c,
								int split,int extinfo);
	/* replaces <vertex coords>[i][j][ind] by contents of 'mat'[i][j] */
	void		V_GLOBAL	patSetGeometry(tripatch_t *pat,matrix_t *mat,u32_t ind);
	/* Draws patch (as unculled wirewrame mesh) via OpenGL */
	void		V_GLOBAL	patDrawWireframe(tripatch_t *pat);
#ifdef	__cplusplus
}
#endif	/* __cplusplus */

#endif	/* V_PGID_H */
/*</pre></html>*/
/*EOF*/
