我正在尝试在球体上拟合世界纹理。它几乎可以工作,但纹理重复了两次。这是我的映射代码:
v = acosf(sp->coll->z / (double)sp->radius) / M_PI ;
u = asinf(sp->coll->y / ((double)sp->radius * sinf(v * M_PI))) / M_PI;
u += 0.5;
// u and v are between 0 and 1
i = (int)((float)texture->xsize * (v - ((int)v)));
j = (int)((float)texture->ysize * (u - ((int)u)));
this->color = texture->map[j][i];
什么可能导致此问题?