Stub out the iqm loader.

This commit is contained in:
Bill Currie 2012-04-27 14:40:06 +09:00
parent e6c0512f31
commit 26a878da48
18 changed files with 376 additions and 9 deletions

View file

@ -15,6 +15,7 @@
libs/models/Makefile
libs/models/alias/Makefile
libs/models/brush/Makefile
libs/models/iqm/Makefile
libs/models/sprite/Makefile
libs/models/test/Makefile
libs/net/Makefile

View file

@ -43,6 +43,7 @@ if test "x$HAVE_FBDEV" = xyes; then
QF_NEED(models, [sw])
QF_NEED(alias, [sw])
QF_NEED(brush, [sw])
QF_NEED(iqm, [sw])
QF_NEED(sprite, [sw])
if test "x$ASM_ARCH" = "xyes"; then
QF_NEED(swrend, [asm])
@ -71,6 +72,7 @@ if test "x$HAVE_X" = xyes; then
QF_NEED(models, [sw gl glsl])
QF_NEED(alias, [sw gl glsl])
QF_NEED(brush, [sw gl glsl])
QF_NEED(iqm, [sw gl glsl])
QF_NEED(sprite, [sw gl glsl])
if test "x$ASM_ARCH" = "xyes"; then
QF_NEED(swrend, [asm])
@ -93,6 +95,7 @@ if test "x$HAVE_SDL" = xyes; then
QF_NEED(models, [sw gl glsl])
QF_NEED(alias, [sw gl glsl])
QF_NEED(brush, [sw gl glsl])
QF_NEED(iqm, [sw gl glsl])
QF_NEED(sprite, [sw gl glsl])
if test "x$ASM_ARCH" = "xyes"; then
QF_NEED(swrend, [asm])
@ -113,6 +116,7 @@ if test "x$HAVE_SVGA" = xyes; then
QF_NEED(models, [sw])
QF_NEED(alias, [sw])
QF_NEED(brush, [sw])
QF_NEED(iqm, [sw])
QF_NEED(sprite, [sw])
if test "x$ASM_ARCH" = "xyes"; then
QF_NEED(swrend, [asm])
@ -133,6 +137,7 @@ fi
# QF_NEED(models, [gl])
# QF_NEED(alias, [gl])
# QF_NEED(brush, [gl])
# QF_NEED(iqm, [gl])
# QF_NEED(sprite, [gl])
# QF_NEED(vid, [common])
# QF_NEED(qw, [client common])
@ -228,6 +233,7 @@ QF_PROCESS_NEED_DIRS(vid_render, [gl glsl sw sw32])
QF_PROCESS_NEED_LIBS(models, [gl glsl sw])
QF_PROCESS_NEED_LIBS(alias, [gl glsl sw])
QF_PROCESS_NEED_LIBS(brush, [gl glsl sw])
QF_PROCESS_NEED_LIBS(iqm, [gl glsl sw])
QF_PROCESS_NEED_LIBS(sprite, [gl glsl sw])
QF_PROCESS_NEED_LIBS(vid, [common sdl svga x11])

View file

@ -3,13 +3,13 @@ pkgincludedir = $(includedir)/QF
nobase_pkginclude_HEADERS = \
bspfile.h cbuf.h cdaudio.h checksum.h clip_hull.h cmd.h \
console.h crc.h csqc.h cvar.h dstring.h draw.h gib.h hash.h hl.h \
idparse.h image.h in_event.h info.h input.h joystick.h keys.h link.h \
llist.h locs.h mathlib.h mdfour.h model.h modelgen.h msg.h object.h pak.h \
pakfile.h pcx.h png.h plugin.h pr_comp.h pr_debug.h pr_obj.h progs.h \
qargs.h qdefs.h qendian.h qfplist.h qtypes.h quakefs.h quakeio.h render.h \
riff.h ruamoko.h screen.h script.h sizebuf.h skin.h sound.h spritegn.h \
sys.h teamplay.h tga.h uint32.h va.h ver_check.h vid.h vrect.h view.h \
wad.h wadfile.h winding.h zone.h \
idparse.h image.h in_event.h info.h input.h iqm.h joystick.h keys.h \
link.h llist.h locs.h mathlib.h mdfour.h model.h modelgen.h msg.h \
object.h pak.h pakfile.h pcx.h png.h plugin.h pr_comp.h pr_debug.h \
pr_obj.h progs.h qargs.h qdefs.h qendian.h qfplist.h qtypes.h quakefs.h \
quakeio.h render.h riff.h ruamoko.h screen.h script.h sizebuf.h skin.h \
sound.h spritegn.h sys.h teamplay.h tga.h uint32.h va.h ver_check.h vid.h \
vrect.h view.h wad.h wadfile.h winding.h zone.h \
\
GL/ati.h GL/defines.h GL/extensions.h GL/funcs.h GL/qf_explosions.h \
GL/qf_funcs_list.h GL/qf_lightmap.h \

117
include/QF/iqm.h Normal file
View file

@ -0,0 +1,117 @@
#ifndef __QF_iqm_h__
#define __QF_iqm_h__
#include "QF/qtypes.h"
#define IQM_MAGIC "INTERQUAKEMODEL"
#define IQM_SMAGIC 0x45544e49
#define IQM_VERSION 2
typedef struct iqmheader_s {
char magic[16];
uint32_t version;
uint32_t filesize;
uint32_t flags;
uint32_t num_text, ofs_text;
uint32_t num_meshes, ofs_meshes;
uint32_t num_vertexarrays, num_vertexes, ofs_vertexarrays;
uint32_t num_triangles, ofs_triangles, ofs_adjacency;
uint32_t num_joints, ofs_joints;
uint32_t num_poses, ofs_poses;
uint32_t num_anims, ofs_anims;
uint32_t num_frames, num_framechannels, ofs_frames, ofs_bounds;
uint32_t num_comment, ofs_comment;
uint32_t num_extensions, ofs_extensions;
} iqmheader;
typedef struct iqmmesh_s {
uint32_t name;
uint32_t material;
uint32_t first_vertex, num_vertexes;
uint32_t first_triangle, num_triangles;
} iqmmesh;
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
};
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
};
typedef struct iqmtriangle_s {
uint32_t vertex[3];
} iqmtriangle;
typedef struct iqmjointv1_s {
uint32_t name;
int32_t parent;
float translate[3], rotate[3], scale[3];
} iqmjointv1;
typedef struct iqmjoint_s {
uint32_t name;
int32_t parent;
float translate[3], rotate[4], scale[3];
} iqmjoint;
typedef struct iqmposev1_s {
int32_t parent;
uint32_t mask;
float channeloffset[9];
float channelscale[9];
} iqmposev1;
typedef struct iqmpose_s {
int32_t parent;
uint32_t mask;
float channeloffset[10];
float channelscale[10];
} iqmpose;
typedef struct iqmanim_s {
uint32_t name;
uint32_t first_frame, num_frames;
float framerate;
uint32_t flags;
} iqmanim;
enum {
IQM_LOOP = 1<<0
};
typedef struct iqmvertexarray_s {
uint32_t type;
uint32_t flags;
uint32_t format;
uint32_t size;
uint32_t offset;
} iqmvertexarray;
typedef struct iqmbounds_s {
float bbmin[3], bbmax[3];
float xyradius, radius;
} iqmbounds;
typedef struct iqmextension_s {
uint32_t name;
uint32_t num_data, ofs_data;
uint32_t ofs_extensions; // pointer to next extension
} iqmextension;
#endif//__QF_iqm_h__

View file

@ -333,7 +333,7 @@ extern int aliasbboxmaxs[3];
// Whole model ================================================================
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
typedef enum {mod_brush, mod_sprite, mod_alias, mod_iqm} modtype_t;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail

View file

@ -84,6 +84,7 @@ typedef struct vid_model_funcs_s {
void (*Mod_LoadLighting) (bsp_t *bsp);
void (*Mod_SubdivideSurface) (msurface_t *fa);
void (*Mod_ProcessTexture) (texture_t *tx);
void (*Mod_LoadIQM) (model_t *mod, void *buffer);
void (*Mod_LoadAliasModel) (model_t *mod, void *buffer,
cache_allocator_t allocator);
void (*Mod_LoadSpriteModel) (model_t *mod, void *buffer);

View file

@ -47,6 +47,7 @@ void gl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
void glsl_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
void sw_Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum);
void Mod_LoadIQM (model_t *mod, void *buffer);
void Mod_LoadAliasModel (model_t *mod, void *buffer,
cache_allocator_t allocator);
void Mod_LoadSpriteModel (model_t *mod, void *buffer);

View file

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS= foreign
SUBDIRS= alias brush sprite . test
SUBDIRS= alias brush iqm sprite . test
AM_CFLAGS= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
@ -27,6 +27,7 @@ gl_sources=gl_model_fullbright.c gl_skin.c skin.c
gl_libs= \
alias/libalias_gl.la \
brush/libbrush_gl.la \
iqm/libiqm_gl.la \
sprite/libsprite_gl.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_gl_la_LDFLAGS=
@ -37,6 +38,7 @@ libmodels_gl_la_SOURCES= $(gl_sources)
glsl_libs= \
alias/libalias_glsl.la \
brush/libbrush_glsl.la \
iqm/libiqm_glsl.la \
sprite/libsprite_glsl.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_glsl_la_LDFLAGS=
@ -47,6 +49,7 @@ libmodels_glsl_la_SOURCES= glsl_skin.c skin.c
sw_libs= \
alias/libalias_sw.la \
brush/libbrush_sw.la \
iqm/libiqm_sw.la \
sprite/libsprite_sw.la \
$(top_builddir)/libs/image/libQFimage.la
libmodels_sw_la_LDFLAGS=

View file

@ -0,0 +1,20 @@
AUTOMAKE_OPTIONS= foreign
AM_CFLAGS= @PREFER_PIC@
INCLUDES= -I$(top_srcdir)/include
noinst_LTLIBRARIES= @iqm_libs@
EXTRA_LTLIBRARIES=libiqm_gl.la libiqm_glsl.la libiqm_sw.la
iqm_src= model_iqm.c
gl_src= gl_model_iqm.c
glsl_src= glsl_model_iqm.c
sw_src= sw_model_iqm.c
libiqm_gl_la_SOURCES= $(gl_src) $(iqm_src)
libiqm_glsl_la_SOURCES= $(glsl_src) $(iqm_src)
libiqm_sw_la_SOURCES= $(sw_src) $(iqm_src)
EXTRA_DIST= $(gl_src) $(glsl_src) $(sw_src) $(iqm_src)

View file

@ -0,0 +1,53 @@
/*
gl_model_iqm.c
iqm model processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/04/27
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/image.h"
#include "QF/qendian.h"
#include "QF/quakefs.h"
#include "QF/skin.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/vid.h"
#include "QF/GL/qf_textures.h"
#include "mod_internal.h"
#include "compat.h"

View file

@ -0,0 +1,51 @@
/*
glsl_model_iqm.c
iqm model processing for GLSL
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/04/27
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdlib.h>
#include "QF/va.h"
#include "QF/GLSL/defines.h"
#include "QF/GLSL/funcs.h"
//#include "QF/GLSL/qf_iqm.h"
#include "QF/GLSL/qf_textures.h"
#include "mod_internal.h"
#include "r_shared.h"

View file

@ -0,0 +1,56 @@
/*
model_iqm.c
iqm model processing
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/04/27
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/crc.h"
#include "QF/msg.h"
#include "QF/qendian.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
#include "compat.h"
#include "d_iface.h"
#include "mod_internal.h"
#include "r_local.h"
void
Mod_LoadIQM (model_t *mod, void *buffer)
{
}

View file

@ -0,0 +1,47 @@
/*
sw_model_iqm.c
iqm model processing for SW
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
Author: Bill Currie <bill@taniwha.org>
Date: 2012/04/27
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "QF/qendian.h"
#include "QF/sys.h"
#include "compat.h"
#include "d_iface.h"
#include "mod_internal.h"

View file

@ -39,6 +39,7 @@
#endif
#include "QF/cvar.h"
#include "QF/iqm.h"
#include "QF/model.h"
#include "QF/qendian.h"
#include "QF/quakefs.h"
@ -194,6 +195,12 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator)
mod->hasfullbrights = false;
switch (LittleLong (*buf)) {
case IQM_SMAGIC:
if (strequal ((char *) buf, IQM_MAGIC)) {
if (mod_funcs)
mod_funcs->Mod_LoadIQM (mod, buf);
}
break;
case IDHEADER_MDL: // Type 6: Quake 1 .mdl
case HEADER_MDL16: // QF Type 6 extended for 16bit precision
if (strequal (mod->name, "progs/grenade.mdl")) {

View file

@ -47,6 +47,7 @@ static vid_model_funcs_t model_funcs = {
gl_Mod_SubdivideSurface,
gl_Mod_ProcessTexture,
Mod_LoadIQM,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,

View file

@ -47,6 +47,7 @@ static vid_model_funcs_t model_funcs = {
glsl_Mod_SubdivideSurface,
glsl_Mod_ProcessTexture,
Mod_LoadIQM,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,

View file

@ -40,6 +40,7 @@ static vid_model_funcs_t model_funcs = {
sw_Mod_SubdivideSurface,
sw_Mod_ProcessTexture,
Mod_LoadIQM,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,

View file

@ -45,6 +45,7 @@ static vid_model_funcs_t model_funcs = {
sw_Mod_SubdivideSurface,
sw_Mod_ProcessTexture,
Mod_LoadIQM,
Mod_LoadAliasModel,
Mod_LoadSpriteModel,