Skip to content

Conversation

Duude92
Copy link
Contributor

@Duude92 Duude92 commented Aug 30, 2025

This PR adds Source engine v44 models support.
Provide multiple structs for reading different Source engine model-related formats.
Although this PR provides structs per files - it is not fully tested (e.g. I haven't looked into animation sequences and how do they work)
Screenshot with some tested models:
image
Sorry, I haven't bother to make unit-tests.
Also, probably later would test for else mdl version, and/or do fixes
Also, quick reference to code:
Since model data is seprated between multiple files - I've provided some properties/methods to 'easily' retrieve data from MdlFile object, e.g.:

  • BodypartCount => Header.bodypart_count
  • LodCount => VtxFile.Header.numLODs
  • GetModelCount(int bodypart) => Bodyparts[bodypart].Header.nummodels
  • GetMeshCount(int bodypart, int model) => Bodyparts[bodypart].Models[model].Data.nummeshes
  • MeshVertex[] GetVertices() -> this precomputes vertex data with vvd fixups
  • GetIndices(int meshIndex = 0, int lodIndex = 0, int modelIndex = 0, int bodyPart = 0) -> returns precomputed array of indices per mesh
  • GetMaterialIndex(int meshIndex = 0, int modelIndex = 0, int bodyPart = 0) => Bodyparts[bodyPart].Models[modelIndex].Meshes[meshIndex].Data.material -> material is bound to mesh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant