Bug 4965 - support for IQM format
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Video
Version: GIT MASTER
Hardware: PC All
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2011-04-29 15:23 EDT by gimhael
Modified: 2011-05-02 11:51:29 EDT
2 users (show)

See Also:


Attachments
iqm.diff (33.04 KB, patch)
2011-04-29 15:23 EDT, gimhael

Description gimhael 2011-04-29 15:23:54 EDT
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.
Comment 1 Zack Middleton 2011-04-29 23:34:25 EDT
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 )
Comment 2 gimhael 2011-04-30 02:21:34 EDT
(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 )
Comment 3 Zack Middleton 2011-04-30 03:31:34 EDT
(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.
Comment 4 Thilo Schulz 2011-05-02 11:51:29 EDT
applied r1953, thanks!