mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Fixed incorrect UV mapping on MD2 models in Visual modes.
This commit is contained in:
parent
a9d6eb5ce2
commit
5283989bf2
1 changed files with 16 additions and 7 deletions
|
@ -313,9 +313,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
if (s.Position != ofs_uv + start)
|
||||
s.Position = ofs_uv + start;
|
||||
|
||||
for (int i = 0; i < num_uv; i++) {
|
||||
for (int i = 0; i < num_uv; i++)
|
||||
uvCoordsList.Add(new Vector2((float)br.ReadInt16() / texWidth, (float)br.ReadInt16() / texHeight));
|
||||
}
|
||||
|
||||
//first frame
|
||||
//header
|
||||
|
@ -384,12 +383,22 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
BoundingBoxTools.UpdateBoundingBoxSizes(ref bbs, new WorldVertex(v.y, v.x, v.z));
|
||||
|
||||
//uv
|
||||
v.u = uvCoordsList[uvIndecesList[i]].X;
|
||||
v.v = uvCoordsList[uvIndecesList[i]].Y;
|
||||
//color
|
||||
v.c = -1; //white
|
||||
float tu = uvCoordsList[uvIndecesList[i]].X;
|
||||
float tv = uvCoordsList[uvIndecesList[i]].Y;
|
||||
|
||||
vertList[polyIndecesList[i]] = v;
|
||||
//uv-coordinates already set?
|
||||
if(v.c == -1 && (v.u != tu || v.v != tv)) {
|
||||
//add a new vertex
|
||||
vertList.Add(new WorldVertex(v.x, v.y, v.z, -1, tu, tv));
|
||||
polyIndecesList[i] = vertList.Count - 1;
|
||||
} else {
|
||||
v.u = tu;
|
||||
v.v = tv;
|
||||
v.c = -1; //set color to white
|
||||
|
||||
//return to proper place
|
||||
vertList[polyIndecesList[i]] = v;
|
||||
}
|
||||
}
|
||||
|
||||
//indeces for rendering current mesh in 2d
|
||||
|
|
Loading…
Reference in a new issue