Q3PatchTesselateFloat(3, sizeof(float[3]), out->data_collisionvertex3f, patchsize[0], patchsize[1], sizeof(float[3]), originalvertex3f, xtess, ytess);
Q3PatchTriangleElements(out->data_collisionelement3i, finalwidth, finalheight);
+ Mod_SnapVertices(3, out->num_vertices, out->data_vertex3f, 0.25);
+ Mod_SnapVertices(3, out->num_collisionvertices, out->data_collisionvertex3f, 1);
+
oldnumtriangles = out->num_triangles;
oldnumtriangles2 = out->num_collisiontriangles;
out->num_triangles = Mod_RemoveDegenerateTriangles(out->num_triangles, out->data_element3i, out->data_element3i, out->data_vertex3f);
return i;
}
+void Mod_SnapVertices(int numcomponents, int numvertices, float *vertices, float snap)
+{
+ int i;
+ double isnap = 1.0 / snap;
+ for (i = 0;i < numvertices*numcomponents;i++)
+ vertices[i] = floor(vertices[i]*isnap)*snap;
+}
+
int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f)
{
int i, outtriangles;
void Mod_FreeSkinFiles(skinfile_t *skinfile);
int Mod_CountSkinFiles(skinfile_t *skinfile);
+void Mod_SnapVertices(int numcomponents, int numvertices, float *vertices, float snap);
int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f);
#endif // MODEL_SHARED_H