Fixed importing.

This commit is contained in:
KirylTkachou
2019-07-23 23:48:36 +03:00
parent 9d53f74c4b
commit 68b3ddaaa1
3 changed files with 107 additions and 46 deletions

View File

@ -97,14 +97,14 @@ namespace MA_Mesh
{
if(flipY)
{
//Debug.Log("01" + uvs[i].x);
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x), (uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * (atlasSize.y - textureRect.height - textureRect.y)));
//Debug.Log("02" + uvs[i].x);
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x),
(uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * (atlasSize.y - textureRect.height - textureRect.y)));
}
else
{
//Debug.Log("01" + uvs[i].x);
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x), (uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * textureRect.y));
uvs[i] = new Vector2((uvs[i].x / atlasSize.x * textureRect.width) + (1 / atlasSize.x * textureRect.x),
(uvs[i].y / atlasSize.y * textureRect.height) + (1 / atlasSize.y * textureRect.y));
//Debug.Log("02" + uvs[i].x);
}
}
@ -181,7 +181,6 @@ namespace MA_Mesh
using (StreamWriter sw = new StreamWriter(savePath + filename + ".obj"))
{
sw.Write(MeshToString(mesh));
Debug.Log(savePath + filename);
}
}
//End

View File

@ -191,7 +191,7 @@ namespace MA_Texture
//Y is 'flipped' because textures are made from left to right, bottom to top. We want to draw from left to right and top to bottom.
for (int y = combineTexture.height; y > 0; y--)
{
texture.SetPixel(x + offsetX, texture.height - y - offsetY, combineTexture.GetPixel(x, texture.height - y));
texture.SetPixel(x + offsetX, y + (texture.height - offsetY - combineTexture.height), combineTexture.GetPixel(x, y));
}
}
else