DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
curves.h
Go to the documentation of this file.
1#ifndef CURVES_H
2#define CURVES_H
3
4#define PATCH_LODS_NUM 2
5#define PATCH_LOD_COLLISION 0
6#define PATCH_LOD_VISUAL 1
7
8typedef struct patchinfo_s
9{
10 int xsize, ysize;
11 struct {
12 int xtess, ytess;
15
16// Calculate number of resulting vertex rows/columns by given patch size and tesselation factor
17// When tess=0 it means that we reduce detalization of base 3x3 patches by removing middle row and column
18// "DimForTess" is "DIMension FOR TESSelation factor"
19int Q3PatchDimForTess(int size, int tess);
20
21// usage:
22// to expand a 5x5 patch to 21x21 vertices (4x4 tesselation), one might use this call:
23// Q3PatchSubdivideFloat(3, sizeof(float[3]), outvertices, 5, 5, sizeof(float[3]), patchvertices, 4, 4);
24void Q3PatchTesselateFloat(int numcomponents, int outputstride, float *outputvertices, int patchwidth, int patchheight, int inputstride, float *patchvertices, int tesselationwidth, int tesselationheight);
25// returns how much tesselation of each segment is needed to remain under tolerance
26int Q3PatchTesselationOnX(int patchwidth, int patchheight, int components, const float *in, float tolerance);
27// returns how much tesselation of each segment is needed to remain under tolerance
28int Q3PatchTesselationOnY(int patchwidth, int patchheight, int components, const float *in, float tolerance);
29// calculates elements for a grid of vertices
30// (such as those produced by Q3PatchTesselate)
31// (note: width and height are the actual vertex size, this produces
32// (width-1)*(height-1)*2 triangles, 3 elements each)
33void Q3PatchTriangleElements(int *elements, int width, int height, int firstvertex);
34
35int Q3PatchAdjustTesselation(int numcomponents, patchinfo_t *patch1, float *patchvertices1, patchinfo_t *patch2, float *patchvertices2);
36
37#endif
38
vector size
void Q3PatchTriangleElements(int *elements, int width, int height, int firstvertex)
Definition curves.c:399
void Q3PatchTesselateFloat(int numcomponents, int outputstride, float *outputvertices, int patchwidth, int patchheight, int inputstride, float *patchvertices, int tesselationwidth, int tesselationheight)
Definition curves.c:64
int Q3PatchTesselationOnY(int patchwidth, int patchheight, int components, const float *in, float tolerance)
Definition curves.c:252
#define PATCH_LODS_NUM
Definition curves.h:4
int Q3PatchAdjustTesselation(int numcomponents, patchinfo_t *patch1, float *patchvertices1, patchinfo_t *patch2, float *patchvertices2)
Definition curves.c:329
int Q3PatchTesselationOnX(int patchwidth, int patchheight, int components, const float *in, float tolerance)
Definition curves.c:232
int Q3PatchDimForTess(int size, int tess)
Definition curves.c:51
GLenum GLsizei width
Definition glquake.h:622
GLenum GLsizei GLsizei height
Definition glquake.h:622
int xtess
Definition curves.h:12
int xsize
Definition curves.h:10