tweaked the iqm exporter code to output some custom iqm extensions.

importing tweaked to support importing from multiple mesh files.
bone remapping is supported for animations that have extra/missing bones.
complex commandline deprecated, now supports a proper import script thing, so the fte-specific iqm extension info can be specified.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5039 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-01-13 00:42:51 +00:00
parent c4ded89ad7
commit fc7664a69f
6 changed files with 5115 additions and 3951 deletions

View File

@ -8,7 +8,7 @@ UPGRADE_OBJS= \
default: all
all: iqm upgrade
all: iqm #upgrade
clean:
-$(RM) $(IQM_OBJS) $(UPGRADE_OBJS) iqm upgrade

View File

@ -14,7 +14,7 @@ UPGRADE_OBJS= \
default: all
all: iqm.exe upgrade.exe
all: iqm.exe #upgrade.exe
clean:
-$(RM) $(IQM_OBJS) $(UPGRADE_OBJS) iqm.exe upgrade.exe

56
iqm/README.txt Normal file
View File

@ -0,0 +1,56 @@
FTE's fork of Lee Salzman's commandline IQM exporter, based upon 'IQM Developer Kit 2015-08-03'.
there is no blender integration - export your files to a supported format first.
Main changes:
now utilises command files instead of needing the weird commandline stuff (although that should still mostly work).
additional mesh properties and multiple mesh files, providing for proper hitmesh support, as well as some other things.
more verbose text output, additional shader prefixes.
bone renaming+regrouping
animation unpacking, for qc mods that still insist on animating the lame way.
Supported import formats:
.md5mesh
.md5anim
.iqe
.smd
.fbx
.obj
Unless you're doing complex stuff like any of the above, there's probably not all that much difference. There may be some commandline behaviour differences.
Command File Format:
output <FILENAME> - specified the output file name. you should only have one of these.
exec <FILENAME> - exec the specified command file, before parsing the rest of the current file.
hitbox <BODY NUM> <BONE NAME> <MIN POS VECTOR> <MAX POS VECTOR> - generates a hitmesh as a bbox centered around the bone in the base pose (the hitbox will rotate/move with animations). The bodynum will be visible to gamecode, and may merge with other hitboxes with the same group.
modelflags <NAME OR HEX> - enables the specified bit in the iqm header. supported names include q1_rocket, q1_grenade, q1_gib, q1_rotate, q1_tracer1, q1_zomgib, q1_tracer2, q1_tracer3
<MESH PROPERTY> - defined below and applied as the defaults to the following import lines as well as mesh lines.
mesh <NAME> [MESH PROPERTIES LIST] - provides overrides for a single named mesh (properties used will be those as they're already defined, if not otherwise listed).
bone <SOURCENAME> [rename <NEWNAME>] [group <GROUPNUM>] - provides bone renaming and grouping. try to avoid renaming two bones to the same resulting name... groups may have limitations if a parent/child relationship cannot be honoured. lowest group numbers come before higher groups. by default bones will inherit their group from their parent.
<IMPORT PROPERTY> - defined below and applied as the defaults to the following import lines.
import <FILENAME> [IMPORT PROPERTIES] [MESH PROPERTIES] - imports the meshes and animations from the specified file.
Mesh Properties:
contents <NAMES OR 0xBITS> - 'body' or 'empty' are the two that are most likely to be used. 'solid' may also be desired, or possibly also 'corpse'.
surfaceflags <NAMES OR 0xBITS> - 'q3_nodraw/fte_nodraw'
body <NUMBER> - this is the 'body' value reported to gamecode when a trace hits this surface.
geomset <GEOMGROUP> <GEOMID> - by configuring this, you can have models display different body parts for different character models.
lodrange <MINDIST> <MAXDIST> - not yet implemented by the engine. 0 for both is the default.
Anim/Import Properties:
name <NAME> - the imported animations will be assigned this name. May be problematic if the imported file(s) share the same name, so try to avoid using this at global scope.
fps <RATE> - framerate for any imported animations.
loop - flags animations as looping.
clamp - disables looping.
unpack - seperates each pose of the animations into a seperate single-pose animation for compat with q1 or q2-style model animations.
pack - disables unpacking again.
nomesh <1|0> - discards all meshed from the affected files.
noanim <1|0> - discards animations from the affected files, does not disclude the base pose.
materialprefix <PREFIX/> - provides a text prefix on the material name, which should make it easier for editors while still honouring shader paths.
start <FIRSTPOSE> - the fist pose to import.
end <LASTPOSE> - the last pose to import.
rotate <PITCH> <YAW> <ROLL> - rotates the model
scale <SCALER> - rescales the model
origin <X> <Y> <Z> - moves the thing
event [ANIM,]<POSE[.FRAC]> <EVENTCODE> <"EVENTDATA"> - embeds event info within the animation, for stuff like footsteps. How this is used depends on the engine... If used at global scope, can be reset with 'event reset' in order to not apply to later files.

File diff suppressed because it is too large Load Diff

149
iqm/iqm.h
View File

@ -6,129 +6,146 @@
struct iqmheader
{
char magic[16];
unsigned int version;
unsigned int filesize;
unsigned int flags;
unsigned int num_text, ofs_text;
unsigned int num_meshes, ofs_meshes;
unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
unsigned int num_triangles, ofs_triangles, ofs_adjacency;
unsigned int num_joints, ofs_joints;
unsigned int num_poses, ofs_poses;
unsigned int num_anims, ofs_anims;
unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
unsigned int num_comment, ofs_comment;
unsigned int num_extensions, ofs_extensions;
char magic[16];
unsigned int version;
unsigned int filesize;
unsigned int flags;
unsigned int num_text, ofs_text;
unsigned int num_meshes, ofs_meshes;
unsigned int num_vertexarrays, num_vertexes, ofs_vertexarrays;
unsigned int num_triangles, ofs_triangles, ofs_adjacency;
unsigned int num_joints, ofs_joints;
unsigned int num_poses, ofs_poses;
unsigned int num_anims, ofs_anims;
unsigned int num_frames, num_framechannels, ofs_frames, ofs_bounds;
unsigned int num_comment, ofs_comment;
unsigned int num_extensions, ofs_extensions;
};
struct iqmmesh
{
unsigned int name;
unsigned int material;
unsigned int first_vertex, num_vertexes;
unsigned int first_triangle, num_triangles;
unsigned int name;
unsigned int material;
unsigned int first_vertex, num_vertexes;
unsigned int first_triangle, num_triangles;
};
enum
{
IQM_POSITION = 0,
IQM_TEXCOORD = 1,
IQM_NORMAL = 2,
IQM_TANGENT = 3,
IQM_BLENDINDEXES = 4,
IQM_BLENDWEIGHTS = 5,
IQM_COLOR = 6,
IQM_CUSTOM = 0x10
IQM_POSITION = 0,
IQM_TEXCOORD = 1,
IQM_NORMAL = 2,
IQM_TANGENT = 3,
IQM_BLENDINDEXES = 4,
IQM_BLENDWEIGHTS = 5,
IQM_COLOR = 6,
IQM_CUSTOM = 0x10
};
enum
{
IQM_BYTE = 0,
IQM_UBYTE = 1,
IQM_SHORT = 2,
IQM_USHORT = 3,
IQM_INT = 4,
IQM_UINT = 5,
IQM_HALF = 6,
IQM_FLOAT = 7,
IQM_DOUBLE = 8
IQM_BYTE = 0,
IQM_UBYTE = 1,
IQM_SHORT = 2,
IQM_USHORT = 3,
IQM_INT = 4,
IQM_UINT = 5,
IQM_HALF = 6,
IQM_FLOAT = 7,
IQM_DOUBLE = 8
};
struct iqmtriangle
{
unsigned int vertex[3];
unsigned int vertex[3];
};
struct iqmadjacency
{
unsigned int triangle[3];
unsigned int triangle[3];
};
struct iqmjointv1
{
unsigned int name;
int parent;
float translate[3], rotate[3], scale[3];
unsigned int name;
int parent;
float translate[3], rotate[3], scale[3];
};
struct iqmjoint
{
unsigned int name;
int parent;
float translate[3], rotate[4], scale[3];
unsigned int name;
int parent;
float translate[3], rotate[4], scale[3];
};
struct iqmposev1
{
int parent;
unsigned int mask;
float channeloffset[9];
float channelscale[9];
int parent;
unsigned int mask;
float channeloffset[9];
float channelscale[9];
};
struct iqmpose
{
int parent;
unsigned int mask;
float channeloffset[10];
float channelscale[10];
int parent;
unsigned int mask;
float channeloffset[10];
float channelscale[10];
};
struct iqmanim
{
unsigned int name;
unsigned int first_frame, num_frames;
float framerate;
unsigned int flags;
unsigned int name;
unsigned int first_frame, num_frames;
float framerate;
unsigned int flags;
};
enum
{
IQM_LOOP = 1<<0
IQM_LOOP = 1<<0
};
struct iqmvertexarray
{
unsigned int type;
unsigned int flags;
unsigned int format;
unsigned int size;
unsigned int offset;
unsigned int type;
unsigned int flags;
unsigned int format;
unsigned int size;
unsigned int offset;
};
struct iqmbounds
{
float bbmin[3], bbmax[3];
float xyradius, radius;
float bbmin[3], bbmax[3];
float xyradius, radius;
};
struct iqmextension
{
unsigned int name;
unsigned int num_data, ofs_data;
unsigned int ofs_extensions; // pointer to next extension
unsigned int name;
unsigned int num_data, ofs_data;
unsigned int ofs_extensions; // pointer to next extension
};
struct iqmext_fte_mesh
{
unsigned int contents; //default CONTENTS_BODY
unsigned int surfaceflags; //propagates to trace_surfaceflags
unsigned int body; //the part of the body that this mesh is meant to be from
unsigned int geomset;
unsigned int geomid;
float mindist;
float maxdist;
};
struct iqmext_fte_events
{
unsigned int anim;
float timestamp;
unsigned int evcode;
unsigned int evdata_str;
};
#endif

1423
iqm/util.h

File diff suppressed because it is too large Load Diff