Trouble with UVs getUVAtPoint


#1

Hi, guys.

I have been working on an exporter but somehow the UVs being all messed up has escaped me but you can see them here.

It should be a brick wall on each face of the cube instead. So it looks like they are kind of right…but completely wrong.

I retrianglute in my exporter so I am not sure if that is an issue. When I look on the texture map editor for the UVsI get one value, when I call the method I sometimes get that, and sometimes another value!

So by manually looking I get (1, 1, 1) mapping to [ 0.625u 0.250v]

2:v[3][3:1.000, 1.000, 1.000] normal[0.000, 0.000, 1.000]UV[0.375u 0.000v]
3:v[3][3:1.000, 1.000, 1.000] normal[0.000, 0.000, 1.000]UV[0.625u 0.250v]
7:v[3][3:1.000, 1.000, 1.000] normal[0.000, 1.000, 0.000]UV[0.625u 0.250v]
28:v[3][3:1.000, 1.000, 1.000] normal[1.000, 0.000, 0.000]UV[0.625u 0.250v]

I am looking at the same verts here, used by different polygons. On 3/4 they are what I get manually. For the other one it is incorrect!

Is there anything at all that is context sensitive about UVs?

				MPoint uvp1;
				MPoint uvp2;
				MPoint uvp3;
				float uvs1[2] = {0.0f, 0.0f};
				float uvs2[2] = {0.0f, 0.0f};
				float uvs3[2] = {0.0f, 0.0f};

				uvp1.x=verts[triangulatedVertList[start]].x;
				uvp1.y=verts[triangulatedVertList[start]].y;
				uvp1.z=verts[triangulatedVertList[start]].z;

				uvp2.x=verts[triangulatedVertList[middle]].x;
				uvp2.y=verts[triangulatedVertList[middle]].y;
				uvp2.z=verts[triangulatedVertList[middle]].z;

				uvp3.x=verts[triangulatedVertList[end]].x;
				uvp3.y=verts[triangulatedVertList[end]].y;
				uvp3.z=verts[triangulatedVertList[end]].z;

				fMesh.getUVAtPoint(uvp1, uvs1);
				fMesh.getUVAtPoint(uvp2, uvs2);
				fMesh.getUVAtPoint(uvp3, uvs3);

				u1 = uvs1[0];
				v1 = uvs1[1];
				u2 = uvs2[0];
				v2 = uvs2[1];
				u3 = uvs3[0];
				v3 = uvs3[1];

				UList.append(u1);
				UList.append(u2);
				UList.append(u3);
				VList.append(v1);
				VList.append(v2);
				VList.append(v3);

Any ideas?