GZDoomBuilder 1.06c:

Fixed incorrect rendering of MD3 models with more than one MD3 Surface.
Fixed a bug introduced in 1.06b when models weren't rendered in Visual mode when Fullbright mode was on.
This commit is contained in:
MaxED 2012-05-25 11:21:54 +00:00
parent 6d7d8c286d
commit 9b76183afd
2 changed files with 10 additions and 4 deletions

View file

@ -138,7 +138,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
private static string ReadSurface(ref BoundingBoxSizes bbs, BinaryReader br, List<short> polyIndecesList, List<WorldVertex> vertList, ModeldefEntry mde) {
var start = br.BaseStream.Position;
int vertexOffset = vertList.Count;
long start = br.BaseStream.Position;
string magic = ReadString(br, 4);
if (magic != "IDP3")
return "error while reading surface: Magic should be 'IDP3', not '" + magic + "'";
@ -157,7 +158,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
br.BaseStream.Position = start + ofsTriangles;
for (int i = 0; i < numTriangles * 3; i++)
polyIndecesList.Add( (short)br.ReadInt32() );
polyIndecesList.Add( (short)(vertexOffset + br.ReadInt32()) );
//Vertices
@ -166,7 +167,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
for (int i = 0; i < numVerts; i++) {
WorldVertex v = new WorldVertex();
v.c = 0xffffff;
v.c = -1; //white
v.u = br.ReadSingle();
v.v = br.ReadSingle();
@ -177,7 +178,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
if (start + ofsNormal != br.BaseStream.Position)
br.BaseStream.Position = start + ofsNormal;
for (int i = 0; i < numVerts; i++) {
for (int i = vertexOffset; i < vertexOffset + numVerts; i++) {
WorldVertex v = vertList[i];
v.y = -(float)br.ReadInt16() / 64 * mde.Scale.X;
@ -291,6 +292,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
//uv
v.u = uvCoordsList[uvIndecesList[i]].X;
v.v = uvCoordsList[uvIndecesList[i]].Y;
//color
v.c = -1; //white
vertList[polyIndecesList[i]] = v;
}

View file

@ -1067,6 +1067,9 @@ namespace CodeImp.DoomBuilder.Rendering
graphics.Shaders.World3D.CameraPosition = new Vector4(cameraposition.x, cameraposition.y, cameraposition.z, getFogEnd(sector, sectorHasFogColor));
}
//dbg
//GZBuilder.GZGeneral.TraceInHeader("Using shader #"+wantedshaderpass);
for (int i = 0; i < group.Key.Model.NUM_MESHES; i++) {
if (!graphics.Shaders.Enabled) graphics.Device.SetTexture(0, group.Key.Model.Textures[i]);
graphics.Shaders.World3D.Texture1 = group.Key.Model.Textures[i];