X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=collision.c;h=4f90e33fc71f60b00e40d351055007506be9b503;hb=refs%2Fheads%2Fterencehill%2Fdpdefs_sync;hp=e6621710f0668729be2821f425f13064d447a04d;hpb=f7750d34bc095248efb2aec0cefb2e3db367ab3b;p=xonotic%2Fdarkplaces.git diff --git a/collision.c b/collision.c index e6621710..4f90e33f 100644 --- a/collision.c +++ b/collision.c @@ -10,16 +10,15 @@ #define COLLISION_SNAP2 (2.0f / COLLISION_SNAPSCALE) #define COLLISION_PLANE_DIST_EPSILON (2.0f / COLLISION_SNAPSCALE) -cvar_t collision_impactnudge = {0, "collision_impactnudge", "0.03125", "how much to back off from the impact"}; -cvar_t collision_extendmovelength = {0, "collision_extendmovelength", "16", "internal bias on trace length to ensure detection of collisions within the collision_impactnudge distance so that short moves do not degrade across frames (this does not alter the final trace length)"}; -cvar_t collision_extendtraceboxlength = {0, "collision_extendtraceboxlength", "1", "internal bias for tracebox() qc builtin to account for collision_impactnudge (this does not alter the final trace length)"}; -cvar_t collision_extendtracelinelength = {0, "collision_extendtracelinelength", "1", "internal bias for traceline() qc builtin to account for collision_impactnudge (this does not alter the final trace length)"}; -cvar_t collision_debug_tracelineasbox = {0, "collision_debug_tracelineasbox", "0", "workaround for any bugs in Collision_TraceLineBrushFloat by using Collision_TraceBrushBrushFloat"}; -cvar_t collision_cache = {0, "collision_cache", "1", "store results of collision traces for next frame to reuse if possible (optimization)"}; -//cvar_t collision_triangle_neighborsides = {0, "collision_triangle_neighborsides", "1", "override automatic side generation if triangle has neighbors with face planes that form a convex edge (perfect solution, but can not work for all edges)"}; -cvar_t collision_triangle_bevelsides = {0, "collision_triangle_bevelsides", "0", "generate sloped edge planes on triangles - if 0, see axialedgeplanes"}; -cvar_t collision_triangle_axialsides = {0, "collision_triangle_axialsides", "1", "generate axially-aligned edge planes on triangles - otherwise use perpendicular edge planes"}; -cvar_t collision_bih_fullrecursion = { 0, "collision_bih_fullrecursion", "0", "debugging option to disable the bih recursion optimizations by iterating the entire tree" }; +cvar_t collision_impactnudge = {CVAR_CLIENT | CVAR_SERVER, "collision_impactnudge", "0.03125", "how much to back off from the impact"}; +cvar_t collision_extendmovelength = {CVAR_CLIENT | CVAR_SERVER, "collision_extendmovelength", "16", "internal bias on trace length to ensure detection of collisions within the collision_impactnudge distance so that short moves do not degrade across frames (this does not alter the final trace length)"}; +cvar_t collision_extendtraceboxlength = {CVAR_CLIENT | CVAR_SERVER, "collision_extendtraceboxlength", "1", "internal bias for tracebox() qc builtin to account for collision_impactnudge (this does not alter the final trace length)"}; +cvar_t collision_extendtracelinelength = {CVAR_CLIENT | CVAR_SERVER, "collision_extendtracelinelength", "1", "internal bias for traceline() qc builtin to account for collision_impactnudge (this does not alter the final trace length)"}; +cvar_t collision_debug_tracelineasbox = {CVAR_CLIENT | CVAR_SERVER, "collision_debug_tracelineasbox", "0", "workaround for any bugs in Collision_TraceLineBrushFloat by using Collision_TraceBrushBrushFloat"}; +cvar_t collision_cache = {CVAR_CLIENT | CVAR_SERVER, "collision_cache", "1", "store results of collision traces for next frame to reuse if possible (optimization)"}; +cvar_t collision_triangle_bevelsides = {CVAR_CLIENT | CVAR_SERVER, "collision_triangle_bevelsides", "0", "generate sloped edge planes on triangles - if 0, see axialedgeplanes"}; +cvar_t collision_triangle_axialsides = {CVAR_CLIENT | CVAR_SERVER, "collision_triangle_axialsides", "1", "generate axially-aligned edge planes on triangles - otherwise use perpendicular edge planes"}; +cvar_t collision_bih_fullrecursion = {CVAR_CLIENT | CVAR_SERVER, "collision_bih_fullrecursion", "0", "debugging option to disable the bih recursion optimizations by iterating the entire tree"}; mempool_t *collision_mempool; @@ -31,7 +30,6 @@ void Collision_Init (void) Cvar_RegisterVariable(&collision_extendtraceboxlength); Cvar_RegisterVariable(&collision_debug_tracelineasbox); Cvar_RegisterVariable(&collision_cache); -// Cvar_RegisterVariable(&collision_triangle_neighborsides); Cvar_RegisterVariable(&collision_triangle_bevelsides); Cvar_RegisterVariable(&collision_triangle_axialsides); Cvar_RegisterVariable(&collision_bih_fullrecursion); @@ -1202,7 +1200,7 @@ void Collision_BrushForBox(colboxbrushf_t *boxbrush, const vec3_t mins, const ve //pseudocode for detecting line/sphere overlap without calculating an impact point //linesphereorigin = sphereorigin - linestart;linediff = lineend - linestart;linespherefrac = DotProduct(linesphereorigin, linediff) / DotProduct(linediff, linediff);return VectorLength2(linesphereorigin - bound(0, linespherefrac, 1) * linediff) >= sphereradius*sphereradius; -// LordHavoc: currently unused, but tested +// LadyHavoc: currently unused, but tested // note: this can be used for tracing a moving sphere vs a stationary sphere, // by simply adding the moving sphere's radius to the sphereradius parameter, // all the results are correct (impactpoint, impactnormal, and fraction)