fix material texture name

This commit is contained in:
bird_egop
2026-06-07 15:55:56 +03:00
parent 8bed73fb5a
commit 70a5d0ef69
+6 -1
View File
@@ -83,7 +83,12 @@ public static class MaterialParser
// Texture name: 16 байт. // Texture name: 16 байт.
textureNameBuffer.Clear(); textureNameBuffer.Clear();
fs.ReadExactly(textureNameBuffer); fs.ReadExactly(textureNameBuffer);
var textureName = Encoding.ASCII.GetString(textureNameBuffer).TrimEnd('\0'); var terminator = textureNameBuffer.IndexOf((byte)0);
if (terminator == -1)
{
terminator = textureNameBuffer.Length - 1;
}
var textureName = Encoding.ASCII.GetString(textureNameBuffer[..terminator]);
stages.Add(new MaterialStage( stages.Add(new MaterialStage(
ambientR, ambientR,