void Interpolate(const MeshVertex &sv, const MeshVertex &ev, MeshVertex &out, float s)
{
int i;
unsigned char *color1,*color2,*color;
color = (unsigned char *) &out.Color;
color1 = (unsigned char *) &sv.Color;
color2 = (unsigned char *) &ev.Color;
for(i=0;i<3;i++)
color[i] = unsigned char(color1[i] + int(s * (color2[i] - color1[i])));
out.TexCoord.x = sv.TexCoord.x + s * (ev.TexCoord.x - sv.TexCoord.x);
out.TexCoord.y = sv.TexCoord.y + s * (ev.TexCoord.y - sv.TexCoord.y);
out.Normal = sv.Normal + s * (ev.Normal - sv.Normal); float Len = out.Normal.Length();
if(Len == 0.0f)
{
out.Normal = sv.Normal; }
else
{
out.Normal /= Len;
}
out.Pos = sv.Pos + s * (ev.Pos - sv.Pos); }