+void Mod_ConvertQ2AliasVerts (int numverts, vec3_t scale, vec3_t translate, trivertx_t *v, trivert2 *out)
+{
+ int i;
+ vec3_t temp;
+ for (i = 0;i < numverts;i++)
+ {
+ VectorCopy(v[i].v, out[i].v);
+ temp[0] = v[i].v[0] * scale[0] + translate[0];
+ temp[1] = v[i].v[1] * scale[1] + translate[1];
+ temp[2] = v[i].v[2] * scale[2] + translate[2];
+ // update bounding box
+ if (temp[0] < aliasbboxmin[0]) aliasbboxmin[0] = temp[0];
+ if (temp[1] < aliasbboxmin[1]) aliasbboxmin[1] = temp[1];
+ if (temp[2] < aliasbboxmin[2]) aliasbboxmin[2] = temp[2];
+ if (temp[0] > aliasbboxmax[0]) aliasbboxmax[0] = temp[0];
+ if (temp[1] > aliasbboxmax[1]) aliasbboxmax[1] = temp[1];
+ if (temp[2] > aliasbboxmax[2]) aliasbboxmax[2] = temp[2];
+ out[i].n[0] = (signed char) (r_avertexnormals[v[i].lightnormalindex][0] * 127.0);
+ out[i].n[1] = (signed char) (r_avertexnormals[v[i].lightnormalindex][1] * 127.0);
+ out[i].n[2] = (signed char) (r_avertexnormals[v[i].lightnormalindex][2] * 127.0);
+ }
+ /*
+ int i, j;
+ vec3_t t1, t2;
+ struct
+ {
+ vec3_t v;
+ vec3_t normal;
+ int count;
+ } tempvert[MD2MAX_VERTS];
+ temptris_t *tris;
+ // decompress vertices
+ for (i = 0;i < numverts;i++)
+ {
+ VectorCopy(v[i].v, out[i].v);
+ tempvert[i].v[0] = v[i].v[0] * scale[0] + translate[0];
+ tempvert[i].v[1] = v[i].v[1] * scale[1] + translate[1];
+ tempvert[i].v[2] = v[i].v[2] * scale[2] + translate[2];
+ tempvert[i].normal[0] = tempvert[i].normal[1] = tempvert[i].normal[2] = 0;
+ tempvert[i].count = 0;
+ // update bounding box
+ if (tempvert[i].v[0] < aliasbboxmin[0]) aliasbboxmin[0] = tempvert[i].v[0];
+ if (tempvert[i].v[1] < aliasbboxmin[1]) aliasbboxmin[1] = tempvert[i].v[1];
+ if (tempvert[i].v[2] < aliasbboxmin[2]) aliasbboxmin[2] = tempvert[i].v[2];
+ if (tempvert[i].v[0] > aliasbboxmax[0]) aliasbboxmax[0] = tempvert[i].v[0];
+ if (tempvert[i].v[1] > aliasbboxmax[1]) aliasbboxmax[1] = tempvert[i].v[1];
+ if (tempvert[i].v[2] > aliasbboxmax[2]) aliasbboxmax[2] = tempvert[i].v[2];
+ }
+ // calculate surface normals
+ tris = temptris;
+ for (i = 0;i < numtris;i++)
+ {
+ VectorSubtract(tempvert[tris->v[0]].v, tempvert[tris->v[1]].v, t1);
+ VectorSubtract(tempvert[tris->v[2]].v, tempvert[tris->v[1]].v, t2);
+ CrossProduct(t1, t2, tris->normal);
+ VectorNormalize(tris->normal);
+ // add surface normal to vertices
+ for (j = 0;j < 3;j++)
+ {
+ VectorAdd(tris->normal, tempvert[tris->v[j]].normal, tempvert[tris->v[j]].normal);
+ tempvert[tris->v[j]].count++;
+ }
+ tris++;
+ }
+ // average normals and write out 1.7bit format
+ for (i = 0;i < pheader->numtris;i++)
+ {
+ VectorNormalize(tempvert[i].normal);
+ out[i].n[0] = (signed char) (tempvert[i].normal[0] * 127.0);
+ out[i].n[1] = (signed char) (tempvert[i].normal[1] * 127.0);
+ out[i].n[2] = (signed char) (tempvert[i].normal[2] * 127.0);
+ }
+ */
+}
+