00001
00002
00003
00004
00005
00006 #include "tex_coord_gen.H"
00007
00008
00009 UVpt
00010 TexCoordGen :: fix_seems(CUVpt& fix_this_coord, CUVpt& coord2, CUVpt& coord3)
00011 {
00012
00013
00014 UVpt tex_coord = fix_this_coord;
00015 UVpt ts1 = coord2;
00016 UVpt ts2 = coord3;
00017
00018
00019
00020 double delta1U, delta2U;
00021 double deltaU = 0.0;
00022 double delta1V, delta2V;
00023 double deltaV = 0.0;
00024
00025 delta1U = ts1[0] - tex_coord[0]; delta2U = ts2[0] - tex_coord[0];
00026 delta1V = ts1[1] - tex_coord[1]; delta2V = ts2[1] - tex_coord[1];
00027
00028
00029 if ( ((delta1U > 0.5) && (delta2U > 0.5)) ||((delta1U < -0.5) && (delta2U < -0.5)))
00030 deltaU = delta1U;
00031
00032 if ( ((delta1V > 0.5) && (delta2V > 0.5)) ||((delta1V < -0.5) && (delta2V < -0.5)))
00033 deltaV = delta1V;
00034
00035
00036
00037
00038
00039 if (deltaU > 0.5)
00040 tex_coord[0]+= 1.0;
00041 if (deltaU < -0.5)
00042 tex_coord[0]+= -1.0;
00043
00044 if (deltaV > 0.5)
00045 tex_coord[1]+= 1.0;
00046 if (deltaV < -0.5)
00047 tex_coord[1]+= -1.0;
00048
00049
00050 return tex_coord;
00051
00052
00053 }