Created attachment 2673[details]
iqm.diff
This patch adds support for loading and rendering IQM models.
It has a few limitations though:
- It does not lift the 1000-vertex-per-surface limit of the Q3 engine, so complex models may not work.
- The animations stored in the .iqm file are ignored, all animations have to be defined as usual with animation.cfg files.
- The animation can only render the poses predefined in the iqm file, overriding the position of individual bones is not supported.
- The iqm renderer uses a memory allocation in the renderer backend, so this probably breaks when the renderer backend is run in a separate thread.
Should probably use model_t::md4 (like MD4 and MDR) instead of adding model_t::iqmData as it makes all models use more memory.
IQMs should set mins/maxs in R_ModelBounds. (See https://bugzilla.icculus.org/show_bug.cgi?id=4966 )
IQMs can only be loaded if cgame/ui specifically ask for ".iqm" (which for most things is not possible without code modifications). (See https://bugzilla.icculus.org/show_bug.cgi?id=4967 )
(In reply to comment #1)
> Should probably use model_t::md4 (like MD4 and MDR) instead of adding
> model_t::iqmData as it makes all models use more memory.
>
Actually I had replaced the md3, md4, iqm pointers with a union in my development code, but that would mean to change the md3/md4 code too and using the md4 pointer seemed a bit hackish, as the variable name implies it is used for md4 only.
If you're going to update the MD3/MD4 loaders anyway shouldn't we at least rename the md4 pointer to "modelData" or something ?
> IQMs should set mins/maxs in R_ModelBounds. (See
> https://bugzilla.icculus.org/show_bug.cgi?id=4966 )
>
> IQMs can only be loaded if cgame/ui specifically ask for ".iqm" (which for most
> things is not possible without code modifications). (See
> https://bugzilla.icculus.org/show_bug.cgi?id=4967 )
(In reply to comment #2)
> (In reply to comment #1)
> > Should probably use model_t::md4 (like MD4 and MDR) instead of adding
> > model_t::iqmData as it makes all models use more memory.
> >
>
> Actually I had replaced the md3, md4, iqm pointers with a union in my
> development code, but that would mean to change the md3/md4 code too and using
> the md4 pointer seemed a bit hackish, as the variable name implies it is used
> for md4 only.
>
> If you're going to update the MD3/MD4 loaders anyway shouldn't we at least
> rename the md4 pointer to "modelData" or something ?
>
> > IQMs should set mins/maxs in R_ModelBounds. (See
> > https://bugzilla.icculus.org/show_bug.cgi?id=4966 )
> >
> > IQMs can only be loaded if cgame/ui specifically ask for ".iqm" (which for most
> > things is not possible without code modifications). (See
> > https://bugzilla.icculus.org/show_bug.cgi?id=4967 )
Yes, you're right. Also currently model_t::bmodel/md3/md4 are often checked if (non-)NULL instead of checking model_t::type, so cannot safely use them for multiple model formats without making many changes. Sorry about that.
Created attachment 2673 [details] iqm.diff This patch adds support for loading and rendering IQM models. It has a few limitations though: - It does not lift the 1000-vertex-per-surface limit of the Q3 engine, so complex models may not work. - The animations stored in the .iqm file are ignored, all animations have to be defined as usual with animation.cfg files. - The animation can only render the poses predefined in the iqm file, overriding the position of individual bones is not supported. - The iqm renderer uses a memory allocation in the renderer backend, so this probably breaks when the renderer backend is run in a separate thread.