Script particles and d3d renderer will now build again.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3099 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
9fc7a20e9c
commit
4b1032c337
19 changed files with 1026 additions and 1406 deletions
|
@ -439,12 +439,18 @@ int VM_LerpTag(void *out, model_t *model, int f1, int f2, float l2, char *tagnam
|
|||
|
||||
float tr[12];
|
||||
qboolean found;
|
||||
framestate_t fstate;
|
||||
|
||||
org = (float*)out;
|
||||
ang = ((float*)out+3);
|
||||
|
||||
memset(&fstate, 0, sizeof(fstate));
|
||||
fstate.g[FS_REG].frame[0] = f1;
|
||||
fstate.g[FS_REG].frame[1] = f2;
|
||||
fstate.g[FS_REG].lerpfrac = l2;
|
||||
|
||||
tagnum = Mod_TagNumForName(model, tagname);
|
||||
found = Mod_GetTag(model, tagnum, f1, f2, l2, 0, 0, tr);
|
||||
found = Mod_GetTag(model, tagnum, &fstate, tr);
|
||||
|
||||
if (found)
|
||||
{
|
||||
|
|
|
@ -3409,7 +3409,7 @@ static void GL_DrawParticleBeam_Textured(int count, beamseg_t **blist, plooks_t
|
|||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, cr);
|
||||
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
ts = c->texture_s*q->angle + particletime*q->rotationspeed;
|
||||
|
||||
VectorMA(q->org, -q->scale, cr, point);
|
||||
qglTexCoord2f(ts, 0);
|
||||
|
@ -3426,7 +3426,7 @@ static void GL_DrawParticleBeam_Textured(int count, beamseg_t **blist, plooks_t
|
|||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, cr); // replace with old p->dir?
|
||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
ts = b->texture_s*p->angle + particletime*p->rotationspeed;
|
||||
|
||||
VectorMA(p->org, p->scale, cr, point);
|
||||
qglTexCoord2f(ts, 1);
|
||||
|
@ -3876,7 +3876,7 @@ void PScript_DrawParticleTypes (void (*texturedparticles)(int count, particle_t
|
|||
while ((p=type->particles))
|
||||
{
|
||||
if (pdraw)
|
||||
RQ_AddDistReorder(pdraw, p, type, p->org);
|
||||
RQ_AddDistReorder(pdraw, p, &type->looks, p->org);
|
||||
|
||||
// make sure emitter runs at least once
|
||||
if (type->emit >= 0 && type->emitstart <= 0)
|
||||
|
@ -3930,7 +3930,7 @@ void PScript_DrawParticleTypes (void (*texturedparticles)(int count, particle_t
|
|||
VectorAdd(stop, oldorg, stop);
|
||||
VectorScale(stop, 0.5, stop);
|
||||
|
||||
RQ_AddDistReorder(bdraw, b, type, stop);
|
||||
RQ_AddDistReorder(bdraw, b, &type->looks, stop);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4139,7 +4139,7 @@ void PScript_DrawParticleTypes (void (*texturedparticles)(int count, particle_t
|
|||
}
|
||||
|
||||
if (pdraw)
|
||||
RQ_AddDistReorder((void*)pdraw, p, type, p->org);
|
||||
RQ_AddDistReorder((void*)pdraw, p, &type->looks, p->org);
|
||||
}
|
||||
|
||||
// beams are dealt with here
|
||||
|
@ -4199,7 +4199,7 @@ void PScript_DrawParticleTypes (void (*texturedparticles)(int count, particle_t
|
|||
VectorAdd(stop, oldorg, stop);
|
||||
VectorScale(stop, 0.5, stop);
|
||||
|
||||
RQ_AddDistReorder(bdraw, b, type, stop);
|
||||
RQ_AddDistReorder(bdraw, b, &type->looks, stop);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ typedef struct {
|
|||
model_t *model;
|
||||
qboolean absolute;
|
||||
|
||||
int numbones;
|
||||
unsigned int numbones;
|
||||
float *bonematrix;
|
||||
} skelobject_t;
|
||||
|
||||
|
@ -3577,7 +3577,7 @@ static void PF_skel_get_boneabs (progfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
static void PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int skelidx = G_FLOAT(OFS_PARM0);
|
||||
int boneidx = G_FLOAT(OFS_PARM1)-1;
|
||||
unsigned int boneidx = G_FLOAT(OFS_PARM1)-1;
|
||||
float *matrix[4];
|
||||
skelobject_t *skelobj;
|
||||
matrix[0] = csqcg.forward;
|
||||
|
@ -3586,8 +3586,13 @@ static void PF_skel_set_bone (progfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
matrix[3] = G_VECTOR(OFS_PARM2);
|
||||
|
||||
skelobj = skel_get(prinst, skelidx, 0);
|
||||
|
||||
//codeme
|
||||
if (!skelobj || boneidx >= skelobj->numbones)
|
||||
return;
|
||||
//testme
|
||||
VectorCopy(matrix[0], skelobj->bonematrix+12*boneidx+0);
|
||||
VectorCopy(matrix[1], skelobj->bonematrix+12*boneidx+3);
|
||||
VectorCopy(matrix[2], skelobj->bonematrix+12*boneidx+6);
|
||||
VectorCopy(matrix[3], skelobj->bonematrix+12*boneidx+9);
|
||||
}
|
||||
|
||||
//#271 void(float skel, float bonenum, vector org) skel_mul_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
|
||||
|
@ -3596,27 +3601,54 @@ static void PF_skel_mul_bone (progfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
int skelidx = G_FLOAT(OFS_PARM0);
|
||||
int boneidx = G_FLOAT(OFS_PARM1)-1;
|
||||
float *matrix[4];
|
||||
matrix[0] = csqcg.forward;
|
||||
matrix[1] = csqcg.right;
|
||||
matrix[2] = csqcg.up;
|
||||
matrix[3] = G_VECTOR(OFS_PARM2);
|
||||
float temp[3][4];
|
||||
float mult[3][4];
|
||||
skelobject_t *skelobj;
|
||||
VectorCopy(csqcg.forward, mult[0]);
|
||||
VectorCopy(csqcg.right, mult[1]);
|
||||
VectorCopy(csqcg.up, mult[2]);
|
||||
VectorCopy(G_VECTOR(OFS_PARM2), mult[3]);
|
||||
|
||||
//codeme
|
||||
skelobj = skel_get(prinst, skelidx, 0);
|
||||
if (!skelobj || boneidx >= skelobj->numbones)
|
||||
return;
|
||||
//testme
|
||||
VectorCopy(skelobj->bonematrix+12*boneidx+0, temp[0]);
|
||||
VectorCopy(skelobj->bonematrix+12*boneidx+3, temp[1]);
|
||||
VectorCopy(skelobj->bonematrix+12*boneidx+6, temp[2]);
|
||||
VectorCopy(skelobj->bonematrix+12*boneidx+9, temp[3]);
|
||||
R_ConcatTransforms(mult, temp, (float(*)[4])(skelobj->bonematrix+12*boneidx));
|
||||
}
|
||||
|
||||
//#272 void(float skel, float startbone, float endbone, vector org) skel_mul_bone (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
|
||||
static void PF_skel_mul_bones (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
int skelidx = G_FLOAT(OFS_PARM0);
|
||||
int startbone = G_FLOAT(OFS_PARM1)-1;
|
||||
int endbone = G_FLOAT(OFS_PARM2)-1;
|
||||
float *matrix[4];
|
||||
matrix[0] = csqcg.forward;
|
||||
matrix[1] = csqcg.right;
|
||||
matrix[2] = csqcg.up;
|
||||
matrix[3] = G_VECTOR(OFS_PARM3);
|
||||
unsigned int startbone = G_FLOAT(OFS_PARM1)-1;
|
||||
unsigned int endbone = G_FLOAT(OFS_PARM2)-1;
|
||||
float temp[3][4];
|
||||
float mult[3][4];
|
||||
skelobject_t *skelobj;
|
||||
VectorCopy(csqcg.forward, mult[0]);
|
||||
VectorCopy(csqcg.right, mult[1]);
|
||||
VectorCopy(csqcg.up, mult[2]);
|
||||
VectorCopy(G_VECTOR(OFS_PARM2), mult[3]);
|
||||
|
||||
//codeme
|
||||
skelobj = skel_get(prinst, skelidx, 0);
|
||||
if (!skelobj)
|
||||
return;
|
||||
|
||||
if (startbone == -1)
|
||||
startbone = 0;
|
||||
//testme
|
||||
while(startbone < endbone && startbone < skelobj->numbones)
|
||||
{
|
||||
VectorCopy(skelobj->bonematrix+12*startbone+0, temp[0]);
|
||||
VectorCopy(skelobj->bonematrix+12*startbone+3, temp[1]);
|
||||
VectorCopy(skelobj->bonematrix+12*startbone+6, temp[2]);
|
||||
VectorCopy(skelobj->bonematrix+12*startbone+9, temp[3]);
|
||||
R_ConcatTransforms(mult, temp, (float(*)[4])(skelobj->bonematrix+12*startbone));
|
||||
}
|
||||
}
|
||||
|
||||
//#273 void(float skeldst, float skelsrc, float startbone, float entbone) skel_copybones (FTE_CSQC_SKELETONOBJECTS)
|
||||
|
@ -3627,7 +3659,24 @@ static void PF_skel_copybones (progfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
int startbone = G_FLOAT(OFS_PARM2)-1;
|
||||
int endbone = G_FLOAT(OFS_PARM3)-1;
|
||||
|
||||
//codeme
|
||||
skelobject_t *skelobjdst;
|
||||
skelobject_t *skelobjsrc;
|
||||
|
||||
skelobjdst = skel_get(prinst, skeldst, 0);
|
||||
skelobjsrc = skel_get(prinst, skelsrc, 0);
|
||||
if (!skelobjdst || !skelobjsrc)
|
||||
return;
|
||||
|
||||
if (startbone == -1)
|
||||
startbone = 0;
|
||||
//testme
|
||||
while(startbone < endbone && startbone < skelobjdst->numbones && startbone < skelobjsrc->numbones)
|
||||
{
|
||||
VectorCopy(skelobjsrc->bonematrix+12*startbone+0, skelobjdst->bonematrix+12*startbone+0);
|
||||
VectorCopy(skelobjsrc->bonematrix+12*startbone+3, skelobjdst->bonematrix+12*startbone+3);
|
||||
VectorCopy(skelobjsrc->bonematrix+12*startbone+6, skelobjdst->bonematrix+12*startbone+6);
|
||||
VectorCopy(skelobjsrc->bonematrix+12*startbone+9, skelobjdst->bonematrix+12*startbone+9);
|
||||
}
|
||||
}
|
||||
|
||||
//#274 void(float skel) skel_delete (FTE_CSQC_SKELETONOBJECTS)
|
||||
|
|
|
@ -21,11 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __BOTHDEFS_H
|
||||
#define __BOTHDEFS_H
|
||||
|
||||
#ifdef D3DQUAKE
|
||||
#pragma message("d3dquake is temporarily disabled!")
|
||||
#undef D3DQUAKE
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#define MACOSX
|
||||
#endif
|
||||
|
@ -170,10 +165,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef PSET_SCRIPT
|
||||
#pragma message("fte particles are temporarily disabled!")
|
||||
#undef PSET_SCRIPT
|
||||
#endif
|
||||
//temporarily disable stuff here, so as to not break any custom configs
|
||||
|
||||
|
||||
//fix things a little...
|
||||
|
||||
|
|
|
@ -435,120 +435,6 @@ static void R_LerpBones(float *plerp, float **pose, int poses, galiasbone_t *bon
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SERVERONLY
|
||||
static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int poses, galiasbone_t *bones, int bonecount, galisskeletaltransforms_t *weights, int numweights, qboolean usehierarchy)
|
||||
{
|
||||
float bonepose[MAX_BONES][12];
|
||||
|
||||
int i, k, l;
|
||||
|
||||
if (usehierarchy)
|
||||
R_LerpBones(plerp, pose, poses, bones, bonecount, bonepose);
|
||||
else
|
||||
{
|
||||
if (poses == 1)
|
||||
memcpy(bonepose, pose[0], sizeof(float)*12*bonecount);
|
||||
else if (poses == 2)
|
||||
{
|
||||
for (i = 0; i < bonecount*12; i++)
|
||||
{
|
||||
((float*)bonepose)[i] = pose[0][i]*plerp[0] + pose[1][i]*plerp[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
for (l = 0; l < 12; l++)
|
||||
bonepose[i][l] = 0;
|
||||
for (k = 0; k < poses; k++)
|
||||
{
|
||||
for (l = 0; l < 12; l++)
|
||||
bonepose[i][l] += pose[k][i*12+l] * plerp[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// blend the vertex bone weights
|
||||
// memset(outhead, 0, mesh->numvertexes * sizeof(mesh->xyz_array[0]));
|
||||
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = 0;
|
||||
mesh->normals_array[i][1] = 0;
|
||||
mesh->normals_array[i][2] = 1;
|
||||
/*
|
||||
mesh->colors_array[i][0] = ambientlight[0];
|
||||
mesh->colors_array[i][1] = ambientlight[1];
|
||||
mesh->colors_array[i][2] = ambientlight[2];
|
||||
mesh->colors_array[i][3] = 255;//alpha;
|
||||
*/
|
||||
/*
|
||||
mesh->xyz_array[i][0] = 0;
|
||||
mesh->xyz_array[i][1] = 0;
|
||||
mesh->xyz_array[i][2] = 0;
|
||||
mesh->xyz_array[i][3] = 1;
|
||||
*/
|
||||
}
|
||||
mesh->colors_array = NULL;
|
||||
|
||||
memset(mesh->xyz_array, 0, mesh->numvertexes*sizeof(vec3_t));
|
||||
Alias_TransformVerticies((float*)bonepose, weights, numweights, (float*)mesh->xyz_array);
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0 //draws the bones
|
||||
qglColor3f(1, 0, 0);
|
||||
{
|
||||
int i;
|
||||
int p;
|
||||
vec3_t org, dest;
|
||||
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
qglVertex3f(bonepose[i][3], bonepose[i][7], bonepose[i][11]);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
org[0] = bonepose[i][3]; org[1] = bonepose[i][7]; org[2] = bonepose[i][11];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][0];dest[1] = org[1]+bonepose[i][1];dest[2] = org[2]+bonepose[i][2];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][4];dest[1] = org[1]+bonepose[i][5];dest[2] = org[2]+bonepose[i][6];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][8];dest[1] = org[1]+bonepose[i][9];dest[2] = org[2]+bonepose[i][10];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
|
||||
// mesh->numindexes = 0; //don't draw this mesh, as that would obscure the bones. :(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -571,6 +457,33 @@ vec3_t shadevector;
|
|||
vec3_t ambientlight;
|
||||
vec3_t shadelight;
|
||||
|
||||
void R_LightArrays(byte_vec4_t *colours, int vertcount, vec3_t *normals)
|
||||
{
|
||||
int i;
|
||||
float l;
|
||||
int temp;
|
||||
|
||||
for (i = vertcount-1; i >= 0; i--)
|
||||
{
|
||||
l = DotProduct(normals[i], shadevector);
|
||||
|
||||
temp = l*ambientlight[0]+shadelight[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][0] = temp;
|
||||
|
||||
temp = l*ambientlight[1]+shadelight[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][1] = temp;
|
||||
|
||||
temp = l*ambientlight[2]+shadelight[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][2] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float lerp, qbyte alpha, float expand, qboolean nolightdir)
|
||||
{
|
||||
extern cvar_t r_nolerp, r_nolightdir;
|
||||
|
@ -692,40 +605,110 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float
|
|||
}
|
||||
}
|
||||
|
||||
qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int frame2, float lerp, float alpha, float fg1time, float fg2time, qboolean nolightdir)
|
||||
#ifdef SKELETALMODELS
|
||||
#ifndef SERVERONLY
|
||||
static void Alias_BuildSkeletalMesh(mesh_t *mesh, float *bonepose, galisskeletaltransforms_t *weights, int numweights)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// blend the vertex bone weights
|
||||
// memset(outhead, 0, mesh->numvertexes * sizeof(mesh->xyz_array[0]));
|
||||
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = 0;
|
||||
mesh->normals_array[i][1] = 0;
|
||||
mesh->normals_array[i][2] = 1;
|
||||
/*
|
||||
mesh->colors_array[i][0] = ambientlight[0];
|
||||
mesh->colors_array[i][1] = ambientlight[1];
|
||||
mesh->colors_array[i][2] = ambientlight[2];
|
||||
mesh->colors_array[i][3] = 255;//alpha;
|
||||
*/
|
||||
/*
|
||||
mesh->xyz_array[i][0] = 0;
|
||||
mesh->xyz_array[i][1] = 0;
|
||||
mesh->xyz_array[i][2] = 0;
|
||||
mesh->xyz_array[i][3] = 1;
|
||||
*/
|
||||
}
|
||||
mesh->colors_array = NULL;
|
||||
|
||||
memset(mesh->xyz_array, 0, mesh->numvertexes*sizeof(vec3_t));
|
||||
Alias_TransformVerticies(bonepose, weights, numweights, (float*)mesh->xyz_array);
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0 //draws the bones
|
||||
qglColor3f(1, 0, 0);
|
||||
{
|
||||
int i;
|
||||
int p;
|
||||
vec3_t org, dest;
|
||||
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
qglVertex3f(bonepose[i][3], bonepose[i][7], bonepose[i][11]);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
org[0] = bonepose[i][3]; org[1] = bonepose[i][7]; org[2] = bonepose[i][11];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][0];dest[1] = org[1]+bonepose[i][1];dest[2] = org[2]+bonepose[i][2];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][4];dest[1] = org[1]+bonepose[i][5];dest[2] = org[2]+bonepose[i][6];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][8];dest[1] = org[1]+bonepose[i][9];dest[2] = org[2]+bonepose[i][10];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
|
||||
// mesh->numindexes = 0; //don't draw this mesh, as that would obscure the bones. :(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf,
|
||||
entity_t *e,
|
||||
float alpha, qboolean nolightdir)
|
||||
{
|
||||
galiasgroup_t *g1, *g2;
|
||||
|
||||
int frame1;
|
||||
int frame2;
|
||||
float lerp;
|
||||
float fg1time;
|
||||
float fg2time;
|
||||
|
||||
if (!inf->groups)
|
||||
{
|
||||
Con_DPrintf("Model with no frames (%s)\n", currententity->model->name);
|
||||
return false;
|
||||
}
|
||||
if (frame1 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame1 = 0;
|
||||
}
|
||||
if (frame2 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
if (frame1 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame1, currententity->model->name);
|
||||
frame1 %= inf->groups;
|
||||
}
|
||||
if (frame2 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame2, currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
|
||||
if (lerp <= 0)
|
||||
frame2 = frame1;
|
||||
else if (lerp >= 1)
|
||||
frame1 = frame2;
|
||||
|
||||
if (numTempColours < inf->numverts)
|
||||
{
|
||||
|
@ -765,84 +748,55 @@ qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int fram
|
|||
#endif
|
||||
mesh->xyz_array = tempVertexCoords;
|
||||
|
||||
g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1);
|
||||
g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2);
|
||||
|
||||
//we don't support meshes with one pose skeletal and annother not.
|
||||
//we don't support meshes with one group skeletal and annother not.
|
||||
|
||||
#ifdef SKELETALMODELS
|
||||
if (inf->numbones)
|
||||
{
|
||||
int l=0;
|
||||
float plerp[4];
|
||||
float *pose[4];
|
||||
float mlerp; //minor lerp, poses within a group.
|
||||
qboolean hirachy;
|
||||
|
||||
if (g1->isheirachical != g2->isheirachical || lerp < 0)
|
||||
lerp = 0;
|
||||
hirachy = g1->isheirachical;
|
||||
|
||||
mlerp = (fg1time)*g1->rate;
|
||||
frame1=mlerp;
|
||||
frame2=frame1+1;
|
||||
mlerp-=frame1;
|
||||
if (g1->loop)
|
||||
{
|
||||
frame1=frame1%g1->numposes;
|
||||
frame2=frame2%g1->numposes;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame1=(frame1>g1->numposes-1)?g1->numposes-1:frame1;
|
||||
frame2=(frame2>g1->numposes-1)?g1->numposes-1:frame2;
|
||||
}
|
||||
|
||||
plerp[l] = (1-mlerp)*(1-lerp);
|
||||
if (plerp[l]>0)
|
||||
pose[l++] = (float *)((char *)g1 + g1->poseofs + sizeof(float)*inf->numbones*12*frame1);
|
||||
plerp[l] = (mlerp)*(1-lerp);
|
||||
if (plerp[l]>0)
|
||||
pose[l++] = (float *)((char *)g1 + g1->poseofs + sizeof(float)*inf->numbones*12*frame2);
|
||||
|
||||
if (lerp)
|
||||
{
|
||||
mlerp = (fg2time)*g2->rate;
|
||||
frame1=mlerp;
|
||||
frame2=frame1+1;
|
||||
mlerp-=frame1;
|
||||
if (g2->loop)
|
||||
{
|
||||
frame1=frame1%g2->numposes;
|
||||
frame2=frame2%g2->numposes;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame1=(frame1>g2->numposes-1)?g2->numposes-1:frame1;
|
||||
frame2=(frame2>g2->numposes-1)?g2->numposes-1:frame2;
|
||||
}
|
||||
|
||||
plerp[l] = (1-mlerp)*(lerp);
|
||||
if (plerp[l]>0)
|
||||
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame1);
|
||||
plerp[l] = (mlerp)*(lerp);
|
||||
if (plerp[l]>0)
|
||||
pose[l++] = (float *)((char *)g2 + g2->poseofs + sizeof(float)*inf->numbones*12*frame2);
|
||||
}
|
||||
/*
|
||||
pose[0] = (float *)((char *)g1 + g1->poseofs);
|
||||
plerp[0] = 1;
|
||||
plerp[1] = 0;
|
||||
plerp[3] = 0;
|
||||
plerp[4] = 0;
|
||||
l = 1;
|
||||
*/
|
||||
R_BuildSkeletalMesh(mesh, plerp, pose, l, (galiasbone_t *)((char*)inf+inf->ofsbones), inf->numbones, (galisskeletaltransforms_t *)((char*)inf+inf->ofstransforms), inf->numtransforms, hirachy);
|
||||
float bonepose[MAX_BONES][12];
|
||||
float *usebonepose;
|
||||
usebonepose = Alias_GetBonePositions(inf, &e->framestate, (float*)bonepose, MAX_BONES);
|
||||
Alias_BuildSkeletalMesh(mesh, usebonepose, (galisskeletaltransforms_t *)((char*)inf+inf->ofstransforms), inf->numtransforms);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
frame1 = e->framestate.g[FS_REG].frame[0];
|
||||
frame2 = e->framestate.g[FS_REG].frame[1];
|
||||
lerp = e->framestate.g[FS_REG].lerpfrac;
|
||||
fg1time = e->framestate.g[FS_REG].frametime[0];
|
||||
fg2time = e->framestate.g[FS_REG].frametime[1];
|
||||
|
||||
if (frame1 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame1 = 0;
|
||||
}
|
||||
if (frame2 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
if (frame1 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame1, currententity->model->name);
|
||||
frame1 %= inf->groups;
|
||||
}
|
||||
if (frame2 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame2, currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
|
||||
if (lerp <= 0)
|
||||
frame2 = frame1;
|
||||
else if (lerp >= 1)
|
||||
frame1 = frame2;
|
||||
|
||||
g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1);
|
||||
g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2);
|
||||
|
||||
if (g1 == g2) //lerping within group is only done if not changing group
|
||||
{
|
||||
lerp = fg1time*g1->rate;
|
||||
|
|
|
@ -122,6 +122,9 @@ typedef struct {
|
|||
|
||||
float *Alias_GetBonePositions(galiasinfo_t *inf, framestate_t *fstate, float *buffer, int buffersize);
|
||||
void Alias_TransformVerticies(float *bonepose, galisskeletaltransforms_t *weights, int numweights, float *xyzout);
|
||||
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf,
|
||||
entity_t *e,
|
||||
float alpha, qboolean nolightdir);
|
||||
|
||||
void Mod_DoCRC(model_t *mod, char *buffer, int buffersize);
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ mpic_t *(D3D7_Draw_SafePicFromWad) (char *name)
|
|||
*p = draw_chars_tex;
|
||||
else
|
||||
{
|
||||
*p = Mod_LoadReplacementTexture(pic->name, "wad", false, true, true);
|
||||
*p = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture(pic->name, "wad", false, true, true);
|
||||
if (!*p)
|
||||
*p = D3D7_LoadTexture_8_Pal24(name, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ mpic_t *(D3D7_Draw_SafeCachePic) (char *path)
|
|||
pic->pic.width = qpic->width;
|
||||
pic->pic.height = qpic->height;
|
||||
p = (LPDIRECTDRAWSURFACE7*)&pic->pic.data;
|
||||
*p = Mod_LoadReplacementTexture(pic->name, "gfx", false, true, true);
|
||||
*p = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture(pic->name, "gfx", false, true, true);
|
||||
if (!*p)
|
||||
*p = D3D7_LoadTexture_8_Pal24(path, (unsigned char*)(qpic+1), qpic->width, qpic->height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 255);
|
||||
|
||||
|
@ -389,16 +389,40 @@ void (D3D7_Draw_ReInit) (void)
|
|||
|
||||
draw_chars = W_SafeGetLumpName ("conchars");
|
||||
|
||||
draw_chars_tex = Mod_LoadReplacementTexture("conchars", "gfx", false, true, true);
|
||||
if (!draw_chars_tex)
|
||||
draw_chars_tex = D3D7_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
|
||||
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadReplacementTexture("conchars", "gfx", false, true, true);
|
||||
if (!draw_chars_tex)
|
||||
{
|
||||
if (draw_chars)
|
||||
draw_chars_tex = D3D7_LoadTexture_8_Pal24("conchars", draw_chars, 128, 128, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP, host_basepal, 0);
|
||||
if (!draw_chars_tex)
|
||||
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadHiResTexture("gfx/2d/bigchars.tga", NULL, false, true, false); //try q3 path
|
||||
if (!draw_chars_tex)
|
||||
draw_chars_tex = (LPDIRECTDRAWSURFACE7)Mod_LoadHiResTexture("pics/conchars.pcx", NULL, false, true, false); //try low res q2 path
|
||||
if (!draw_chars_tex)
|
||||
{
|
||||
extern qbyte default_conchar[11356];
|
||||
int width, height;
|
||||
int i;
|
||||
qbyte *image;
|
||||
|
||||
image = ReadTargaFile(default_conchar, sizeof(default_conchar), &width, &height, false);
|
||||
for (i = 0; i < width*height; i++)
|
||||
{
|
||||
image[i*4+3] = image[i*4];
|
||||
image[i*4+0] = 255;
|
||||
image[i*4+1] = 255;
|
||||
image[i*4+2] = 255;
|
||||
}
|
||||
draw_chars_tex = D3D7_LoadTexture_32("charset", (void*)image, width, height, TF_NOMIPMAP|TF_ALPHA|TF_NOTBUMPMAP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//now emit the conchars picture as if from a wad.
|
||||
strcpy(d3dmenu_cachepics[d3dmenu_numcachepics].name, "conchars");
|
||||
d3dmenu_cachepics[d3dmenu_numcachepics].pic.width = 128;
|
||||
d3dmenu_cachepics[d3dmenu_numcachepics].pic.height = 128;
|
||||
*(int *)&d3dmenu_cachepics[d3dmenu_numcachepics].pic.data = draw_chars_tex;
|
||||
*(int *)&d3dmenu_cachepics[d3dmenu_numcachepics].pic.data = (int)draw_chars_tex;
|
||||
d3dmenu_numcachepics++;
|
||||
|
||||
|
||||
|
|
|
@ -676,7 +676,7 @@ if (e->flags & Q2RF_DEPTHHACK)
|
|||
|
||||
for(i = 0;; i++)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
|
||||
Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], false);
|
||||
|
||||
skin = D3D7_ChooseSkin(inf, m->name, e->skinnum, e);
|
||||
if (!skin)
|
||||
|
|
|
@ -741,18 +741,18 @@ static void D3D7_DrawSpriteModel (entity_t *e)
|
|||
}
|
||||
|
||||
//==================================================================================
|
||||
|
||||
void D3D7R_DrawSprite(void *e, void *parm)
|
||||
{
|
||||
currententity = e;
|
||||
|
||||
D3D7_DrawSpriteModel (currententity);
|
||||
|
||||
// P_FlushRenderer();
|
||||
|
||||
void D3D7R_DrawSprite(int count, void **e, void *parm)
|
||||
{
|
||||
while(count--)
|
||||
{
|
||||
currententity = *e++;
|
||||
|
||||
D3D7_DrawSpriteModel (currententity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
qboolean D3D7_ShouldDraw(void)
|
||||
{
|
||||
{
|
||||
|
@ -996,7 +996,6 @@ void (D3D7_R_RenderView) (void)
|
|||
}
|
||||
|
||||
|
||||
static part_type_t *lastgltype;
|
||||
extern vec3_t pright, pup;
|
||||
static float particletime;
|
||||
|
||||
|
@ -1019,177 +1018,185 @@ static unsigned short d3dparticlevertindexes[] =
|
|||
0, 2, 3
|
||||
};
|
||||
|
||||
static void D3D_DrawParticleBlob(particle_t *p, part_type_t *type)
|
||||
static void D3D_DrawParticleBlob(int count, particle_t **plist, plooks_t *type)
|
||||
{
|
||||
float scale;
|
||||
float x;
|
||||
float y;
|
||||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
if (lastgltype != type)
|
||||
particle_t *p;
|
||||
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
|
||||
while(count--)
|
||||
{
|
||||
lastgltype = type;
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
p = *plist++;
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
if (scale < 20)
|
||||
scale = 0.25;
|
||||
else
|
||||
scale = 0.25 + scale * 0.001;
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
if (p->angle)
|
||||
{
|
||||
x = sin(p->angle)*scale;
|
||||
y = cos(p->angle)*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = scale;
|
||||
}
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
d3dparticlevert[0].org[0] = p->org[0] - x*pright[0] - y*pup[0];
|
||||
d3dparticlevert[0].org[1] = p->org[1] - x*pright[1] - y*pup[1];
|
||||
d3dparticlevert[0].org[2] = p->org[2] - x*pright[2] - y*pup[2];
|
||||
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
d3dparticlevert[1].org[0] = p->org[0] - y*pright[0] + x*pup[0];
|
||||
d3dparticlevert[1].org[1] = p->org[1] - y*pright[1] + x*pup[1];
|
||||
d3dparticlevert[1].org[2] = p->org[2] - y*pright[2] + x*pup[2];
|
||||
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
d3dparticlevert[2].org[0] = p->org[0] + x*pright[0] + y*pup[0];
|
||||
d3dparticlevert[2].org[1] = p->org[1] + x*pright[1] + y*pup[1];
|
||||
d3dparticlevert[2].org[2] = p->org[2] + x*pright[2] + y*pup[2];
|
||||
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
d3dparticlevert[3].org[0] = p->org[0] + y*pright[0] - x*pup[0];
|
||||
d3dparticlevert[3].org[1] = p->org[1] + y*pright[1] - x*pup[1];
|
||||
d3dparticlevert[3].org[2] = p->org[2] + y*pright[2] - x*pup[2];
|
||||
|
||||
//FIXME: batch properly
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
if (scale < 20)
|
||||
scale = 0.25;
|
||||
else
|
||||
scale = 0.25 + scale * 0.001;
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
if (p->angle)
|
||||
{
|
||||
x = sin(p->angle)*scale;
|
||||
y = cos(p->angle)*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = scale;
|
||||
}
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
d3dparticlevert[0].org[0] = p->org[0] - x*pright[0] - y*pup[0];
|
||||
d3dparticlevert[0].org[1] = p->org[1] - x*pright[1] - y*pup[1];
|
||||
d3dparticlevert[0].org[2] = p->org[2] - x*pright[2] - y*pup[2];
|
||||
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
d3dparticlevert[1].org[0] = p->org[0] - y*pright[0] + x*pup[0];
|
||||
d3dparticlevert[1].org[1] = p->org[1] - y*pright[1] + x*pup[1];
|
||||
d3dparticlevert[1].org[2] = p->org[2] - y*pright[2] + x*pup[2];
|
||||
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
d3dparticlevert[2].org[0] = p->org[0] + x*pright[0] + y*pup[0];
|
||||
d3dparticlevert[2].org[1] = p->org[1] + x*pright[1] + y*pup[1];
|
||||
d3dparticlevert[2].org[2] = p->org[2] + x*pright[2] + y*pup[2];
|
||||
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
d3dparticlevert[3].org[0] = p->org[0] + y*pright[0] - x*pup[0];
|
||||
d3dparticlevert[3].org[1] = p->org[1] + y*pright[1] - x*pup[1];
|
||||
d3dparticlevert[3].org[2] = p->org[2] + y*pright[2] - x*pup[2];
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
static void D3D_DrawParticleSpark(particle_t *p, part_type_t *type)
|
||||
static void D3D_DrawParticleSpark(int count, particle_t **plist, plooks_t *type)
|
||||
{
|
||||
vec3_t v, crv, o2;
|
||||
|
||||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
particle_t *p;
|
||||
|
||||
if (lastgltype != type)
|
||||
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
|
||||
|
||||
while(count--)
|
||||
{
|
||||
lastgltype = type;
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
p = *plist++;
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(p->org, -p->scale/2, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(p->org, p->scale/2, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
VectorMA(p->org, 0.1, p->vel, o2);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, o2, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(o2, p->scale/2, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(o2, -p->scale/2, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(p->org, -p->scale/2, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(p->org, p->scale/2, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
VectorMA(p->org, 0.1, p->vel, o2);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, o2, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(o2, p->scale/2, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(o2, -p->scale/2, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
static void D3D_DrawParticleBeam(beamseg_t *b, part_type_t *type)
|
||||
static void D3D_DrawParticleBeam(int count, beamseg_t **blist, plooks_t *type)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t crv;
|
||||
beamseg_t *c;
|
||||
beamseg_t *b, *c;
|
||||
particle_t *p;
|
||||
particle_t *q;
|
||||
float ts;
|
||||
|
@ -1198,116 +1205,115 @@ static void D3D_DrawParticleBeam(beamseg_t *b, part_type_t *type)
|
|||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
|
||||
if (lastgltype != type)
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
|
||||
|
||||
|
||||
while(count--)
|
||||
{
|
||||
lastgltype = type;
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, type->d3dtexture);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
b = *blist++;
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*q->angle + particletime*q->rotationspeed;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = ts;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = ts;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*p->angle + particletime*p->rotationspeed;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = ts;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = ts;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = ts;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = ts;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = ts;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = ts;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
static void D3D_DrawParticleBeamUT(beamseg_t *b, part_type_t *type)
|
||||
static void D3D_DrawParticleBeamUT(int count, beamseg_t **blist, plooks_t *type)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t crv;
|
||||
beamseg_t *c;
|
||||
beamseg_t *b, *c;
|
||||
particle_t *p;
|
||||
particle_t *q;
|
||||
float ts;
|
||||
|
@ -1319,100 +1325,99 @@ static void D3D_DrawParticleBeamUT(beamseg_t *b, part_type_t *type)
|
|||
// D3D_DrawParticleBeam(b, type);
|
||||
// return;
|
||||
|
||||
if (lastgltype != type)
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2);
|
||||
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
|
||||
|
||||
while (count--)
|
||||
{
|
||||
lastgltype = type;
|
||||
pD3DDev->lpVtbl->SetTexture(pD3DDev, 0, NULL);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
|
||||
b = *blist++;
|
||||
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
pD3DDev->lpVtbl->SetTextureStageState(pD3DDev, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2);
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
APPLYD3DBLEND(type->blendmode);
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*q->angle + particletime*q->rotationspeed;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevertut[0].org);
|
||||
d3dparticlevertut[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevertut[1].org);
|
||||
d3dparticlevertut[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*p->angle + particletime*p->rotationspeed;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevertut[2].org);
|
||||
d3dparticlevertut[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevertut[3].org);
|
||||
d3dparticlevertut[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE, d3dparticlevertut, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevertut[0].org);
|
||||
d3dparticlevertut[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevertut[1].org);
|
||||
d3dparticlevertut[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevertut[2].org);
|
||||
d3dparticlevertut[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevertut[3].org);
|
||||
d3dparticlevertut[3].colour = colour;
|
||||
|
||||
|
||||
pD3DDev->lpVtbl->DrawIndexedPrimitive(pD3DDev, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE, d3dparticlevertut, 4, d3dparticlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
qboolean D3D7_DrawParticles(float ptime)
|
||||
|
@ -1424,7 +1429,6 @@ qboolean D3D7_DrawParticles(float ptime)
|
|||
|
||||
particletime = ptime;
|
||||
|
||||
lastgltype = NULL;
|
||||
PScript_DrawParticleTypes(D3D_DrawParticleBlob, D3D_DrawParticleSpark, D3D_DrawParticleSpark, D3D_DrawParticleSpark, D3D_DrawParticleBeam, D3D_DrawParticleBeamUT, NULL);
|
||||
|
||||
pD3DDev->lpVtbl->SetRenderState(pD3DDev, D3DRENDERSTATE_ZWRITEENABLE, FALSE );
|
||||
|
|
|
@ -692,7 +692,7 @@ if (e->flags & Q2RF_DEPTHHACK)
|
|||
|
||||
for(i = 0;; i++)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame1, e->frame2, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time, 0);
|
||||
Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], 0);
|
||||
|
||||
skin = D3D9_ChooseSkin(inf, m->name, e->skinnum, e);
|
||||
if (!skin)
|
||||
|
|
|
@ -692,7 +692,7 @@ IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTU
|
|||
c++;
|
||||
}
|
||||
}*/
|
||||
IDirect3DTexture9_UnlockRect(lightmap_d3d9textures[lmnum], NULL);
|
||||
IDirect3DTexture9_UnlockRect(lightmap_d3d9textures[lmnum], 0);
|
||||
|
||||
lightmap[lmnum]->modified = false;
|
||||
}
|
||||
|
@ -1155,13 +1155,14 @@ static void D3D9_DrawSpriteModel (entity_t *e)
|
|||
|
||||
//==================================================================================
|
||||
|
||||
void D3D9R_DrawSprite(void *e, void *parm)
|
||||
{
|
||||
currententity = e;
|
||||
|
||||
D3D9_DrawSpriteModel (currententity);
|
||||
|
||||
// P_FlushRenderer();
|
||||
void D3D9R_DrawSprite(int count, void **e, void *parm)
|
||||
{
|
||||
while(count--)
|
||||
{
|
||||
currententity = *e++;
|
||||
|
||||
D3D9_DrawSpriteModel (currententity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1380,6 +1381,7 @@ void (D3D9_R_RenderView) (void)
|
|||
}
|
||||
|
||||
|
||||
#ifdef PSET_SCRIPT
|
||||
|
||||
#include "particles.h"
|
||||
#define TYPESONLY
|
||||
|
@ -1421,7 +1423,6 @@ typedef struct d3dparticlevertut_s {
|
|||
} d3dparticlevertut_t;
|
||||
d3dparticlevertut_t d3dparticlevertut[4];
|
||||
|
||||
part_type_t *lastd3dtype;
|
||||
static vec3_t pright, pup;
|
||||
static float particletime;
|
||||
|
||||
|
@ -1437,7 +1438,7 @@ void IDirect3DDevice9_DrawIndexedPrimitive7(LPDIRECT3DDEVICE9 pD3DDev9, int mode
|
|||
|
||||
IDirect3DDevice9_SetFVF(pD3DDev9, fvf);
|
||||
IDirect3DDevice9_DrawIndexedPrimitiveUP(pD3DDev9, mode, 0, numverts, numindicies/3, indicies, D3DFMT_QINDEX, verts, size);
|
||||
}
|
||||
}
|
||||
|
||||
index_t d3d9particlevertindexes[] =
|
||||
{
|
||||
|
@ -1445,177 +1446,183 @@ index_t d3d9particlevertindexes[] =
|
|||
0, 2, 3
|
||||
};
|
||||
|
||||
void D3D9_DrawParticleBlob(particle_t *p, part_type_t *type)
|
||||
void D3D9_DrawParticleBlob(int count, particle_t **plist, plooks_t *type)
|
||||
{
|
||||
float scale;
|
||||
float x;
|
||||
float y;
|
||||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
if (lastd3dtype != type)
|
||||
{
|
||||
lastd3dtype = type;
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
int cb, cg, cr, ca;
|
||||
particle_t *p;
|
||||
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
|
||||
|
||||
while(count--)
|
||||
{
|
||||
p = *plist++;
|
||||
|
||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
if (scale < 20)
|
||||
scale = 0.25;
|
||||
else
|
||||
scale = 0.25 + scale * 0.001;
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
if (p->angle)
|
||||
{
|
||||
x = sin(p->angle)*scale;
|
||||
y = cos(p->angle)*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = scale;
|
||||
}
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
d3dparticlevert[0].org[0] = p->org[0] - x*pright[0] - y*pup[0];
|
||||
d3dparticlevert[0].org[1] = p->org[1] - x*pright[1] - y*pup[1];
|
||||
d3dparticlevert[0].org[2] = p->org[2] - x*pright[2] - y*pup[2];
|
||||
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
d3dparticlevert[1].org[0] = p->org[0] - y*pright[0] + x*pup[0];
|
||||
d3dparticlevert[1].org[1] = p->org[1] - y*pright[1] + x*pup[1];
|
||||
d3dparticlevert[1].org[2] = p->org[2] - y*pright[2] + x*pup[2];
|
||||
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
d3dparticlevert[2].org[0] = p->org[0] + x*pright[0] + y*pup[0];
|
||||
d3dparticlevert[2].org[1] = p->org[1] + x*pright[1] + y*pup[1];
|
||||
d3dparticlevert[2].org[2] = p->org[2] + x*pright[2] + y*pup[2];
|
||||
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
d3dparticlevert[3].org[0] = p->org[0] + y*pright[0] - x*pup[0];
|
||||
d3dparticlevert[3].org[1] = p->org[1] + y*pright[1] - x*pup[1];
|
||||
d3dparticlevert[3].org[2] = p->org[2] + y*pright[2] - x*pup[2];
|
||||
|
||||
//FIXME: batch properly
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||
scale = (scale*p->scale)*(type->invscalefactor) + p->scale * (type->scalefactor*250);
|
||||
if (scale < 20)
|
||||
scale = 0.25;
|
||||
else
|
||||
scale = 0.25 + scale * 0.001;
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
if (p->angle)
|
||||
{
|
||||
x = sin(p->angle)*scale;
|
||||
y = cos(p->angle)*scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = scale;
|
||||
}
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
d3dparticlevert[0].org[0] = p->org[0] - x*pright[0] - y*pup[0];
|
||||
d3dparticlevert[0].org[1] = p->org[1] - x*pright[1] - y*pup[1];
|
||||
d3dparticlevert[0].org[2] = p->org[2] - x*pright[2] - y*pup[2];
|
||||
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
d3dparticlevert[1].org[0] = p->org[0] - y*pright[0] + x*pup[0];
|
||||
d3dparticlevert[1].org[1] = p->org[1] - y*pright[1] + x*pup[1];
|
||||
d3dparticlevert[1].org[2] = p->org[2] - y*pright[2] + x*pup[2];
|
||||
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
d3dparticlevert[2].org[0] = p->org[0] + x*pright[0] + y*pup[0];
|
||||
d3dparticlevert[2].org[1] = p->org[1] + x*pright[1] + y*pup[1];
|
||||
d3dparticlevert[2].org[2] = p->org[2] + x*pright[2] + y*pup[2];
|
||||
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
d3dparticlevert[3].org[0] = p->org[0] + y*pright[0] - x*pup[0];
|
||||
d3dparticlevert[3].org[1] = p->org[1] + y*pright[1] - x*pup[1];
|
||||
d3dparticlevert[3].org[2] = p->org[2] + y*pright[2] - x*pup[2];
|
||||
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
void D3D9_DrawParticleSpark(particle_t *p, part_type_t *type)
|
||||
void D3D9_DrawParticleSpark(int count, particle_t **plist, plooks_t *type)
|
||||
{
|
||||
vec3_t v, crv, o2;
|
||||
|
||||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
int cb, cg, cr, ca;
|
||||
particle_t *p;
|
||||
|
||||
if (lastd3dtype != type)
|
||||
{
|
||||
lastd3dtype = type;
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
|
||||
while(count--)
|
||||
{
|
||||
p = *plist++;
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(p->org, -p->scale/2, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(p->org, p->scale/2, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
VectorMA(p->org, 0.1, p->vel, o2);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, o2, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(o2, p->scale/2, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(o2, -p->scale/2, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
//FIXME: batch properly
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(p->org, -p->scale/2, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = 0;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(p->org, p->scale/2, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = 0;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
VectorMA(p->org, 0.1, p->vel, o2);
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, o2, v);
|
||||
CrossProduct(v, p->vel, crv);
|
||||
VectorNormalize(crv);
|
||||
|
||||
VectorMA(o2, p->scale/2, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = 1;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(o2, -p->scale/2, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = 1;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
void D3D9_DrawParticleBeam(beamseg_t *b, part_type_t *type)
|
||||
void D3D9_DrawParticleBeam(int count, beamseg_t **blist, plooks_t *type)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t crv;
|
||||
beamseg_t *c;
|
||||
beamseg_t *b, *c;
|
||||
particle_t *p;
|
||||
particle_t *q;
|
||||
float ts;
|
||||
|
@ -1624,116 +1631,117 @@ void D3D9_DrawParticleBeam(beamseg_t *b, part_type_t *type)
|
|||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
|
||||
if (lastd3dtype != type)
|
||||
{
|
||||
lastd3dtype = type;
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, type->d3dtexture);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
|
||||
|
||||
|
||||
while(count--)
|
||||
{
|
||||
b = *blist++;
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*q->angle + particletime*q->rotationspeed;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = ts;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = ts;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*p->angle + particletime*p->rotationspeed;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = ts;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = ts;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
//FIXME: batch properly
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevert[0].org);
|
||||
d3dparticlevert[0].s = ts;
|
||||
d3dparticlevert[0].t = 0;
|
||||
d3dparticlevert[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevert[1].org);
|
||||
d3dparticlevert[1].s = ts;
|
||||
d3dparticlevert[1].t = 1;
|
||||
d3dparticlevert[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevert[2].org);
|
||||
d3dparticlevert[2].s = ts;
|
||||
d3dparticlevert[2].t = 1;
|
||||
d3dparticlevert[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevert[3].org);
|
||||
d3dparticlevert[3].s = ts;
|
||||
d3dparticlevert[3].t = 0;
|
||||
d3dparticlevert[3].colour = colour;
|
||||
|
||||
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, d3dparticlevert, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
void D3D9_DrawParticleBeamUT(beamseg_t *b, part_type_t *type)
|
||||
void D3D9_DrawParticleBeamUT(int count, beamseg_t **blist, plooks_t *type)
|
||||
{
|
||||
vec3_t v;
|
||||
vec3_t crv;
|
||||
beamseg_t *c;
|
||||
beamseg_t *b, *c;
|
||||
particle_t *p;
|
||||
particle_t *q;
|
||||
float ts;
|
||||
|
@ -1742,103 +1750,99 @@ void D3D9_DrawParticleBeamUT(beamseg_t *b, part_type_t *type)
|
|||
unsigned int colour;
|
||||
int cb, cg, cr, ca;
|
||||
|
||||
// D3D_DrawParticleBeam(b, type);
|
||||
// return;
|
||||
|
||||
if (lastd3dtype != type)
|
||||
{
|
||||
lastd3dtype = type;
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, NULL);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
|
||||
IDirect3DDevice9_SetTexture(pD3DDev9, 0, NULL);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
|
||||
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
|
||||
IDirect3DDevice9_SetTextureStageState(pD3DDev9, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2);
|
||||
|
||||
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
APPLYD3D9BLEND(type->blendmode);
|
||||
|
||||
|
||||
while(count--)
|
||||
{
|
||||
b = *blist++;
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*q->angle + particletime*q->rotationspeed;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevertut[0].org);
|
||||
d3dparticlevertut[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevertut[1].org);
|
||||
d3dparticlevertut[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*p->angle + particletime*p->rotationspeed;;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevertut[2].org);
|
||||
d3dparticlevertut[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevertut[3].org);
|
||||
d3dparticlevertut[3].colour = colour;
|
||||
|
||||
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE, d3dparticlevertut, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
q = c->p;
|
||||
p = b->p;
|
||||
|
||||
|
||||
cr = q->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = q->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = q->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = q->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
c = b->next;
|
||||
|
||||
q = c->p;
|
||||
|
||||
p = b->p;
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(c->dir, v, crv);
|
||||
ts = c->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(q->org, -q->scale, crv, d3dparticlevertut[0].org);
|
||||
d3dparticlevertut[0].colour = colour;
|
||||
|
||||
VectorMA(q->org, q->scale, crv, d3dparticlevertut[1].org);
|
||||
d3dparticlevertut[1].colour = colour;
|
||||
|
||||
|
||||
cr = p->rgb[0]*255;
|
||||
if (cr < 0) cr = 0;
|
||||
if (cr > 255) cr = 255;
|
||||
|
||||
cg = p->rgb[1]*255;
|
||||
if (cg < 0) cg = 0;
|
||||
if (cg > 255) cg = 255;
|
||||
|
||||
cb = p->rgb[2]*255;
|
||||
if (cb < 0) cb = 0;
|
||||
if (cb > 255) cb = 255;
|
||||
|
||||
ca = p->alpha*255;
|
||||
if (ca < 0) ca = 0;
|
||||
if (ca > 255) ca = 255;
|
||||
|
||||
colour = (cb) | (cg<<8) | (cr << 16) | (ca << 24);
|
||||
|
||||
|
||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||
VectorNormalize(v);
|
||||
CrossProduct(b->dir, v, crv); // replace with old p->dir?
|
||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
||||
|
||||
VectorMA(p->org, p->scale, crv, d3dparticlevertut[2].org);
|
||||
d3dparticlevertut[2].colour = colour;
|
||||
|
||||
VectorMA(p->org, -p->scale, crv, d3dparticlevertut[3].org);
|
||||
d3dparticlevertut[3].colour = colour;
|
||||
|
||||
|
||||
IDirect3DDevice9_DrawIndexedPrimitive7(pD3DDev9, D3DPT_TRIANGLELIST, D3DFVF_XYZ|D3DFVF_DIFFUSE, d3dparticlevertut, 4, d3d9particlevertindexes, 6, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1858,7 +1862,6 @@ void D3D9_DrawParticles(float ptime)
|
|||
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); //they're not all mipmapped
|
||||
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
|
||||
lastd3dtype = NULL;
|
||||
PScript_DrawParticleTypes(D3D9_DrawParticleBlob, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleSpark, D3D9_DrawParticleBeam, D3D9_DrawParticleBeamUT, NULL);
|
||||
|
||||
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_ZWRITEENABLE, FALSE );
|
||||
|
@ -1879,5 +1882,6 @@ void D3D9_DrawParticles(float ptime)
|
|||
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
|
||||
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
|
||||
IDirect3DDevice9_SetSamplerState(pD3DDev9, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -7,9 +7,6 @@ int numlightmaps;
|
|||
|
||||
mvertex_t *r_pcurrentvertbase;
|
||||
|
||||
#define LMBLOCK_WIDTH 128
|
||||
#define LMBLOCK_HEIGHT LMBLOCK_WIDTH
|
||||
|
||||
LPDIRECT3DTEXTURE9 *lightmap_d3d9textures;
|
||||
LPDIRECT3DTEXTURE9 *deluxmap_d3d9textures;
|
||||
lightmapinfo_t **lightmap;
|
||||
|
|
|
@ -85,7 +85,7 @@ static void D3D9_RecursiveWorldNode (mnode_t *node);
|
|||
void D3D9_SetupFrame (void);
|
||||
void D3D9_SetupViewPort (void);
|
||||
qboolean D3D9_ShouldDraw (void);
|
||||
void D3D9R_DrawSprite (void *e, void *parm);
|
||||
void D3D9R_DrawSprite(int count, void **e, void *parm);
|
||||
void IDirect3DDevice9_DrawIndexedPrimitive7 (LPDIRECT3DDEVICE9 pD3DDev9, int mode, int fvf, void *verts, int numverts, index_t *indicies, int numindicies, int wasted);
|
||||
|
||||
//
|
||||
|
|
|
@ -420,7 +420,7 @@ LINK32=link.exe
|
|||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /G5 /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
|
||||
# SUBTRACT BASE CPP /X
|
||||
# ADD CPP /nologo /G5 /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /I "../d3d" /D "_DEBUG" /D "D3DQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\D3DDebug/" /Fp".\D3DDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\D3DDebug/" /Fd".\D3DDebug/" /FD /c
|
||||
# ADD CPP /nologo /G5 /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /I "../d3d" /I "../libs/dxsdk9/include" /D "_DEBUG" /D "D3DQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\D3DDebug/" /Fp".\D3DDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\D3DDebug/" /Fd".\D3DDebug/" /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
|
@ -2015,45 +2015,6 @@ SOURCE=..\client\p_classic.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\client\p_darkplaces.c
|
||||
|
||||
!IF "$(CFG)" == "ftequake - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\client\p_null.c
|
||||
|
||||
!IF "$(CFG)" == "ftequake - Win32 Release"
|
||||
|
@ -2105,8 +2066,6 @@ SOURCE=..\client\p_script.c
|
|||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
|
||||
|
@ -6320,7 +6279,7 @@ SOURCE=..\qclib\execloop.h
|
|||
!IF "$(CFG)" == "ftequake - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6342,7 +6301,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6364,7 +6323,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6386,7 +6345,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLRelease"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6408,7 +6367,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 MDebug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6430,7 +6389,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 MRelease"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6452,7 +6411,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLDebug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6474,7 +6433,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinGLRelease"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6496,7 +6455,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated Server"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6518,7 +6477,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6540,7 +6499,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6562,7 +6521,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 GLDebugQ3"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6584,7 +6543,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug Dedicated ServerQ3"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -6606,7 +6565,7 @@ BuildCmds= \
|
|||
!ELSEIF "$(CFG)" == "ftequake - Win32 D3DDebug"
|
||||
|
||||
# Begin Custom Build
|
||||
InputDir=\ftesvn - Copy\engine\qclib
|
||||
InputDir=\ftetgcvs\svn\engine\qclib
|
||||
InputPath=..\qclib\execloop.h
|
||||
|
||||
BuildCmds= \
|
||||
|
@ -10498,8 +10457,8 @@ SOURCE=..\client\winquake.rc
|
|||
|
||||
!IF "$(CFG)" == "ftequake - Win32 Release"
|
||||
|
||||
# ADD BASE RSC /l 0x809 /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client"
|
||||
# ADD RSC /l 0x809 /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\svn\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL"
|
||||
# ADD BASE RSC /l 0x809 /i "\ftetgcvs\svn\engine\client" /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client"
|
||||
# ADD RSC /l 0x809 /i "\ftetgcvs\svn\engine\client" /i "\ftesvn - Copy\engine\client" /i "\ftesvn\engine\client" /i "\ftetgcvs\svnd3d\engine\client" /i "\ftetgcvs\engine\client" /i "\Projects\fteqw\engine\client" /i "\windows\J\ftetgcvs\engine\client" /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ftequake - Win32 Debug"
|
||||
|
||||
|
|
|
@ -201,246 +201,7 @@ qboolean GLMod_Trace(model_t *model, int forcehullnum, int frame, vec3_t start,
|
|||
|
||||
#ifndef SERVERONLY
|
||||
static hashtable_t skincolourmapped;
|
||||
|
||||
static vec3_t shadevector;
|
||||
static vec3_t shadelight, ambientlight;
|
||||
static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float lerp, qbyte alpha, float expand, qboolean nolightdir)
|
||||
{
|
||||
extern cvar_t r_nolerp, r_nolightdir;
|
||||
float blerp = 1-lerp;
|
||||
int i;
|
||||
float l;
|
||||
int temp;
|
||||
vec3_t *p1v, *p2v;
|
||||
vec3_t *p1n, *p2n;
|
||||
p1v = (vec3_t *)((char *)p1 + p1->ofsverts);
|
||||
p2v = (vec3_t *)((char *)p2 + p2->ofsverts);
|
||||
|
||||
p1n = (vec3_t *)((char *)p1 + p1->ofsnormals);
|
||||
p2n = (vec3_t *)((char *)p2 + p2->ofsnormals);
|
||||
|
||||
if (p1v == p2v || r_nolerp.value)
|
||||
{
|
||||
mesh->normals_array = (vec3_t*)((char *)p1 + p1->ofsnormals);
|
||||
mesh->xyz_array = p1v;
|
||||
if (r_nolightdir.value || nolightdir)
|
||||
{
|
||||
mesh->colors_array = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
l = DotProduct(mesh->normals_array[i], shadevector);
|
||||
|
||||
temp = l*ambientlight[0]+shadelight[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][0] = temp;
|
||||
|
||||
temp = l*ambientlight[1]+shadelight[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][1] = temp;
|
||||
|
||||
temp = l*ambientlight[2]+shadelight[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][2] = temp;
|
||||
|
||||
mesh->colors_array[i][3] = alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r_nolightdir.value || nolightdir)
|
||||
{
|
||||
mesh->colors_array = NULL;
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = p1n[i][0]*lerp + p2n[i][0]*blerp;
|
||||
mesh->normals_array[i][1] = p1n[i][1]*lerp + p2n[i][1]*blerp;
|
||||
mesh->normals_array[i][2] = p1n[i][2]*lerp + p2n[i][2]*blerp;
|
||||
|
||||
mesh->xyz_array[i][0] = p1v[i][0]*lerp + p2v[i][0]*blerp;
|
||||
mesh->xyz_array[i][1] = p1v[i][1]*lerp + p2v[i][1]*blerp;
|
||||
mesh->xyz_array[i][2] = p1v[i][2]*lerp + p2v[i][2]*blerp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = p1n[i][0]*lerp + p2n[i][0]*blerp;
|
||||
mesh->normals_array[i][1] = p1n[i][1]*lerp + p2n[i][1]*blerp;
|
||||
mesh->normals_array[i][2] = p1n[i][2]*lerp + p2n[i][2]*blerp;
|
||||
|
||||
mesh->xyz_array[i][0] = p1v[i][0]*lerp + p2v[i][0]*blerp;
|
||||
mesh->xyz_array[i][1] = p1v[i][1]*lerp + p2v[i][1]*blerp;
|
||||
mesh->xyz_array[i][2] = p1v[i][2]*lerp + p2v[i][2]*blerp;
|
||||
|
||||
l = DotProduct(mesh->normals_array[i], shadevector);
|
||||
temp = l*ambientlight[0]+shadelight[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][0] = temp;
|
||||
|
||||
temp = l*ambientlight[1]+shadelight[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][1] = temp;
|
||||
|
||||
temp = l*ambientlight[2]+shadelight[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
mesh->colors_array[i][2] = temp;
|
||||
|
||||
mesh->colors_array[i][3] = alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (expand)
|
||||
{
|
||||
if (mesh->xyz_array == p1v)
|
||||
{
|
||||
mesh->xyz_array = tempVertexCoords;
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->xyz_array[i][0] = p1v[i][0] + mesh->normals_array[i][0]*expand;
|
||||
mesh->xyz_array[i][1] = p1v[i][1] + mesh->normals_array[i][1]*expand;
|
||||
mesh->xyz_array[i][2] = p1v[i][2] + mesh->normals_array[i][2]*expand;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->xyz_array[i][0] += mesh->normals_array[i][0]*expand;
|
||||
mesh->xyz_array[i][1] += mesh->normals_array[i][1]*expand;
|
||||
mesh->xyz_array[i][2] += mesh->normals_array[i][2]*expand;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef SKELETALMODELS
|
||||
|
||||
#ifndef SERVERONLY
|
||||
static void Alias_BuildSkeletalMesh(mesh_t *mesh, float *bonepose, galisskeletaltransforms_t *weights, int numweights)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// blend the vertex bone weights
|
||||
// memset(outhead, 0, mesh->numvertexes * sizeof(mesh->xyz_array[0]));
|
||||
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = 0;
|
||||
mesh->normals_array[i][1] = 0;
|
||||
mesh->normals_array[i][2] = 1;
|
||||
/*
|
||||
mesh->colors_array[i][0] = ambientlight[0];
|
||||
mesh->colors_array[i][1] = ambientlight[1];
|
||||
mesh->colors_array[i][2] = ambientlight[2];
|
||||
mesh->colors_array[i][3] = 255;//alpha;
|
||||
*/
|
||||
/*
|
||||
mesh->xyz_array[i][0] = 0;
|
||||
mesh->xyz_array[i][1] = 0;
|
||||
mesh->xyz_array[i][2] = 0;
|
||||
mesh->xyz_array[i][3] = 1;
|
||||
*/
|
||||
}
|
||||
mesh->colors_array = NULL;
|
||||
|
||||
memset(mesh->xyz_array, 0, mesh->numvertexes*sizeof(vec3_t));
|
||||
Alias_TransformVerticies(bonepose, weights, numweights, (float*)mesh->xyz_array);
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0 //draws the bones
|
||||
qglColor3f(1, 0, 0);
|
||||
{
|
||||
int i;
|
||||
int p;
|
||||
vec3_t org, dest;
|
||||
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
qglVertex3f(bonepose[i][3], bonepose[i][7], bonepose[i][11]);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
qglBegin(GL_LINES);
|
||||
for (i = 0; i < bonecount; i++)
|
||||
{
|
||||
p = bones[i].parent;
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
org[0] = bonepose[i][3]; org[1] = bonepose[i][7]; org[2] = bonepose[i][11];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][0];dest[1] = org[1]+bonepose[i][1];dest[2] = org[2]+bonepose[i][2];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][4];dest[1] = org[1]+bonepose[i][5];dest[2] = org[2]+bonepose[i][6];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
dest[0] = org[0]+bonepose[i][8];dest[1] = org[1]+bonepose[i][9];dest[2] = org[2]+bonepose[i][10];
|
||||
qglVertex3fv(org);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3fv(dest);
|
||||
qglVertex3f(bonepose[p][3], bonepose[p][7], bonepose[p][11]);
|
||||
}
|
||||
qglEnd();
|
||||
|
||||
// mesh->numindexes = 0; //don't draw this mesh, as that would obscure the bones. :(
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SERVERONLY
|
||||
|
||||
void R_LightArrays(byte_vec4_t *colours, int vertcount, vec3_t *normals)
|
||||
{
|
||||
int i;
|
||||
float l;
|
||||
int temp;
|
||||
|
||||
for (i = vertcount-1; i >= 0; i--)
|
||||
{
|
||||
l = DotProduct(normals[i], shadevector);
|
||||
|
||||
temp = l*ambientlight[0]+shadelight[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][0] = temp;
|
||||
|
||||
temp = l*ambientlight[1]+shadelight[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][1] = temp;
|
||||
|
||||
temp = l*ambientlight[2]+shadelight[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][2] = temp;
|
||||
}
|
||||
}
|
||||
extern vec3_t shadevector, shadelight, ambientlight;
|
||||
|
||||
//changes vertex lighting values
|
||||
static void R_GAliasApplyLighting(mesh_t *mesh, vec3_t org, vec3_t angles, float *colormod)
|
||||
|
@ -562,142 +323,6 @@ static void R_GAliasApplyLighting(mesh_t *mesh, vec3_t org, vec3_t angles, float
|
|||
}
|
||||
}
|
||||
|
||||
static qboolean R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf,
|
||||
entity_t *e,
|
||||
float alpha, qboolean nolightdir)
|
||||
{
|
||||
galiasgroup_t *g1, *g2;
|
||||
|
||||
int frame1;
|
||||
int frame2;
|
||||
float lerp;
|
||||
float fg1time;
|
||||
float fg2time;
|
||||
|
||||
if (!inf->groups)
|
||||
{
|
||||
Con_DPrintf("Model with no frames (%s)\n", currententity->model->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numTempColours < inf->numverts)
|
||||
{
|
||||
if (tempColours)
|
||||
BZ_Free(tempColours);
|
||||
tempColours = BZ_Malloc(sizeof(*tempColours)*inf->numverts);
|
||||
numTempColours = inf->numverts;
|
||||
}
|
||||
if (numTempNormals < inf->numverts)
|
||||
{
|
||||
if (tempNormals)
|
||||
BZ_Free(tempNormals);
|
||||
tempNormals = BZ_Malloc(sizeof(*tempNormals)*inf->numverts);
|
||||
numTempNormals = inf->numverts;
|
||||
}
|
||||
if (numTempVertexCoords < inf->numverts)
|
||||
{
|
||||
if (tempVertexCoords)
|
||||
BZ_Free(tempVertexCoords);
|
||||
tempVertexCoords = BZ_Malloc(sizeof(*tempVertexCoords)*inf->numverts);
|
||||
numTempVertexCoords = inf->numverts;
|
||||
}
|
||||
|
||||
mesh->numvertexes = inf->numverts;
|
||||
mesh->indexes = (index_t*)((char *)inf + inf->ofs_indexes);
|
||||
mesh->numindexes = inf->numindexes;
|
||||
|
||||
if (inf->sharesverts)
|
||||
return false; //don't generate the new vertex positions. We still have them all.
|
||||
|
||||
#ifndef SERVERONLY
|
||||
mesh->st_array = (vec2_t*)((char *)inf + inf->ofs_st_array);
|
||||
mesh->lmst_array = NULL;
|
||||
mesh->colors_array = tempColours;
|
||||
mesh->trneighbors = (int *)((char *)inf + inf->ofs_trineighbours);
|
||||
mesh->normals_array = tempNormals;
|
||||
#endif
|
||||
mesh->xyz_array = tempVertexCoords;
|
||||
|
||||
//we don't support meshes with one pose skeletal and annother not.
|
||||
//we don't support meshes with one group skeletal and annother not.
|
||||
|
||||
#ifdef SKELETALMODELS
|
||||
if (inf->numbones)
|
||||
{
|
||||
float bonepose[MAX_BONES][12];
|
||||
float *usebonepose;
|
||||
usebonepose = Alias_GetBonePositions(inf, &e->framestate, (float*)bonepose, MAX_BONES);
|
||||
Alias_BuildSkeletalMesh(mesh, usebonepose, (galisskeletaltransforms_t *)((char*)inf+inf->ofstransforms), inf->numtransforms);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
frame1 = e->framestate.g[FS_REG].frame[0];
|
||||
frame2 = e->framestate.g[FS_REG].frame[1];
|
||||
lerp = e->framestate.g[FS_REG].lerpfrac;
|
||||
fg1time = e->framestate.g[FS_REG].frametime[0];
|
||||
fg2time = e->framestate.g[FS_REG].frametime[1];
|
||||
|
||||
if (frame1 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame1 = 0;
|
||||
}
|
||||
if (frame2 < 0)
|
||||
{
|
||||
Con_DPrintf("Negative frame (%s)\n", currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
if (frame1 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame1, currententity->model->name);
|
||||
frame1 %= inf->groups;
|
||||
}
|
||||
if (frame2 >= inf->groups)
|
||||
{
|
||||
Con_DPrintf("Too high frame %i (%s)\n", frame2, currententity->model->name);
|
||||
frame2 = frame1;
|
||||
}
|
||||
|
||||
if (lerp <= 0)
|
||||
frame2 = frame1;
|
||||
else if (lerp >= 1)
|
||||
frame1 = frame2;
|
||||
|
||||
g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1);
|
||||
g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2);
|
||||
|
||||
if (g1 == g2) //lerping within group is only done if not changing group
|
||||
{
|
||||
lerp = fg1time*g1->rate;
|
||||
if (lerp < 0) lerp = 0; //hrm
|
||||
frame1=lerp;
|
||||
frame2=frame1+1;
|
||||
lerp-=frame1;
|
||||
if (g1->loop)
|
||||
{
|
||||
frame1=frame1%g1->numposes;
|
||||
frame2=frame2%g1->numposes;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame1=(frame1>g1->numposes-1)?g1->numposes-1:frame1;
|
||||
frame2=(frame2>g1->numposes-1)?g1->numposes-1:frame2;
|
||||
}
|
||||
}
|
||||
else //don't bother with a four way lerp. Yeah, this will produce jerkyness with models with just framegroups.
|
||||
{
|
||||
frame1=0;
|
||||
frame2=0;
|
||||
}
|
||||
|
||||
R_LerpFrames(mesh, (galiaspose_t *)((char *)g1 + g1->poseofs + sizeof(galiaspose_t)*frame1),
|
||||
(galiaspose_t *)((char *)g2 + g2->poseofs + sizeof(galiaspose_t)*frame2),
|
||||
1-lerp, (qbyte)(alpha*255), currententity->fatness, nolightdir);
|
||||
|
||||
return true; //to allow the mesh to be dlighted.
|
||||
}
|
||||
|
||||
void GL_GAliasFlushSkinCache(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -1740,7 +1365,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
memset(&mesh, 0, sizeof(mesh));
|
||||
for(surfnum=0; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)), surfnum++)
|
||||
{
|
||||
needrecolour = R_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], nolightdir);
|
||||
needrecolour = Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], nolightdir);
|
||||
|
||||
c_alias_polys += mesh.numindexes/3;
|
||||
|
||||
|
@ -2373,7 +1998,7 @@ void R_DrawGAliasModelLighting (entity_t *e, vec3_t lightpos, vec3_t colours, fl
|
|||
// qglDepthFunc(GL_ALWAYS);
|
||||
for(surfnum=0;inf;surfnum++)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha, e->frame1time, e->frame2time, false);
|
||||
R_GAliasBuildMesh(&mesh, inf, e->alpha, false);
|
||||
mesh.colors_array = tempColours;
|
||||
|
||||
tex = GL_ChooseSkin(inf, clmodel->name, surfnum, e);
|
||||
|
@ -2447,7 +2072,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
{
|
||||
if (inf->ofs_trineighbours)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e, 1, true);
|
||||
Alias_GAliasBuildMesh(&mesh, inf, e, 1, true);
|
||||
R_CalcFacing(&mesh, lightorg);
|
||||
R_ProjectShadowVolume(&mesh, lightorg);
|
||||
R_DrawShadowVolume(&mesh);
|
||||
|
|
|
@ -269,7 +269,7 @@ static void Shader_ParseVector ( char **ptr, vec3_t v )
|
|||
}
|
||||
}
|
||||
|
||||
static void Shader_ParseSkySides ( char **ptr, int *images )
|
||||
static void Shader_ParseSkySides ( shader_t *shader, char **ptr, int *images )
|
||||
{
|
||||
int i;
|
||||
char *token;
|
||||
|
@ -285,7 +285,10 @@ static void Shader_ParseSkySides ( char **ptr, int *images )
|
|||
Com_sprintf ( path, sizeof(path), "%s_%s", token, suf[i] );
|
||||
images[i] = Mod_LoadHiResTexture ( path, NULL, true, false, true);//|IT_SKY );
|
||||
if (!images[i])
|
||||
{
|
||||
Con_Printf("Shader \"%s\" missing texture: %s\n", shader->name, path);
|
||||
images[i] = missing_texture;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,14 +452,14 @@ static void Shader_SkyParms ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
|||
skydome = (skydome_t *)Z_Malloc ( sizeof(skydome_t) );
|
||||
shader->skydome = skydome;
|
||||
|
||||
Shader_ParseSkySides ( ptr, skydome->farbox_textures );
|
||||
Shader_ParseSkySides ( shader, ptr, skydome->farbox_textures );
|
||||
|
||||
skyheight = Shader_ParseFloat ( ptr );
|
||||
if ( !skyheight ) {
|
||||
skyheight = 512.0f;
|
||||
}
|
||||
|
||||
Shader_ParseSkySides ( ptr, skydome->nearbox_textures );
|
||||
Shader_ParseSkySides ( shader, ptr, skydome->nearbox_textures );
|
||||
|
||||
// R_CreateSkydome ( shader, skyheight );
|
||||
|
||||
|
@ -1708,7 +1711,10 @@ void Shader_Finish ( shader_t *s )
|
|||
pass->tcgen = TC_GEN_BASE;
|
||||
pass->anim_frames[0] = Mod_LoadHiResTexture(s->name, NULL, true, false, true);//GL_FindImage (shortname, 0);
|
||||
if (!pass->anim_frames[0])
|
||||
{
|
||||
Con_Printf("Shader %s failed to load default texture\n", s->name);
|
||||
pass->anim_frames[0] = missing_texture;
|
||||
}
|
||||
pass->depthfunc = GL_LEQUAL;
|
||||
pass->flags = SHADER_PASS_DEPTHWRITE;
|
||||
pass->rgbgen = RGB_GEN_VERTEX;
|
||||
|
@ -2156,8 +2162,6 @@ void Shader_DefaultBSPVertex(char *shortname, shader_t *s)
|
|||
pass = &s->passes[0];
|
||||
pass->tcgen = TC_GEN_BASE;
|
||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, false, true);//GL_FindImage (shortname, 0);
|
||||
if (!pass->anim_frames[0])
|
||||
pass->anim_frames[0] = missing_texture;
|
||||
pass->depthfunc = GL_LEQUAL;
|
||||
pass->flags = SHADER_PASS_DEPTHWRITE;
|
||||
pass->rgbgen = RGB_GEN_VERTEX;
|
||||
|
@ -2187,8 +2191,6 @@ void Shader_DefaultBSPFlare(char *shortname, shader_t *s)
|
|||
pass->blenddst = GL_ONE;
|
||||
pass->blendmode = GL_MODULATE;
|
||||
pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0);
|
||||
if (!pass->anim_frames[0])
|
||||
pass->anim_frames[0] = missing_texture;
|
||||
pass->depthfunc = GL_LEQUAL;
|
||||
pass->rgbgen = RGB_GEN_VERTEX;
|
||||
pass->alphagen = ALPHA_GEN_IDENTITY;
|
||||
|
@ -2239,7 +2241,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
|
|||
pass->anim_frames[0] = missing_texture;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
tex = Mod_LoadHiResTexture(va("%s_shirt", shortname), NULL, true, true, true);
|
||||
if (tex)
|
||||
{
|
||||
|
@ -2283,7 +2285,7 @@ void Shader_DefaultSkin(char *shortname, shader_t *s)
|
|||
pass->anim_frames[0] = missing_texture;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
tex = Mod_LoadHiResTexture(va("%s_glow", shortname), NULL, true, true, true);
|
||||
if (tex)
|
||||
{
|
||||
|
|
|
@ -688,7 +688,7 @@ void SWR_DrawBeam(entity_t *e)
|
|||
for (; len>=0; len--)
|
||||
{
|
||||
VectorAdd(o1, dir, o2);
|
||||
D_DrawSparkTrans (o1, o2, 1, 0);
|
||||
D_DrawSparkTrans (o1, o2, 1, 0, BM_BLEND);
|
||||
VectorCopy(o2, o1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2543,7 +2543,7 @@ void SWDraw_Fill8 (int x, int y, int w, int h, unsigned char c)
|
|||
dest[u] = c;
|
||||
}
|
||||
|
||||
void SWDraw_Fill (int x, int y, int w, int h, int c)
|
||||
void SWDraw_Fill (int x, int y, int w, int h, unsigned int c)
|
||||
{
|
||||
if (x < 0 || x + w > vid.width ||
|
||||
y < 0 || y + h > vid.height) {
|
||||
|
|
|
@ -38,7 +38,7 @@ void SWDraw_EditorBackground (int lines);
|
|||
void SWDraw_BeginDisc (void);
|
||||
void SWDraw_EndDisc (void);
|
||||
void SWDraw_TileClear (int x, int y, int w, int h);
|
||||
void SWDraw_Fill (int x, int y, int w, int h, int c);
|
||||
void SWDraw_Fill (int x, int y, int w, int h, unsigned int c);
|
||||
void SWDraw_FillRGB (int x, int y, int w, int h, float r, float g, float b);
|
||||
void SWDraw_FadeScreen (void);
|
||||
void SWDraw_String (int x, int y, const qbyte *str);
|
||||
|
|
Loading…
Reference in a new issue