You can add member functions to Vector.  It will not affect the structure's 
binary layout.

At 2006/03/05 01:08 PM, Jorge Rodriguez wrote:
>Tom Parker wrote:
>
>>Replacing this code with a more C++ friendly version would require
>>drastic changes everywhere in the engine, and be more of a pain than a
>>benefit.  I haven't yet done much vector math in HL2, but I do believe
>>that the Vector class has C++ style functions for this?
>Half-Life 1's vector.h has this in CVector:
>
>   inline Vector Normalize(void) const
>   {
>       float flLen = Length();
>       if (flLen == 0) return Vector(0,0,1); // ????
>       flLen = 1 / flLen;
>       return Vector(x * flLen, y * flLen, z * flLen);
>   }
>
>Half-Life 2 has no equivalent. However whereas in HL1, vector.h was not
>shared with the engine, in HL2 it is, so this functionality cannot
>simply be added in. The closest thing in functionality is called
>NormalizeInPlace() which just called VectorNormalize() internally and
>works the exact same way. This doesn't satisfy my desire to have a
>Normalize() that returns a Vector as Normalize() of Half-Life 1 did.
>
>The only way I can think of I would be able to have this is if I created
>a subclass of Vector just for Normalize(). Ick!
>
>--
>Jorge "Vino" Rodriguez
>
>
>_______________________________________________
>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