]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - curves.c
Rework r_shadow_shadowmode to be more maintainable and understandable - it now caches...
[xonotic/darkplaces.git] / curves.c
index 894683815db222e07be9490c9b4784fca6782595..58ce43d024a12af101921901f9e1362d0d6ae889 100644 (file)
--- a/curves.c
+++ b/curves.c
@@ -1,6 +1,6 @@
 
 /*
-this code written by Forest Hale, on 2004-10-17, and placed into public domain
+this code written by Ashley Rose Hale (LadyHavoc), on 2004-10-17, and placed into public domain
 this implements Quadratic BSpline surfaces as seen in Quake3 by id Software
 
 a small rant on misuse of the name 'bezier': many people seem to think that
@@ -140,14 +140,14 @@ static int Q3PatchTesselation(float largestsquared3xcurvearea, float tolerance)
 {
        float f;
        // f is actually a squared 2x curve area... so the formula had to be adjusted to give roughly the same subdivisions
-       f = pow(largestsquared3xcurvearea / 64.0, 0.25) / tolerance;
+       f = pow(largestsquared3xcurvearea / 64.0f, 0.25f) / tolerance;
        //if(f < 0.25) // VERY flat patches
        if(f < 0.0001) // TOTALLY flat patches
                return 0;
        else if(f < 2)
                return 1;
        else
-               return (int) floor(log(f) / log(2)) + 1;
+               return (int) floor(log(f) / log(2.0f)) + 1;
                // this is always at least 2
                // maps [0.25..0.5[ to -1 (actually, 1 is returned)
                // maps [0.5..1[ to 0 (actually, 1 is returned)
@@ -156,7 +156,7 @@ static int Q3PatchTesselation(float largestsquared3xcurvearea, float tolerance)
                // maps [4..8[ to 4
 }
 
-float Squared3xCurveArea(const float *a, const float *control, const float *b, int components)
+static float Squared3xCurveArea(const float *a, const float *control, const float *b, int components)
 {
 #if 0
        // mimicing the old behaviour with the new code...
@@ -336,7 +336,7 @@ int Q3PatchAdjustTesselation(int numcomponents, patchinfo_t *patch1, float *patc
 
        struct {int id1,id2;} commonverts[8];
        int i, j, k, side1, side2, *tess1, *tess2;
-       int dist1, dist2;
+       int dist1 = 0, dist2 = 0;
        qboolean modified = false;
 
        // Potential paired vertices (corners of the first patch)