]> icculus.org git repositories - divverent/darkplaces.git/blob - curves.h
yet another include fix, this time for MSVC
[divverent/darkplaces.git] / curves.h
1
2 #ifndef CURVES_H
3 #define CURVES_H
4
5 #define PATCH_LODS_NUM 2
6 #define PATCH_LOD_COLLISION 0
7 #define PATCH_LOD_VISUAL 1
8
9 typedef struct patchinfo_s
10 {
11         int xsize, ysize;
12         struct {
13                 int xtess, ytess;
14         } lods[PATCH_LODS_NUM];
15 } patchinfo_t;
16
17 // Calculate number of resulting vertex rows/columns by given patch size and tesselation factor
18 // When tess=0 it means that we reduce detalization of base 3x3 patches by removing middle row and column
19 // "DimForTess" is "DIMension FOR TESSelation factor"
20 int Q3PatchDimForTess(int size, int tess);
21
22 // usage:
23 // to expand a 5x5 patch to 21x21 vertices (4x4 tesselation), one might use this call:
24 // Q3PatchSubdivideFloat(3, sizeof(float[3]), outvertices, 5, 5, sizeof(float[3]), patchvertices, 4, 4);
25 void Q3PatchTesselateFloat(int numcomponents, int outputstride, float *outputvertices, int patchwidth, int patchheight, int inputstride, float *patchvertices, int tesselationwidth, int tesselationheight);
26 // returns how much tesselation of each segment is needed to remain under tolerance
27 int Q3PatchTesselationOnX(int patchwidth, int patchheight, int components, const float *in, float tolerance);
28 // returns how much tesselation of each segment is needed to remain under tolerance
29 int Q3PatchTesselationOnY(int patchwidth, int patchheight, int components, const float *in, float tolerance);
30 // calculates elements for a grid of vertices
31 // (such as those produced by Q3PatchTesselate)
32 // (note: width and height are the actual vertex size, this produces
33 //  (width-1)*(height-1)*2 triangles, 3 elements each)
34 void Q3PatchTriangleElements(int *elements, int width, int height, int firstvertex);
35
36 int Q3PatchAdjustTesselation(int numcomponents, patchinfo_t *patch1, float *patchvertices1, patchinfo_t *patch2, float *patchvertices2);
37
38 #endif
39