mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 13:50:53 +00:00
try to lerp angles properly.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5028 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
732a89f7c1
commit
4925e5f842
1 changed files with 142 additions and 147 deletions
|
@ -248,80 +248,50 @@ int HLMod_BoneForName(model_t *mod, char *name)
|
||||||
=======================================================================================================================
|
=======================================================================================================================
|
||||||
HL_CalculateBones - calculate bone positions - quaternion+vector in one function
|
HL_CalculateBones - calculate bone positions - quaternion+vector in one function
|
||||||
=======================================================================================================================
|
=======================================================================================================================
|
||||||
|
|
||||||
note, while ender may be proud of this function, it lacks the fact that interpolating eular angles is not as acurate as interpolating quaternions.
|
|
||||||
it is faster though.
|
|
||||||
*/
|
*/
|
||||||
void HL_CalculateBones
|
void HL_CalculateBones
|
||||||
(
|
(
|
||||||
int offset,
|
int frame,
|
||||||
int frame1,
|
vec4_t adjust,
|
||||||
int frame2,
|
hlmdl_bone_t *bone,
|
||||||
float lerpfrac,
|
hlmdl_anim_t *animation,
|
||||||
vec4_t adjust,
|
float *organg
|
||||||
hlmdl_bone_t *bone,
|
|
||||||
hlmdl_anim_t *animation,
|
|
||||||
float *destination
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~*/
|
int i;
|
||||||
int i;
|
|
||||||
vec3_t angle;
|
|
||||||
float lerpifrac = 1-lerpfrac;
|
|
||||||
/*~~~~~~~~~~*/
|
|
||||||
|
|
||||||
/* For each vector */
|
/* For each vector */
|
||||||
for(i = 0; i < 3; i++)
|
for(i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~*/
|
organg[i] = bone->value[i]; /* Take the bone value */
|
||||||
int o = i + offset; /* Take the value offset - allows quaternion & vector in one function */
|
|
||||||
/*~~~~~~~~~~~~~~~*/
|
|
||||||
|
|
||||||
angle[i] = bone->value[o]; /* Take the bone value */
|
if(animation->offset[i] != 0)
|
||||||
|
{
|
||||||
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
int tempframe;
|
||||||
|
hlmdl_animvalue_t *animvalue = (hlmdl_animvalue_t *) ((qbyte *) animation + animation->offset[i]);
|
||||||
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
if(animation->offset[o] != 0)
|
/* find values including the required frame */
|
||||||
{
|
tempframe = frame;
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
||||||
int tempframe;
|
|
||||||
hlmdl_animvalue_t *animvalue = (hlmdl_animvalue_t *) ((qbyte *) animation + animation->offset[o]);
|
|
||||||
short f1, f2;
|
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
||||||
|
|
||||||
/* find values including the required frame */
|
|
||||||
tempframe = frame1;
|
|
||||||
while(animvalue->num.total <= tempframe)
|
|
||||||
{
|
|
||||||
tempframe -= animvalue->num.total;
|
|
||||||
animvalue += animvalue->num.valid + 1;
|
|
||||||
}
|
|
||||||
f1 = animvalue[min(animvalue->num.valid-1, tempframe)+1].value;
|
|
||||||
|
|
||||||
/* frame2 is always higher than frame1, so keep searching for it, if its in a different block */
|
|
||||||
tempframe += frame2-frame1;
|
|
||||||
while(animvalue->num.total <= tempframe)
|
while(animvalue->num.total <= tempframe)
|
||||||
{
|
{
|
||||||
tempframe -= animvalue->num.total;
|
tempframe -= animvalue->num.total;
|
||||||
animvalue += animvalue->num.valid + 1;
|
animvalue += animvalue->num.valid + 1;
|
||||||
}
|
}
|
||||||
f2 = animvalue[min(animvalue->num.valid-1, tempframe)+1].value;
|
if (tempframe >= animvalue->num.valid)
|
||||||
|
tempframe = animvalue->num.valid;
|
||||||
|
else
|
||||||
|
tempframe += 1;
|
||||||
|
|
||||||
angle[i] += (f1 * lerpifrac + lerpfrac * f2) * bone->scale[o];
|
organg[i] += animvalue[tempframe].value * bone->scale[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bone->bonecontroller[o] != -1)
|
if(bone->bonecontroller[i] != -1)
|
||||||
{ /* Add the programmable offset. */
|
{ /* Add the programmable offset. */
|
||||||
angle[i] += adjust[bone->bonecontroller[o]];
|
organg[i] += adjust[bone->bonecontroller[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(offset < 3)
|
|
||||||
{
|
|
||||||
VectorCopy(angle, destination); /* Just a standard vector */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QuaternionGLAngle(angle, destination); /* A quaternion */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -331,39 +301,39 @@ void HL_CalculateBones
|
||||||
*/
|
*/
|
||||||
void HL_CalcBoneAdj(hlmodel_t *model)
|
void HL_CalcBoneAdj(hlmodel_t *model)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
int i;
|
int i;
|
||||||
float value;
|
float value;
|
||||||
hlmdl_bonecontroller_t *control = (hlmdl_bonecontroller_t *)
|
hlmdl_bonecontroller_t *control = (hlmdl_bonecontroller_t *)
|
||||||
((qbyte *) model->header + model->header->controllerindex);
|
((qbyte *) model->header + model->header->controllerindex);
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
for(i = 0; i < model->header->numcontrollers; i++)
|
for(i = 0; i < model->header->numcontrollers; i++)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
int j = control[i].index;
|
int j = control[i].index;
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
if(control[i].type & 0x8000)
|
if(control[i].type & 0x8000)
|
||||||
{
|
{
|
||||||
value = model->controller[j] + control[i].start;
|
value = model->controller[j] + control[i].start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = (model->controller[j]+1)*0.5; //shifted to give a valid range between -1 and 1, with 0 being mid-range.
|
value = (model->controller[j]+1)*0.5; //shifted to give a valid range between -1 and 1, with 0 being mid-range.
|
||||||
if(value < 0)
|
if(value < 0)
|
||||||
value = 0;
|
value = 0;
|
||||||
else if(value > 1.0)
|
else if(value > 1.0)
|
||||||
value = 1.0;
|
value = 1.0;
|
||||||
value = (1.0 - value) * control[i].start + value * control[i].end;
|
value = (1.0 - value) * control[i].start + value * control[i].end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rotational controllers need their values converted */
|
/* Rotational controllers need their values converted */
|
||||||
if(control[i].type >= 0x0008 && control[i].type <= 0x0020)
|
if(control[i].type >= 0x0008 && control[i].type <= 0x0020)
|
||||||
model->adjust[i] = M_PI * value / 180;
|
model->adjust[i] = M_PI * value / 180;
|
||||||
else
|
else
|
||||||
model->adjust[i] = value;
|
model->adjust[i] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -374,21 +344,23 @@ void HL_CalcBoneAdj(hlmodel_t *model)
|
||||||
void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt );
|
void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt );
|
||||||
void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, float subblendfrac, float frametime)
|
void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, float subblendfrac, float frametime)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
int i;
|
int i;
|
||||||
float matrix[3][4];
|
float matrix[3][4];
|
||||||
static vec3_t positions[2];
|
vec3_t organg1[2];
|
||||||
static vec4_t quaternions[2], blended;
|
vec3_t organg2[2];
|
||||||
|
vec3_t organgb[2];
|
||||||
|
vec4_t quat1, quat2, quatb;
|
||||||
|
|
||||||
int frame1, frame2;
|
int frame1, frame2;
|
||||||
|
|
||||||
hlmdl_sequencelist_t *sequence = (hlmdl_sequencelist_t *) ((qbyte *) model->header + model->header->seqindex) +
|
hlmdl_sequencelist_t *sequence = (hlmdl_sequencelist_t *) ((qbyte *) model->header + model->header->seqindex) +
|
||||||
((unsigned int)seqnum>=model->header->numseq?0:seqnum);
|
((unsigned int)seqnum>=model->header->numseq?0:seqnum);
|
||||||
hlmdl_sequencedata_t *sequencedata = (hlmdl_sequencedata_t *)
|
hlmdl_sequencedata_t *sequencedata = (hlmdl_sequencedata_t *)
|
||||||
((qbyte *) model->header + model->header->seqgroups) +
|
((qbyte *) model->header + model->header->seqgroups) +
|
||||||
sequence->seqindex;
|
sequence->seqindex;
|
||||||
hlmdl_anim_t *animation;
|
hlmdl_anim_t *animation;
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
if (sequencedata->name[32])
|
if (sequencedata->name[32])
|
||||||
{
|
{
|
||||||
|
@ -420,7 +392,7 @@ void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, fl
|
||||||
|
|
||||||
if (!sequence->numframes)
|
if (!sequence->numframes)
|
||||||
return;
|
return;
|
||||||
if(frame1 >= sequence->numframes)
|
if(frame1 >= sequence->numframes)
|
||||||
{
|
{
|
||||||
if (sequence->loop)
|
if (sequence->loop)
|
||||||
frame1 %= sequence->numframes;
|
frame1 %= sequence->numframes;
|
||||||
|
@ -448,15 +420,15 @@ void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, fl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HL_CalcBoneAdj(model); /* Deal with programmable controllers */
|
HL_CalcBoneAdj(model); /* Deal with programmable controllers */
|
||||||
|
|
||||||
/*FIXME:this is useless*/
|
/*FIXME:this is useless*/
|
||||||
/*
|
/*
|
||||||
if(sequence->motiontype & 0x0001)
|
if(sequence->motiontype & 0x0001)
|
||||||
positions[sequence->motionbone][0] = 0.0;
|
positions[sequence->motionbone][0] = 0.0;
|
||||||
if(sequence->motiontype & 0x0002)
|
if(sequence->motiontype & 0x0002)
|
||||||
positions[sequence->motionbone][1] = 0.0;
|
positions[sequence->motionbone][1] = 0.0;
|
||||||
if(sequence->motiontype & 0x0004)
|
if(sequence->motiontype & 0x0004)
|
||||||
positions[sequence->motionbone][2] = 0.0;
|
positions[sequence->motionbone][2] = 0.0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -490,16 +462,35 @@ void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, fl
|
||||||
subblendfrac = 1;
|
subblendfrac = 1;
|
||||||
for(i = firstbone; i < lastbone; i++)
|
for(i = firstbone; i < lastbone; i++)
|
||||||
{
|
{
|
||||||
HL_CalculateBones(0, frame1, frame2, frametime, model->adjust, model->bones + i, animation + i, positions[0]);
|
//calc first blend (writes organgb+quatb)
|
||||||
HL_CalculateBones(3, frame1, frame2, frametime, model->adjust, model->bones + i, animation + i, quaternions[0]);
|
HL_CalculateBones(frame1, model->adjust, model->bones + i, animation + i, organgb[0]);
|
||||||
|
QuaternionGLAngle(organgb[1], quatb); /* A quaternion */
|
||||||
|
if (frame1 != frame2)
|
||||||
|
{
|
||||||
|
HL_CalculateBones(frame2, model->adjust, model->bones + i, animation + i, organg2[0]);
|
||||||
|
QuaternionGLAngle(organg2[1], quat2); /* A quaternion */
|
||||||
|
|
||||||
HL_CalculateBones(3, frame1, frame2, frametime, model->adjust, model->bones + i, animation + i + model->header->numbones, quaternions[1]);
|
QuaternionSlerp(quatb, quat2, frametime, quatb);
|
||||||
|
VectorInterpolate(organgb[0], frametime, organg2[0], organgb[0]);
|
||||||
|
}
|
||||||
|
|
||||||
QuaternionSlerp(quaternions[0], quaternions[1], subblendfrac, blended);
|
//calc first blend (writes organg1+quat1)
|
||||||
QuaternionGLMatrix(blended[0], blended[1], blended[2], blended[3], matrix);
|
HL_CalculateBones(frame1, model->adjust, model->bones + i, animation + i + model->header->numbones, organg1[0]);
|
||||||
matrix[0][3] = positions[0][0];
|
QuaternionGLAngle(organg1[1], quat1); /* A quaternion */
|
||||||
matrix[1][3] = positions[0][1];
|
if (frame1 != frame2)
|
||||||
matrix[2][3] = positions[0][2];
|
{
|
||||||
|
HL_CalculateBones(frame2, model->adjust, model->bones + i, animation + i + model->header->numbones, organg2[0]);
|
||||||
|
QuaternionGLAngle(organg2[1], quat2); /* A quaternion */
|
||||||
|
|
||||||
|
QuaternionSlerp(quat1, quat2, frametime, quat1);
|
||||||
|
VectorInterpolate(organg1[0], frametime, organg2[0], organg1[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//blend the two
|
||||||
|
QuaternionSlerp(quatb, quat1, subblendfrac, quat1);
|
||||||
|
FloatInterpolate(organgb[0][0], subblendfrac, organg1[0][0], matrix[0][3]);
|
||||||
|
FloatInterpolate(organgb[0][0], subblendfrac, organg1[0][1], matrix[1][3]);
|
||||||
|
FloatInterpolate(organgb[0][0], subblendfrac, organg1[0][2], matrix[2][3]);
|
||||||
|
|
||||||
/* If we have a parent, take the addition. Otherwise just copy the values */
|
/* If we have a parent, take the addition. Otherwise just copy the values */
|
||||||
if(model->bones[i].parent>=0)
|
if(model->bones[i].parent>=0)
|
||||||
|
@ -511,25 +502,28 @@ void HL_SetupBones(hlmodel_t *model, int seqnum, int firstbone, int lastbone, fl
|
||||||
memcpy(transform_matrix[i], matrix, 12 * sizeof(float));
|
memcpy(transform_matrix[i], matrix, 12 * sizeof(float));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(i = firstbone; i < lastbone; i++)
|
for(i = firstbone; i < lastbone; i++)
|
||||||
{
|
{
|
||||||
/*
|
HL_CalculateBones(frame1, model->adjust, model->bones + i, animation + i, organg1[0]);
|
||||||
* There are two vector offsets in the structure. The first seems to be the
|
QuaternionGLAngle(organg1[1], quat1); /* A quaternion */
|
||||||
* positions of the bones, the second the quats of the bone matrix itself. We
|
if (frame1 != frame2)
|
||||||
* convert it inside the routine - Inconsistant, but hey.. so's the whole model
|
{
|
||||||
* format.
|
HL_CalculateBones(frame2, model->adjust, model->bones + i, animation + i, organg2[0]);
|
||||||
*/
|
QuaternionGLAngle(organg2[1], quat2); /* A quaternion */
|
||||||
HL_CalculateBones(0, frame1, frame2, frametime, model->adjust, model->bones + i, animation + i, positions[0]);
|
|
||||||
HL_CalculateBones(3, frame1, frame2, frametime, model->adjust, model->bones + i, animation + i, quaternions[0]);
|
|
||||||
|
|
||||||
QuaternionGLMatrix(quaternions[0][0], quaternions[0][1], quaternions[0][2], quaternions[0][3], matrix);
|
//lerp the quats properly rather than poorly lerping eular angles.
|
||||||
matrix[0][3] = positions[0][0];
|
QuaternionSlerp(quat1, quat2, frametime, quat1);
|
||||||
matrix[1][3] = positions[0][1];
|
VectorInterpolate(organg1[0], frametime, organg2[0], organg1[0]);
|
||||||
matrix[2][3] = positions[0][2];
|
}
|
||||||
|
|
||||||
|
//we probably ought to keep them as quats or something.
|
||||||
|
QuaternionGLMatrix(quat1[0], quat1[1], quat1[2], quat1[3], matrix);
|
||||||
|
matrix[0][3] = organg1[0][0];
|
||||||
|
matrix[1][3] = organg1[0][1];
|
||||||
|
matrix[2][3] = organg1[0][2];
|
||||||
|
|
||||||
/* If we have a parent, take the addition. Otherwise just copy the values */
|
/* If we have a parent, take the addition. Otherwise just copy the values */
|
||||||
if(model->bones[i].parent>=0)
|
if(model->bones[i].parent>=0)
|
||||||
|
@ -649,6 +643,7 @@ void R_HL_BuildFrame(hlmodel_t *model, hlmdl_model_t *amodel, entity_t *curent,
|
||||||
st[vert][0] = order[2] * tex_s;
|
st[vert][0] = order[2] * tex_s;
|
||||||
st[vert][1] = order[3] * tex_t;
|
st[vert][1] = order[3] * tex_t;
|
||||||
|
|
||||||
|
/*fixme: build vertex normals in the base pose and transform them using the same bone matricies (just discard the origin part)*/
|
||||||
norm[vert][0] = 1;
|
norm[vert][0] = 1;
|
||||||
norm[vert][1] = 1;
|
norm[vert][1] = 1;
|
||||||
norm[vert][2] = 1;
|
norm[vert][2] = 1;
|
||||||
|
@ -661,7 +656,7 @@ void R_HL_BuildFrame(hlmodel_t *model, hlmdl_model_t *amodel, entity_t *curent,
|
||||||
order += 4;
|
order += 4;
|
||||||
vert++;
|
vert++;
|
||||||
} while(--count);
|
} while(--count);
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh->numindexes = idx;
|
mesh->numindexes = idx;
|
||||||
mesh->numvertexes = vert;
|
mesh->numvertexes = vert;
|
||||||
|
@ -690,23 +685,23 @@ void R_HalfLife_WalkMeshes(entity_t *rent, batch_t *b, batch_t **batches)
|
||||||
model.memgroup = &rent->model->memgroup;
|
model.memgroup = &rent->model->memgroup;
|
||||||
|
|
||||||
for (body = 0; body < model.header->numbodyparts; body++)
|
for (body = 0; body < model.header->numbodyparts; body++)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
hlmdl_bodypart_t *bodypart = (hlmdl_bodypart_t *) ((qbyte *) model.header + model.header->bodypartindex) + body;
|
hlmdl_bodypart_t *bodypart = (hlmdl_bodypart_t *) ((qbyte *) model.header + model.header->bodypartindex) + body;
|
||||||
int bodyindex = (0 / bodypart->base) % bodypart->nummodels;
|
int bodyindex = (0 / bodypart->base) % bodypart->nummodels;
|
||||||
hlmdl_model_t *amodel = (hlmdl_model_t *) ((qbyte *) model.header + bodypart->modelindex) + bodyindex;
|
hlmdl_model_t *amodel = (hlmdl_model_t *) ((qbyte *) model.header + bodypart->modelindex) + bodyindex;
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
|
|
||||||
/* Draw each mesh */
|
/* Draw each mesh */
|
||||||
for(m = 0; m < amodel->nummesh; m++)
|
for(m = 0; m < amodel->nummesh; m++)
|
||||||
{
|
{
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
hlmdl_mesh_t *mesh = (hlmdl_mesh_t *) ((qbyte *) model.header + amodel->meshindex) + m;
|
hlmdl_mesh_t *mesh = (hlmdl_mesh_t *) ((qbyte *) model.header + amodel->meshindex) + m;
|
||||||
float tex_w;
|
float tex_w;
|
||||||
float tex_h;
|
float tex_h;
|
||||||
struct hlmodelshaders_s *s;
|
struct hlmodelshaders_s *s;
|
||||||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
if (mesh->skinindex >= modelc->numskins)
|
if (mesh->skinindex >= modelc->numskins)
|
||||||
continue;
|
continue;
|
||||||
|
@ -766,7 +761,7 @@ void R_HalfLife_WalkMeshes(entity_t *rent, batch_t *b, batch_t **batches)
|
||||||
b->next = batches[sort];
|
b->next = batches[sort];
|
||||||
batches[sort] = b;
|
batches[sort] = b;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (batchid == b->surf_first)
|
if (batchid == b->surf_first)
|
||||||
{
|
{
|
||||||
|
@ -780,8 +775,8 @@ void R_HalfLife_WalkMeshes(entity_t *rent, batch_t *b, batch_t **batches)
|
||||||
}
|
}
|
||||||
|
|
||||||
batchid++;
|
batchid++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel);
|
qboolean R_CalcModelLighting(entity_t *e, model_t *clmodel);
|
||||||
|
|
Loading…
Reference in a new issue