X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=mathlib.h;h=b3a9f7ea3c319b80f01ab78d1c5b09e0eebeac7e;hb=13b389e18a2c98461fba000b9342c11d4efeb85e;hp=d8a902d4508746c93efdd6bab94cab85f83af8f8;hpb=f69dd60228f9846eb768b71790a00a2262cba028;p=xonotic%2Fdarkplaces.git diff --git a/mathlib.h b/mathlib.h index d8a902d4..b3a9f7ea 100644 --- a/mathlib.h +++ b/mathlib.h @@ -175,6 +175,10 @@ int PointInfrontOfTriangle(const float *p, const float *a, const float *b, const } #endif +#define lhcheeserand() (seed = (seed * 987211u) ^ (seed >> 13u) ^ 914867) +#define lhcheeserandom(MIN,MAX) ((double)(lhcheeserand() + 0.5) / ((double)4096.0*1024.0*1024.0) * ((MAX)-(MIN)) + (MIN)) +#define VectorCheeseRandom(v) do{(v)[0] = lhcheeserandom(-1, 1);(v)[1] = lhcheeserandom(-1, 1);(v)[2] = lhcheeserandom(-1, 1);}while(DotProduct(v, v) > 1) + /* // LordHavoc: quaternion math, untested, don't know if these are correct, // need to add conversion to/from matrices