Inactive IQM Support

filth

New Member
Contributor
Hi,

im working on IGM Support right now. Immortius supposed it in the Multiplayer Arc thread.

Name: igmLoader
Summary: The Inter-Quake Model (IQM) format is a binary skeletal-animation format designed for extensibility, efficiency, and ease of loading. It is intended to serve as a replacement for the aging MD5 and SMD skeletal-animation formats used in Quake-derived and Quake-like 3D engines. It has a companion export-only format, Inter-Quake Export (IQE), which is an extremely easy to export ASCII format that compiles to IQM, while supporting all IQM features, and is inspired by the OBJ format.
Scope: Engine
Current Goal: Allow loading of Skeletons out of .IGM Files
Phase: Implementation
Curator: filth

The architecture of the files is described here: http://lee.fov120.com/iqm/iqm.txt
Essentially the goal is to create a pair of AssetLoaders, one to load an IQM skeleton file to SkeletalMeshData, the other to load an IQM animation file to MeshAnimationData. Im working against the multiplayer branch.

There are some libs out there that make binary mapping of structs in Java more simple. Preon or Javolution are two of them - both needs to be evaluated.

Best
Alex
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Thanks!

I just pulled the latest raw files for the Light & Shadow models from glasz (they were submitted to his fork of TeraMisc but not in MovingBlocks' version yet). Some of them have been added to the "lightAndShadow" module in develop but I figure you might need the raw files to re-export into the new format (and they aren't in the multiplayer branch anyway). With the L&S module enabled you can currently spawn a red queen and see her (in two pieces - something is off) in-game via console with something like:

/spawnPrefab "lightAndShadow:redqueen"

(Typing that from memory at work, not sure it is 100% exact)
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
I don't have an experience with either library so I guess just pick one and try it. Perhaps the one that looks better maintained, or at least is in maven central.

Edit: I would probably go with javolution in the first instance, although for some reason their latest stable release is a SNAPSHOT version (madness).
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Oh, I think you'll find uint translates to Unsigned32 (an uint is 4 bytes) (to reply to your stack overflow question).
 

filth

New Member
Contributor
Yes that seems to help - it was a combination of 2 problems: first one reading to Unsigned8 instead of Unsigned32 and a wrong endiandness which made me think that Unsigned32 is wrong :)
 

filth

New Member
Contributor
Reading the header works fine with

Code:
            DataInputStream dis = new DataInputStream((new FileInputStream(file)));
            dis.readFully(fileData);
            dis.close();
 
            ByteBuffer byteBuffer = ByteBuffer.allocate(fileData.length);
            byteBuffer.put(fileData);
            byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
 
            IQMHeader header = new IQMHeader(byteBuffer);
And

Code:
import javolution.io.Struct;
 
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
 
public class IQMHeader extends Struct {
 
    public final UTF8String magic = new UTF8String(16);
    public final Unsigned32 version = new Unsigned32();
    public final Unsigned32 filesize = new Unsigned32();
    public final Unsigned32 flags = new Unsigned32();
 
    public final Unsigned32 num_text = new Unsigned32();
    public final Unsigned32 ofs_text = new Unsigned32();
 
    public final Unsigned32 num_meshes = new Unsigned32();
    public final Unsigned32 ofs_meshes = new Unsigned32();
 
    public final Unsigned32 num_vertexarrays = new Unsigned32();
    public final Unsigned32 num_vertexes = new Unsigned32();
    public final Unsigned32 ofs_vertexarrays = new Unsigned32();
 
    public final Unsigned32 num_triangles = new Unsigned32();
    public final Unsigned32 ofs_triangles = new Unsigned32();
    public final Unsigned32 ofs_adjacency = new Unsigned32();
 
    public final Unsigned32 num_joints = new Unsigned32();
    public final Unsigned32 ofs_joints = new Unsigned32();
 
    public final Unsigned32 num_poses = new Unsigned32();
    public final Unsigned32 ofs_poses = new Unsigned32();
 
    public final Unsigned32 num_anims = new Unsigned32();
    public final Unsigned32 ofs_anims = new Unsigned32();
 
    public final Unsigned32 num_frames = new Unsigned32();
    public final Unsigned32 num_framechannels = new Unsigned32();
    public final Unsigned32 ofs_frames = new Unsigned32();
    public final Unsigned32 ofs_bounds = new Unsigned32();
 
    public final Unsigned32 num_comment = new Unsigned32();
    public final Unsigned32 ofs_comment = new Unsigned32();
 
    // these are stored as a linked list, not as a contiguous array
    public final Unsigned32 num_extensions = new Unsigned32();
    public final Unsigned32 ofs_extensions = new Unsigned32();
 
    public ByteOrder byteOrder() {
        return ByteOrder.LITTLE_ENDIAN;
    }
 
    public IQMHeader(ByteBuffer buffer) {
        this.setByteBuffer(buffer, 0);
    }
}
I could use some help in getting the Joints now - the amount and position is stored here:

public final Unsigned32 num_joints = new Unsigned32();
public final Unsigned32 ofs_joints = new Unsigned32();

But i dont know how to access and map them correctly
 
Top