This is a followup to my previous posts on the clipping problems
introduced by rescaling.  I apologize for not replying to that
thread, but I've deleted the original message.  I wanted to post
this to share the "solution" (more of a hack) that I found in case
anyone else is interested.

It appears that the problems occur because of changing the mins
in GetHullBounds and HUD_GetHullBounds.  When the mins are changed,
it causes an offset in any hull traces equal to the difference
of the new mins minus the original (-16, -16, -36) mins.  My guess
is that the engine adds the original mins as a constant to the
start and end positions of the trace at some point (I would
appreciate it if someone from Valve could confirm this).  My
"solution" was to change hlcsg so that the brush expansion for
making the clipping trees (if that's the correct term) compensates
for this.  I changed the following code in Zoner's Half Life Tools'
hlcsg project, in hullfile.cpp, in the function LoadHullfile:

Original code:
    g_hull_size[i][0][0] = -x;
    g_hull_size[i][0][1] = -y;
    g_hull_size[i][0][2] = -z;

    g_hull_size[i][1][0] = x;
    g_hull_size[i][1][1] = y;
    g_hull_size[i][1][2] = z;

Changed to:
     // Hack to compensate for HL engine having problems with
     // hull mins other than (-16, -16, -36)
     // Yes, I know the math could be simplified, but it seemed
     // clearer to me what the change was doing by leaving
     // it like this.
     g_hull_size[i][0][0] = -x - x - g_hull_size[i][0][0];
     g_hull_size[i][0][1] = -y - y - g_hull_size[i][0][1];
     g_hull_size[i][0][2] = -z - z - g_hull_size[i][0][2];

     g_hull_size[i][1][0] = x + x + g_hull_size[i][0][0];
     g_hull_size[i][1][1] = y + y + g_hull_size[i][0][1];
     g_hull_size[i][1][2] = z + z + g_hull_size[i][0][2];

This change should still allow the program to work properly if
the original hull sizes are used, but will also allow the use of
a modified hull with correct clipping.

Jim


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to