diff --git a/ParkanPlayground/Msh0x07.cs b/ParkanPlayground/Msh0x07.cs
index d10f1c8..399e250 100644
--- a/ParkanPlayground/Msh0x07.cs
+++ b/ParkanPlayground/Msh0x07.cs
@@ -67,7 +67,7 @@ public static class Msh0x07
/// [0x08..0x0A] Packed normal X, int16, scale = 1 / 32767.
/// [0x0A..0x0C] Packed normal Y, int16, scale = 1 / 32767.
/// [0x0C..0x0E] Packed normal Z, int16, scale = 1 / 32767.
- /// [0x0E..0x10] Packed selectors. Старое наблюдение: 3 трактуется как 0xFFFF.
+ /// [0x0E..0x10] Packed selectors. 3 трактуется как 0xFFFF.
public readonly record struct TriangleDescriptor(
TriangleFlags Flags,
ushort Link0,
diff --git a/ParkanPlayground/Msh0x0D.cs b/ParkanPlayground/Msh0x0D.cs
index 2934cb9..2317050 100644
--- a/ParkanPlayground/Msh0x0D.cs
+++ b/ParkanPlayground/Msh0x0D.cs
@@ -54,19 +54,19 @@ public static class Msh0x0D
/// [0x02..0x04] Индекс material slot. Может быть overridden CAniMesh::forced_material_index.
/// [0x04..0x06] Opaque. В GetBatchRenderData попадает в packed field вместе с material/lightmap данными.
/// [0x06..0x08] Локальный batch index. В GetBatchRenderData складывается с MSH_piece.local_index_base / batch base.
- /// [0x08..0x0A] Количество индексов из component 0x06.
- /// [0x0A..0x0E] Первый индекс в component 0x06.
- /// [0x0E..0x10] Количество вершин для render primitive.
- /// [0x10..0x14] Base vertex в vertex streams, включая position stream 0x03.
+ /// [0x08..0x0A] Количество индексов из component 0x06.
+ /// [0x0A..0x0E] Первый индекс в component 0x06.
+ /// [0x0E..0x10] Количество вершин для render primitive.
+ /// [0x10..0x14] Base vertex в vertex streams, включая position stream 0x03.
public readonly record struct Batch(
BatchFlags Flags,
ushort MaterialIndex,
ushort Opaque04,
ushort LocalBatchIndex,
- ushort IndexCount,
- uint IndexStart,
- ushort VertexCount,
- uint BaseVertex);
+ ushort IndexCount0x06,
+ uint IndexStart0x06,
+ ushort VertexCount0x03,
+ uint BaseVertex0x03);
}
[Flags]
diff --git a/ParkanPlayground/Msh0x14.cs b/ParkanPlayground/Msh0x14.cs
index 00105fe..b694a5b 100644
--- a/ParkanPlayground/Msh0x14.cs
+++ b/ParkanPlayground/Msh0x14.cs
@@ -58,23 +58,6 @@ public static class Msh0x14
return elements;
}
- ///
- /// Component 0x14 is optional in the game reader.
- /// This helper mirrors that behavior and returns an empty list when absent.
- ///
- public static List ReadComponentOrEmpty(
- FileStream mshFs, NResArchive archive)
- {
- var entry = archive.Files.FirstOrDefault(x => x.FileType == "14 00 00 00");
-
- if (entry is null)
- {
- return [];
- }
-
- return ReadComponent(mshFs, archive);
- }
-
/// Light/probe entry 0x14.
/// [0x00..0x04] Индекс MSH_piece, чью world matrix используют для transform position/direction.
/// [0x04..0x10] Локальная позиция источника/probe относительно PieceIndex.
diff --git a/ParkanPlayground/Msh0x15.cs b/ParkanPlayground/Msh0x15.cs
index 5f390e1..121796e 100644
--- a/ParkanPlayground/Msh0x15.cs
+++ b/ParkanPlayground/Msh0x15.cs
@@ -82,7 +82,8 @@ public static class Msh0x15
ushort PackedEdgeOrSelector);
}
-public enum TerrainTriangleFlags {
+public enum TerrainTriangleFlags : uint
+{
MSH15_FLAG_REFLECTIVE_SURFACE = 0x20000,
MSH15_FLAG_HAS_MICROTEXTURE = 0x400,
MSH15_FLAG_DISABLE_BACKFACE_TEST = 0x8
diff --git a/ParkanPlayground/MshConverter.cs b/ParkanPlayground/MshConverter.cs
index 93d7d53..e32ad73 100644
--- a/ParkanPlayground/MshConverter.cs
+++ b/ParkanPlayground/MshConverter.cs
@@ -151,22 +151,22 @@ public sealed class MshConverter
{
var batch = batches[batchIndex];
- if (batch.IndexStart + batch.IndexCount > indices.Count)
+ if (batch.IndexStart0x06 + batch.IndexCount0x06 > indices.Count)
{
- Warn($"Piece {pieceIndex}, batch {batchIndex}: index range {batch.IndexStart}:{batch.IndexCount} out of range");
+ Warn($"Piece {pieceIndex}, batch {batchIndex}: index range {batch.IndexStart0x06}:{batch.IndexCount0x06} out of range");
skippedBatches++;
continue;
}
writer.WriteLine($"# batch {batchIndex}, material {batch.MaterialIndex}, flags {batch.Flags}");
- for (var i = 0; i + 2 < batch.IndexCount; i += 3)
+ for (var i = 0; i + 2 < batch.IndexCount0x06; i += 3)
{
- var indexBase = (int)batch.IndexStart + i;
+ var indexBase = (int)batch.IndexStart0x06 + i;
- var v1 = checked((int)batch.BaseVertex + indices[indexBase + 0]);
- var v2 = checked((int)batch.BaseVertex + indices[indexBase + 1]);
- var v3 = checked((int)batch.BaseVertex + indices[indexBase + 2]);
+ var v1 = checked((int)batch.BaseVertex0x03 + indices[indexBase + 0]);
+ var v2 = checked((int)batch.BaseVertex0x03 + indices[indexBase + 1]);
+ var v3 = checked((int)batch.BaseVertex0x03 + indices[indexBase + 2]);
if (!IsValidTriangle(vertices.Count, v1, v2, v3))
{
@@ -178,9 +178,9 @@ public sealed class MshConverter
exportedFaces++;
}
- if (batch.IndexCount % 3 != 0)
+ if (batch.IndexCount0x06 % 3 != 0)
{
- Warn($"Piece {pieceIndex}, batch {batchIndex}: index count {batch.IndexCount} is not divisible by 3");
+ Warn($"Piece {pieceIndex}, batch {batchIndex}: index count {batch.IndexCount0x06} is not divisible by 3");
}
}
}