]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - curves.c
adding two new extensions: DP_QC_WHICHPACK (identify a pk3 containing a file), and...
[xonotic/darkplaces.git] / curves.c
index 66b72734d72c2605bf01b98757d68b6b4a5177e0..3a9e22a1f26ec4c38243e8967a4dd173a31aae24 100644 (file)
--- a/curves.c
+++ b/curves.c
@@ -35,9 +35,12 @@ double bsplinesample(int dimensions, double t, double *param)
        double o = 0;
        for (i = 0;i < dimensions + 1;i++)
                o += param[i] * factorial(dimensions)/(factorial(i)*factorial(dimensions-i)) * pow(t, i) * pow(1 - t, dimensions - i);
+       return o;
 }
 */
 
+#include "quakedef.h"
+
 #include <math.h>
 #include "curves.h"
 
@@ -47,7 +50,7 @@ double bsplinesample(int dimensions, double t, double *param)
 void Q3PatchTesselateFloat(int numcomponents, int outputstride, float *outputvertices, int patchwidth, int patchheight, int inputstride, float *patchvertices, int tesselationwidth, int tesselationheight)
 {
        int k, l, x, y, component, outputwidth = (patchwidth-1)*tesselationwidth+1;
-       float px, py, *v0, *v1, a, b, c, *cp[3][3], temp[3][64];
+       float px, py, *v, a, b, c, *cp[3][3], temp[3][64];
        // iterate over the individual 3x3 quadratic spline surfaces one at a time
        // expanding them to fill the output array (with some overlap to ensure
        // the edges are filled)
@@ -167,13 +170,13 @@ int Q3PatchTesselationOnY(int patchwidth, int patchheight, int components, const
 // (such as those produced by Q3PatchTesselate)
 // (note: width and height are the actual vertex size, this produces
 //  (width-1)*(height-1)*2 triangles, 3 elements each)
-void Q3PatchTriangleElements(int *elements, int width, int height)
+void Q3PatchTriangleElements(int *elements, int width, int height, int firstvertex)
 {
        int x, y, row0, row1;
        for (y = 0;y < height - 1;y++)
        {
-               row0 = (y + 0) * width;
-               row1 = (y + 1) * width;
+               row0 = firstvertex + (y + 0) * width;
+               row1 = firstvertex + (y + 1) * width;
                for (x = 0;x < width - 1;x++)
                {
                        *elements++ = row0;