mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
Models. I think the scale may still be a bit off on certain models, but
that may also be just me. git-svn-id: https://svn.eduke32.com/eduke32@722 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
21fc17b70b
commit
a56eb92f1c
7 changed files with 262 additions and 202 deletions
|
@ -9,7 +9,7 @@ $(OBJ)/compat.$o: $(SRC)/compat.c $(INC)/compat.h
|
|||
$(OBJ)/config.$o: $(SRC)/config.c $(INC)/compat.h $(INC)/osd.h $(INC)/editor.h
|
||||
$(OBJ)/crc32.$o: $(SRC)/crc32.c $(INC)/crc32.h
|
||||
$(OBJ)/defs.$o: $(SRC)/defs.c $(INC)/build.h $(INC)/baselayer.h $(INC)/scriptfile.h $(INC)/compat.h
|
||||
$(OBJ)/engine.$o: $(SRC)/engine.c $(SRC)/polymost.c $(INC)/kplib.h $(SRC)/hightile.c $(SRC)/mdsprite.c $(INC)/md4.h $(INC)/lzf.h $(INC)/lzwnew.h $(INC)/compat.h $(INC)/build.h $(INC)/pragmas.h $(INC)/cache1d.h $(INC)/a.h $(INC)/osd.h $(INC)/baselayer.h $(INC)/polymer.h $(INC)/polymost.h
|
||||
$(OBJ)/engine.$o: $(SRC)/engine.c $(SRC)/polymost.c $(INC)/kplib.h $(SRC)/hightile.c $(SRC)/mdsprite.c $(INC)/md4.h $(INC)/lzf.h $(INC)/lzwnew.h $(INC)/compat.h $(INC)/build.h $(INC)/pragmas.h $(INC)/cache1d.h $(INC)/a.h $(INC)/osd.h $(INC)/baselayer.h $(INC)/polymer.h $(INC)/polymost.h $(INC)/mdsprite.h
|
||||
$(OBJ)/glbuild.$o: $(SRC)/glbuild.c $(INC)/glbuild.h $(INC)/baselayer.h
|
||||
$(OBJ)/kplib.$o: $(SRC)/kplib.c $(INC)/compat.h
|
||||
$(OBJ)/lzf_c.$o: $(SRC)/lzf_c.c $(SRC)/lzfP.h
|
||||
|
@ -26,7 +26,7 @@ $(OBJ)/sound.$o: $(SRC)/sound.c $(INC)/osd.h $(INC)/compat.h $(INC)/cache1d.h
|
|||
$(OBJ)/winlayer.$o: $(SRC)/winlayer.c $(INC)/compat.h $(INC)/winlayer.h $(INC)/baselayer.h $(INC)/pragmas.h $(INC)/build.h $(INC)/a.h $(INC)/osd.h $(INC)/dxdidf.h $(INC)/glbuild.h
|
||||
$(OBJ)/gtkbits.$o: $(SRC)/gtkbits.c $(INC)/baselayer.h $(INC)/build.h $(INC)/dynamicgtk.h
|
||||
$(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h
|
||||
$(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/polymost.h $(INC)/pragmas.h
|
||||
$(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/polymost.h $(INC)/pragmas.h $(INC)/mdsprite.h
|
||||
|
||||
$(OBJ)/buildres.$(res): $(SRC)/misc/buildres.rc $(INC)/startwin.editor.h
|
||||
$(OBJ)/startwin.editor.$o: $(SRC)/startwin.editor.c $(INC)/build.h $(INC)/editor.h $(INC)/winlayer.h $(INC)/compat.h $(INC)/startwin.editor.h
|
||||
|
|
204
polymer/build/include/mdsprite.h
Normal file
204
polymer/build/include/mdsprite.h
Normal file
|
@ -0,0 +1,204 @@
|
|||
#ifndef _mdsprite_h_
|
||||
# define _mdsprite_h_
|
||||
|
||||
#ifdef __POWERPC__
|
||||
#define SHIFTMOD32(a) ((a)&31)
|
||||
#else
|
||||
#define SHIFTMOD32(a) (a)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
GLuint *texid; // skins
|
||||
int flags;
|
||||
} mdmodel;
|
||||
|
||||
typedef struct _mdanim_t
|
||||
{
|
||||
int startframe, endframe;
|
||||
int fpssc, flags;
|
||||
struct _mdanim_t *next;
|
||||
} mdanim_t;
|
||||
#define MDANIM_LOOP 0
|
||||
#define MDANIM_ONESHOT 1
|
||||
|
||||
typedef struct _mdskinmap_t
|
||||
{
|
||||
unsigned char palette, filler[3]; // Build palette number
|
||||
int skinnum, surfnum; // Skin identifier, surface number
|
||||
char *fn; // Skin filename
|
||||
GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations
|
||||
struct _mdskinmap_t *next;
|
||||
float param;
|
||||
char *palmap;int size;
|
||||
} mdskinmap_t;
|
||||
|
||||
|
||||
//This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com)
|
||||
// Was at http://tfc.duke.free.fr/us/tutorials/models/md2.htm
|
||||
// Available from http://web.archive.org/web/20030816010242/http://tfc.duke.free.fr/us/tutorials/models/md2.htm
|
||||
// Now at http://tfc.duke.free.fr/coding/md2.html (in French)
|
||||
//He probably wouldn't recognize it if he looked at it though :)
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||
} md2head_t;
|
||||
|
||||
typedef struct { unsigned char v[3], ni; } md2vert_t; //compressed vertex coords (x,y,z)
|
||||
typedef struct
|
||||
{
|
||||
point3d mul, add; //scale&translation vector
|
||||
char name[16]; //frame name
|
||||
md2vert_t verts[1]; //first vertex of this frame
|
||||
} md2frame_t;
|
||||
|
||||
typedef struct { short u, v; } md2uv_t;
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v[3];
|
||||
unsigned short u[3];
|
||||
} md2tri_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union between md2model&md3model: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
GLuint *texid; // texture ids for base skin if no mappings defined
|
||||
int flags;
|
||||
|
||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||
float oldtime, curtime, interpol;
|
||||
mdanim_t *animations;
|
||||
mdskinmap_t *skinmap;
|
||||
int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified,
|
||||
|
||||
//MD2 specific stuff:
|
||||
int numverts, numglcmds, framebytes, *glcmds;
|
||||
char *frames;
|
||||
char *basepath; // pointer to string of base path
|
||||
char *skinfn; // pointer to first of numskins 64-char strings
|
||||
md2uv_t *uv;
|
||||
md2tri_t* tris;
|
||||
} md2model;
|
||||
|
||||
|
||||
typedef struct { char nam[64]; int i; } md3shader_t; //ascz path of shader, shader index
|
||||
typedef struct { int i[3]; } md3tri_t; //indices of tri
|
||||
typedef struct { float u, v; } md3uv_t;
|
||||
typedef struct { signed short x, y, z; unsigned char nlat, nlng; } md3xyzn_t; //xyz are [10:6] ints
|
||||
|
||||
typedef struct
|
||||
{
|
||||
point3d min, max, cen; //bounding box&origin
|
||||
float r; //radius of bounding sphere
|
||||
char nam[16]; //ascz frame name
|
||||
} md3frame_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char nam[64]; //ascz tag name
|
||||
point3d p, x, y, z; //tag object pos&orient
|
||||
} md3tag_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; //IDP3(0x33806873)
|
||||
char nam[64]; //ascz surface name
|
||||
int flags; //?
|
||||
int numframes, numshaders, numverts, numtris; //numframes same as md3head,max shade=~256,vert=~4096,tri=~8192
|
||||
md3tri_t *tris; //file format: rel offs from md3surf
|
||||
md3shader_t *shaders; //file format: rel offs from md3surf
|
||||
md3uv_t *uv; //file format: rel offs from md3surf
|
||||
md3xyzn_t *xyzn; //file format: rel offs from md3surf
|
||||
int ofsend;
|
||||
} md3surf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id, vers; //id=IDP3(0x33806873), vers=15
|
||||
char nam[64]; //ascz path in PK3
|
||||
int flags; //?
|
||||
int numframes, numtags, numsurfs, numskins; //max=~1024,~16,~32,numskins=artifact of MD2; use shader field instead
|
||||
md3frame_t *frames; //file format: abs offs
|
||||
md3tag_t *tags; //file format: abs offs
|
||||
md3surf_t *surfs; //file format: abs offs
|
||||
int eof; //file format: abs offs
|
||||
} md3head_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union between md2model&md3model: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
unsigned int *texid; // texture ids for base skin if no mappings defined
|
||||
int flags;
|
||||
|
||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||
float oldtime, curtime, interpol;
|
||||
mdanim_t *animations;
|
||||
mdskinmap_t *skinmap;
|
||||
int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified,
|
||||
|
||||
//MD3 specific
|
||||
md3head_t head;
|
||||
point3d *muladdframes;
|
||||
unsigned short *indexes;
|
||||
unsigned short *vindexes;
|
||||
float *maxdepths;
|
||||
GLuint* vbos;
|
||||
} md3model;
|
||||
|
||||
#define VOXBORDWIDTH 1 //use 0 to save memory, but has texture artifacts; 1 looks better...
|
||||
#define VOXUSECHAR 0
|
||||
#if (VOXUSECHAR != 0)
|
||||
typedef struct { unsigned char x, y, z, u, v; } vert_t;
|
||||
#else
|
||||
typedef struct { unsigned short x, y, z, u, v; } vert_t;
|
||||
#endif
|
||||
typedef struct { vert_t v[4]; } voxrect_t;
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union of md2model,md3model,voxmodel: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
unsigned int *texid; // skins for palettes
|
||||
int flags;
|
||||
|
||||
//VOX specific stuff:
|
||||
voxrect_t *quad; int qcnt, qfacind[7];
|
||||
int *mytex, mytexx, mytexy;
|
||||
int xsiz, ysiz, zsiz;
|
||||
float xpiv, ypiv, zpiv;
|
||||
int is8bit;
|
||||
} voxmodel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// maps build tiles to particular animation frames of a model
|
||||
int modelid;
|
||||
int skinnum;
|
||||
int framenum; // calculate the number from the name when declaring
|
||||
float smoothduration;
|
||||
int next;
|
||||
char pal;
|
||||
} tile2model_t;
|
||||
|
||||
#define EXTRATILES MAXTILES
|
||||
EXTERN tile2model_t tile2model[MAXTILES+EXTRATILES];
|
||||
EXTERN mdmodel **models;
|
||||
|
||||
void updateanimation(md2model *m, spritetype *tspr);
|
||||
int mdloadskin(md2model *m, int number, int pal, int surf);
|
||||
|
||||
#endif // !_mdsprite_h_
|
|
@ -31,6 +31,7 @@
|
|||
# include "glbuild.h"
|
||||
# include "osd.h"
|
||||
# include "polymost.h"
|
||||
# include "mdsprite.h"
|
||||
# include "pragmas.h"
|
||||
# include <math.h>
|
||||
|
||||
|
@ -157,6 +158,6 @@ static void polymer_getsky(void);
|
|||
static void polymer_drawskyquad(int p1, int p2, GLfloat height);
|
||||
static void polymer_drawartsky(short tilenum);
|
||||
|
||||
# endif
|
||||
# endif // !POLYMER_C
|
||||
|
||||
#endif // !_polymer_h_
|
||||
|
|
|
@ -39,4 +39,6 @@ pthtyp * gltexcache (int dapicnum, int dapalnum, int dameth);
|
|||
extern palette_t hictinting[MAXPALOOKUPS];
|
||||
extern float gtang;
|
||||
|
||||
#define HICEFFECTMASK (1|2|4)
|
||||
|
||||
#endif // !_polymost_h_
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#include "kplib.h"
|
||||
|
||||
#define HICEFFECTMASK (1|2|4)
|
||||
palette_t hictinting[MAXPALOOKUPS];
|
||||
|
||||
//moved into polymost.h
|
||||
//#define HICEFFECTMASK (1|2|4)
|
||||
/*struct hicskybox_t {
|
||||
int ignore;
|
||||
char *face[6];
|
||||
|
|
|
@ -1,202 +1,8 @@
|
|||
//------------------------------------- MD2/MD3 LIBRARY BEGINS -------------------------------------
|
||||
|
||||
#ifdef __POWERPC__
|
||||
#define SHIFTMOD32(a) ((a)&31)
|
||||
#else
|
||||
#define SHIFTMOD32(a) (a)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
GLuint *texid; // skins
|
||||
int flags;
|
||||
} mdmodel;
|
||||
|
||||
typedef struct _mdanim_t
|
||||
{
|
||||
int startframe, endframe;
|
||||
int fpssc, flags;
|
||||
struct _mdanim_t *next;
|
||||
} mdanim_t;
|
||||
#define MDANIM_LOOP 0
|
||||
#define MDANIM_ONESHOT 1
|
||||
|
||||
typedef struct _mdskinmap_t
|
||||
{
|
||||
unsigned char palette, filler[3]; // Build palette number
|
||||
int skinnum, surfnum; // Skin identifier, surface number
|
||||
char *fn; // Skin filename
|
||||
GLuint texid[HICEFFECTMASK+1]; // OpenGL texture numbers for effect variations
|
||||
struct _mdskinmap_t *next;
|
||||
float param;
|
||||
char *palmap;int size;
|
||||
} mdskinmap_t;
|
||||
|
||||
|
||||
//This MD2 code is based on the source code from David Henry (tfc_duke(at)hotmail.com)
|
||||
// Was at http://tfc.duke.free.fr/us/tutorials/models/md2.htm
|
||||
// Available from http://web.archive.org/web/20030816010242/http://tfc.duke.free.fr/us/tutorials/models/md2.htm
|
||||
// Now at http://tfc.duke.free.fr/coding/md2.html (in French)
|
||||
//He probably wouldn't recognize it if he looked at it though :)
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||
} md2head_t;
|
||||
|
||||
typedef struct { unsigned char v[3], ni; } md2vert_t; //compressed vertex coords (x,y,z)
|
||||
typedef struct
|
||||
{
|
||||
point3d mul, add; //scale&translation vector
|
||||
char name[16]; //frame name
|
||||
md2vert_t verts[1]; //first vertex of this frame
|
||||
} md2frame_t;
|
||||
|
||||
typedef struct { short u, v; } md2uv_t;
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v[3];
|
||||
unsigned short u[3];
|
||||
} md2tri_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union between md2model&md3model: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
GLuint *texid; // texture ids for base skin if no mappings defined
|
||||
int flags;
|
||||
|
||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||
float oldtime, curtime, interpol;
|
||||
mdanim_t *animations;
|
||||
mdskinmap_t *skinmap;
|
||||
int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified,
|
||||
|
||||
//MD2 specific stuff:
|
||||
int numverts, numglcmds, framebytes, *glcmds;
|
||||
char *frames;
|
||||
char *basepath; // pointer to string of base path
|
||||
char *skinfn; // pointer to first of numskins 64-char strings
|
||||
md2uv_t *uv;
|
||||
md2tri_t* tris;
|
||||
} md2model;
|
||||
|
||||
|
||||
typedef struct { char nam[64]; int i; } md3shader_t; //ascz path of shader, shader index
|
||||
typedef struct { int i[3]; } md3tri_t; //indices of tri
|
||||
typedef struct { float u, v; } md3uv_t;
|
||||
typedef struct { signed short x, y, z; unsigned char nlat, nlng; } md3xyzn_t; //xyz are [10:6] ints
|
||||
|
||||
typedef struct
|
||||
{
|
||||
point3d min, max, cen; //bounding box&origin
|
||||
float r; //radius of bounding sphere
|
||||
char nam[16]; //ascz frame name
|
||||
} md3frame_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char nam[64]; //ascz tag name
|
||||
point3d p, x, y, z; //tag object pos&orient
|
||||
} md3tag_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id; //IDP3(0x33806873)
|
||||
char nam[64]; //ascz surface name
|
||||
int flags; //?
|
||||
int numframes, numshaders, numverts, numtris; //numframes same as md3head,max shade=~256,vert=~4096,tri=~8192
|
||||
md3tri_t *tris; //file format: rel offs from md3surf
|
||||
md3shader_t *shaders; //file format: rel offs from md3surf
|
||||
md3uv_t *uv; //file format: rel offs from md3surf
|
||||
md3xyzn_t *xyzn; //file format: rel offs from md3surf
|
||||
int ofsend;
|
||||
} md3surf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id, vers; //id=IDP3(0x33806873), vers=15
|
||||
char nam[64]; //ascz path in PK3
|
||||
int flags; //?
|
||||
int numframes, numtags, numsurfs, numskins; //max=~1024,~16,~32,numskins=artifact of MD2; use shader field instead
|
||||
md3frame_t *frames; //file format: abs offs
|
||||
md3tag_t *tags; //file format: abs offs
|
||||
md3surf_t *surfs; //file format: abs offs
|
||||
int eof; //file format: abs offs
|
||||
} md3head_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union between md2model&md3model: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
unsigned int *texid; // texture ids for base skin if no mappings defined
|
||||
int flags;
|
||||
|
||||
int numframes, cframe, nframe, fpssc, usesalpha;
|
||||
float oldtime, curtime, interpol;
|
||||
mdanim_t *animations;
|
||||
mdskinmap_t *skinmap;
|
||||
int numskins, skinloaded; // set to 1+numofskin when a skin is loaded and the tex coords are modified,
|
||||
|
||||
//MD3 specific
|
||||
md3head_t head;
|
||||
point3d *muladdframes;
|
||||
unsigned short *indexes;
|
||||
unsigned short *vindexes;
|
||||
float *maxdepths;
|
||||
GLuint* vbos;
|
||||
} md3model;
|
||||
|
||||
#define VOXBORDWIDTH 1 //use 0 to save memory, but has texture artifacts; 1 looks better...
|
||||
#define VOXUSECHAR 0
|
||||
#if (VOXUSECHAR != 0)
|
||||
typedef struct { unsigned char x, y, z, u, v; } vert_t;
|
||||
#else
|
||||
typedef struct { unsigned short x, y, z, u, v; } vert_t;
|
||||
#endif
|
||||
typedef struct { vert_t v[4]; } voxrect_t;
|
||||
typedef struct
|
||||
{
|
||||
//WARNING: This top block is a union of md2model,md3model,voxmodel: Make sure it matches!
|
||||
int mdnum; //VOX=1, MD2=2, MD3=3. NOTE: must be first in structure!
|
||||
int shadeoff;
|
||||
float scale, bscale, zadd;
|
||||
unsigned int *texid; // skins for palettes
|
||||
int flags;
|
||||
|
||||
//VOX specific stuff:
|
||||
voxrect_t *quad; int qcnt, qfacind[7];
|
||||
int *mytex, mytexx, mytexy;
|
||||
int xsiz, ysiz, zsiz;
|
||||
float xpiv, ypiv, zpiv;
|
||||
int is8bit;
|
||||
} voxmodel;
|
||||
#include "mdsprite.h"
|
||||
static voxmodel *voxmodels[MAXVOXELS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// maps build tiles to particular animation frames of a model
|
||||
int modelid;
|
||||
int skinnum;
|
||||
int framenum; // calculate the number from the name when declaring
|
||||
float smoothduration;
|
||||
int next;
|
||||
char pal;
|
||||
} tile2model_t;
|
||||
|
||||
#define EXTRATILES MAXTILES
|
||||
int curextra=MAXTILES;
|
||||
static tile2model_t tile2model[MAXTILES+EXTRATILES];
|
||||
|
||||
int addtileP(int model,int tile,int pallet)
|
||||
{
|
||||
|
@ -232,7 +38,6 @@ int mdpause=0;
|
|||
|
||||
#define MODELALLOCGROUP 256
|
||||
static int nummodelsalloced = 0, nextmodelid = 0;
|
||||
static mdmodel **models = NULL;
|
||||
|
||||
static int maxmodelverts = 0, allocmodelverts = 0;
|
||||
static int maxmodeltris = 0, allocmodeltris = 0;
|
||||
|
@ -859,7 +664,7 @@ failure:
|
|||
// --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF
|
||||
|
||||
//Note: even though it says md2model, it works for both md2model&md3model
|
||||
static int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||
int mdloadskin(md2model *m, int number, int pal, int surf)
|
||||
{
|
||||
int i,j, fptr=0, bpl, xsiz=0, ysiz=0, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA;
|
||||
char *skinfile, hasalpha, fn[BMAX_PATH+65];
|
||||
|
@ -1053,7 +858,7 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
|||
}
|
||||
|
||||
//Note: even though it says md2model, it works for both md2model&md3model
|
||||
static void updateanimation(md2model *m, spritetype *tspr)
|
||||
void updateanimation(md2model *m, spritetype *tspr)
|
||||
{
|
||||
mdanim_t *anim;
|
||||
int i, j, k;
|
||||
|
|
|
@ -333,6 +333,48 @@ void polymer_drawmaskwall(int damaskwallcnt)
|
|||
polymer_drawplane(-1, -3, w->maskglpic, w->maskcolor, w->portal, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static void polymer_drawmdsprite(spritetype *tspr)
|
||||
{
|
||||
md3model* m;
|
||||
float spos[3];
|
||||
float ang;
|
||||
int surfi;
|
||||
md3xyzn_t *v0;
|
||||
md3surf_t *s;
|
||||
GLuint i;
|
||||
|
||||
m = (md3model*)models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid];
|
||||
updateanimation((md2model *)m,tspr);
|
||||
|
||||
spos[0] = tspr->y;
|
||||
spos[1] = -(float)(tspr->z) / 16.0f;
|
||||
spos[2] = -tspr->x;
|
||||
ang = (float)((tspr->ang) & 2047) / (2048.0f / 360.0f);
|
||||
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
bglPushMatrix();
|
||||
bglTranslatef(spos[0], spos[1], spos[2]);
|
||||
bglRotatef(-ang, 0.0f, 1.0f, 0.0f);
|
||||
bglRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
bglRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
for (surfi=0;surfi<m->head.numsurfs;surfi++)
|
||||
{
|
||||
s = &m->head.surfs[surfi];
|
||||
v0 = &s->xyzn[m->cframe*s->numverts];
|
||||
|
||||
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,globalpal,surfi);
|
||||
if (!i)
|
||||
continue;
|
||||
|
||||
bglBindTexture(GL_TEXTURE_2D, i);
|
||||
|
||||
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0);
|
||||
bglTexCoordPointer(2, GL_FLOAT, 0, s->uv);
|
||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);
|
||||
}
|
||||
bglPopMatrix();
|
||||
}
|
||||
|
||||
void polymer_drawsprite(int snum)
|
||||
{
|
||||
int curpicnum, glpic, xsize, ysize, tilexoff, tileyoff, xoff, yoff;
|
||||
|
@ -345,6 +387,12 @@ void polymer_drawsprite(int snum)
|
|||
|
||||
tspr = tspriteptr[snum];
|
||||
|
||||
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0)
|
||||
{
|
||||
polymer_drawmdsprite(tspr);
|
||||
return;
|
||||
}
|
||||
|
||||
curpicnum = tspr->picnum;
|
||||
if (picanm[curpicnum]&192) curpicnum += animateoffs(curpicnum,tspr->owner+32768);
|
||||
|
||||
|
|
Loading…
Reference in a new issue