Sorry I totally forgot about this.  I think it may be fixed in our internal 
code, as the current shipping code has this:

template <>
inline float LoopingLerp_Hermite( float t, float p0, float p1, float p2 )
{
        if ( fabs( p1 - p0 ) > 0.5f )
        {
                if ( p0 < p1 )
                        p0 += 1.0f;
                else
                        p1 += 1.0f;
        }

        if ( fabs( p2 - p1 ) > 0.5f )
        {
                if ( p1 < p2 )
                {
                        p1 += 1.0f;

                        // see if we need to fix up p0
                        // important for vars that are decreasing from 
p0->p1->p2 where
                        // p1 is fixed up relative to p2, eg p0 = 0.2, p1 = 
0.1, p2 = 0.9
                        if ( abs( p1 - p0 ) > 0.5 )
                        {
                                if ( p0 < p1 )
                                        p0 += 1.0f;
                                else
                                        p1 += 1.0f;
                        }
                }
                else
                {
                        p2 += 1.0f;
                }
        }

        float s = Lerp_Hermite( t, p0, p1, p2 );

        s = s - (int)(s);
        if (s < 0.0f)
        {
                s = s + 1.0f;
        }

        return s;
}

Let me know if this doesn't produce the same results as Paul's code, I suspect 
it does due to the comment dealing with decreasong p0->p2 values

Yahn

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mulchman
Sent: Friday, September 14, 2007 7:37 AM
To: [email protected]
Subject: Re: [hlcoders] LoopingLerp_Hermite

--
[ Picked text/plain from multipart/alternative ] Back around 6/6/2006 I sent a 
proposed fixed to Yahn (pre-knowing about this
list) as our sentry gun and respawn turret guys were messed up.

It's easy to see the problem if you change the tau gun on the buggy to spin the 
opposite way.

On 9/8/07, Paul Peloski <[EMAIL PROTECTED]> wrote:
>
> --
> [ Picked text/plain from multipart/alternative ] Hey guys,
>
> I found a bug with LoopingLerp_Hermite (cl_dll/lerp_functions.h). Here
> is my proposed fix: http://pastebin.ca/686895
>
> LoopingLerp_Hermite is used to interpolate m_iv_flCycle and
> m_iv_flPoseParameter. The function is capable of looping 0..1, but
> hitches/stutters when in reverse (1..0). If you've made a "wrap" pose
> parameter that spins 360° in any either direction (yaw on a sentry
> gun, for
> example) then you've probably met this bug.
> <http://pastebin.ca/686895>
>
> The fix I posted above seems to solve the problem, but I have not
> tested it completely. Anybody else seen/fixed this bug and have a fix
> of their own?
>
> Regards,
>
> Paul
> --
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
--

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


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

Reply via email to