-
Notifications
You must be signed in to change notification settings - Fork 14
Add support of Source engine v44 mdl format (.mdl, .vvd, .vtx) #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hey @LogicAndTrick, can you review PR? |
|
Thanks for the implementation, but to be honest, I cannot review this - there's 1400 lines of code and no tests. I think its worth having this branch available to compare with another implementation though, since based on your screenshot it looks like it works well. Doing a quick scan through the code, its doing things that I specifically avoid in other parts of the lib - unmanaged memory/memory pinning, So unfortunately I won't be merging this, sorry :( |
|
I've used Marshaling just because it's faster to implement, so, maybe, someday, I may rewrite it for parser. |
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:
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_countLodCount => VtxFile.Header.numLODsGetModelCount(int bodypart) => Bodyparts[bodypart].Header.nummodelsGetMeshCount(int bodypart, int model) => Bodyparts[bodypart].Models[model].Data.nummeshesMeshVertex[] GetVertices() -> this precomputes vertex data with vvd fixupsGetIndices(int meshIndex = 0, int lodIndex = 0, int modelIndex = 0, int bodyPart = 0) -> returns precomputed array of indices per meshGetMaterialIndex(int meshIndex = 0, int modelIndex = 0, int bodyPart = 0) => Bodyparts[bodyPart].Models[modelIndex].Meshes[meshIndex].Data.material -> material is bound to mesh