Tutorial Request MD3 and attachment support
Tutorial Request MD3 and attachment support
Iv found tutorials for implementing md2's but not md3's i was wondering if anyone would be kind enough to make up a tutorial for it. id be extremely appreciative if who did would. thanks for if anyone does!
Re: Tutorial Request MD3 and attachment support
Depending on how things go, this could happen this week.ceriux wrote:Iv found tutorials for implementing md2's but not md3's i was wondering if anyone would be kind enough to make up a tutorial for it. id be extremely appreciative if who did would. thanks for if anyone does!
And if not this week, it is an automatic for by the end of the year.
By the way, do have any links for the md2 implementation? I know MH has a mostly written tutorial for md2, but I'd just like to lazily assess where the changes are while trying to wrap up a few things this week.
Re: Tutorial Request MD3 and attachment support
That reminds me, I need to drag that one out from wherever I've hidden it, finalize it and post it.Baker wrote:I know MH has a mostly written tutorial for md2.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
i had one in the tutorial discussion section on quakesrc once but after the site went down most got lost so might be hard recovering.
i still have the engine i fiddled with back then but its an older version and doesnt have shadows implemented yet (later version had) and is based on code from dr labman where the new one was based of harvens md3 code.
ill see if i can polish it up to the code i posted back then.
i still have the engine i fiddled with back then but its an older version and doesnt have shadows implemented yet (later version had) and is based on code from dr labman where the new one was based of harvens md3 code.
ill see if i can polish it up to the code i posted back then.
Well ... I'm working on the Universal Servers project at the moment (amazing stuff!) ... but let me see what I can do.
It won't have attachment support, that's an extension --- someone else will have to add their 2 cents in on how to best achieve attachment support. And it'll be standard single model md3 ... no torso, legs, head stuff.
Let me quickly assess how long it would take to write up the md3 tutorial and build a test GLQuake .... if it will take approximately an hour or less I'll do it right now ...
It won't have attachment support, that's an extension --- someone else will have to add their 2 cents in on how to best achieve attachment support. And it'll be standard single model md3 ... no torso, legs, head stuff.
Let me quickly assess how long it would take to write up the md3 tutorial and build a test GLQuake .... if it will take approximately an hour or less I'll do it right now ...
Changes are located in almost exclusively:ceriux wrote:oh dont rush yourself. like i said im leaving around the first of the year. my needs arnt that important as to those of the entire community!
gl_model.h
gl_model.c
gl_rmain.c
Ah, it'd be funny to add md3 support into crusty old GLQuake just for fun and doesn't look too hard. I think I'll do it now just because it'd be funny.
Planning ....
1) Will need to check for md3 vs. mdl format header on load
2) Mark such models
3) Load their textures; they are 24 bit. Have the textures loaded from the progs folder like DarkPlaces does it. The default GLQuake 8-bit texture extension cannot be used; software renderer is 8-bit (WinQuake) can't be used [I wonder if FTEQW's 24-bit software render does Q3 models? Hmmm]
4) When drawing all the entities, handle md3 separately
5) The code to render and light the md3 models.
1) Will need to check for md3 vs. mdl format header on load
2) Mark such models
3) Load their textures; they are 24 bit. Have the textures loaded from the progs folder like DarkPlaces does it. The default GLQuake 8-bit texture extension cannot be used; software renderer is 8-bit (WinQuake) can't be used [I wonder if FTEQW's 24-bit software render does Q3 models? Hmmm]
4) When drawing all the entities, handle md3 separately
5) The code to render and light the md3 models.
on it still takes a while though i had made some very massive changes to get shadows etc. to work on the new code i started out having two different rendering sections one that handled nor mal mdl and one for md3 the latter code had all this wrapped up in the same function (was pretty messy before) .
hmm with csqc this could become very interresting indeed
hmm with csqc this could become very interresting indeed
Part 1
Part 1 ... revision possible ... modelling after JoeQuake and the Qrack implementation
1a. gl_model.h
Add mod_md3 to the model types ...
And insert the Q3 model header declarations before ...
1c. Locate and add the yellow, allowing us to know the type of alias model loaded ...
1a. gl_model.h
Add mod_md3 to the model types ...
1b. Locate the following ...typedef enum {mod_brush, mod_sprite, mod_alias, mod_md3} modtype_t;
Code: Select all
//
// Whole model
//
Code: Select all
//===================================================================
/*
==============================================================================
Q3 MODELS
==============================================================================
*/
typedef struct
{
int ident;
int version;
char name[MAX_QPATH];
int flags;
int numframes;
int numtags;
int numsurfs;
int numskins;
int ofsframes;
int ofstags;
int ofssurfs;
int ofsend;
} md3header_t;
typedef struct
{
vec3_t mins, maxs;
vec3_t pos;
float radius;
char name[16];
} md3frame_t;
typedef struct
{
char name[MAX_QPATH];
vec3_t pos;
vec3_t rot[3];
} md3tag_t;
typedef struct
{
int ident;
char name[MAX_QPATH];
int flags;
int numframes;
int numshaders;
int numverts;
int numtris;
int ofstris;
int ofsshaders;
int ofstc;
int ofsverts;
int ofsend;
} md3surface_t;
typedef struct
{
char name[MAX_QPATH];
int index;
} md3shader_t;
typedef struct
{
char name[MAX_QPATH];
int index;
int gl_texnum, fb_texnum;
} md3shader_mem_t;
typedef struct
{
int indexes[3];
} md3triangle_t;
typedef struct
{
float s, t;
} md3tc_t;
typedef struct
{
short vec[3];
unsigned short normal;
} md3vert_t;
typedef struct
{
vec3_t vec;
vec3_t normal;
byte anorm_pitch, anorm_yaw;
unsigned short oldnormal; // needed for normal lighting
} md3vert_mem_t;
#define MD3_XYZ_SCALE (1.0 / 64)
#define MAXMD3FRAMES 1024
#define MAXMD3TAGS 16
#define MAXMD3SURFS 32
#define MAXMD3SHADERS 256
#define MAXMD3VERTS 4096
#define MAXMD3TRIS 8192
typedef struct animdata_s
{
int offset;
int num_frames;
int loop_frames;
float interval;
} animdata_t;
Remainder of the tutorial will follow as time permits.typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int aliastype; // Alternate model format support
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;
Part 2
Continued ... all subject to revision:
2a. gl_rmain.c
In R_DrawEntitiesOnList we need to check for MD3 ...
2b. Likewise for the view model (R_DrawViewModel), we need to check for MD3 ...
2a. gl_rmain.c
In R_DrawEntitiesOnList we need to check for MD3 ...
// draw sprites seperately, because of alpha blending
for (i=0 ; i<cl_numvisedicts ; i++)
{
currententity = cl_visedicts;
switch (currententity->model->type)
{
case mod_alias:
R_DrawAliasModel (currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
case mod_brush:
R_DrawBrushModel (currententity);
break;
default:
break;
}
}
2b. Likewise for the view model (R_DrawViewModel), we need to check for MD3 ...
// hack the depth range to prevent view model from poking into walls
glDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
switch (currententity->model->type)
{
case mod_alias:
R_DrawAliasModel (currententity);
break;
case mod_md3:
R_DrawQ3Model (currententity);
break;
}
glDepthRange (gldepthmin, gldepthmax);