Mapping textures onto closed shapes causes a wrapping problem at the seam. It requires multiple points to exist with the same position but different texture coordinates.
Consider the case of texture mapping a rectangular image of the earth onto a sphere. Using the standard code for a sphere, and converting to lat and lon to use as texture coordinates, the listing for src/models/earth.c:
#includedouble func(double x, double y, double z) { return x*x + y*y + z*z - .8; } void texcoord(double t[3], double p[3]) { t[0] = (atan2(p[0], p[1])+M_PI)/(2*M_PI); t[1] = acos(p[2]/sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2])) / M_PI; t[2] = 1; }
Specifying a texture:
$ meteor src/models/earth.c --texture src/models/earth.png
Specifying the --correct-texcoord options:
$ meteor src/models/earth.c --texture src/models/earth.png --correct-texcoords
The algorithm cuts the mesh, propagating point position toward texture seams. Points are duplicated and triangles are redistributed.