From e4692125d33b8e2267aa5581f8f58654f1df64a8 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 23 Jun 2019 00:51:41 +0300 Subject: [PATCH] Fix index buffers --- ValveResourceFormat/ThirdParty/MeshOptimizerIndexDecoder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ValveResourceFormat/ThirdParty/MeshOptimizerIndexDecoder.cs b/ValveResourceFormat/ThirdParty/MeshOptimizerIndexDecoder.cs index 760d9beb9..844f951ae 100644 --- a/ValveResourceFormat/ThirdParty/MeshOptimizerIndexDecoder.cs +++ b/ValveResourceFormat/ThirdParty/MeshOptimizerIndexDecoder.cs @@ -60,6 +60,8 @@ private static uint DecodeIndex(BinaryReader data, uint next, uint last) private static void WriteTriangle(Span destination, int offset, int indexSize, uint a, uint b, uint c) { + offset *= indexSize; + if (indexSize == 2) { BinaryPrimitives.WriteUInt16LittleEndian(destination.Slice(offset + 0), (ushort)a);