-
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
Open
Duude92
wants to merge
23
commits into
LogicAndTrick:master
Choose a base branch
from
Duude92:source-mdl-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_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