mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
fix hitmodel with hlmdl, to actually work properly with rotated entities.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5072 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
dadec86338
commit
cb010176a1
4 changed files with 71 additions and 61 deletions
|
@ -2902,6 +2902,8 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
|
||||||
|
|
||||||
memset(&ent, 0, sizeof(ent));
|
memset(&ent, 0, sizeof(ent));
|
||||||
ent.scale = 1;
|
ent.scale = 1;
|
||||||
|
// ent.angles[1] = realtime*45;//mods->yaw;
|
||||||
|
// ent.angles[0] = realtime*23.4;//mods->pitch;
|
||||||
ent.model = Mod_ForName(mods->modelname, MLV_WARN);
|
ent.model = Mod_ForName(mods->modelname, MLV_WARN);
|
||||||
if (!ent.model)
|
if (!ent.model)
|
||||||
return; //panic!
|
return; //panic!
|
||||||
|
@ -2933,10 +2935,10 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
|
||||||
ent.light_known = 2;
|
ent.light_known = 2;
|
||||||
|
|
||||||
|
|
||||||
// ent.angles[0]*=r_meshpitch.value;
|
ent.angles[0]*=r_meshpitch.value;
|
||||||
AngleVectors(ent.angles, ent.axis[0], ent.axis[1], ent.axis[2]);
|
AngleVectors(ent.angles, ent.axis[0], ent.axis[1], ent.axis[2]);
|
||||||
|
ent.angles[0]*=r_meshpitch.value;
|
||||||
VectorInverse(ent.axis[1]);
|
VectorInverse(ent.axis[1]);
|
||||||
// ent.angles[0]*=r_meshpitch.value;
|
|
||||||
|
|
||||||
if (ent.model->type == mod_dummy)
|
if (ent.model->type == mod_dummy)
|
||||||
{
|
{
|
||||||
|
@ -3042,7 +3044,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
|
||||||
"}\n"
|
"}\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
|
||||||
if (ent.model->funcs.NativeTrace && ent.model->funcs.NativeTrace(ent.model, 0, &ent.framestate, NULL, v1, v2, vec3_origin, vec3_origin, false, ~0, &tr))
|
if (ent.model->funcs.NativeTrace && ent.model->funcs.NativeTrace(ent.model, 0, &ent.framestate, ent.axis, v1, v2, vec3_origin, vec3_origin, false, ~0, &tr))
|
||||||
{
|
{
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
float f;
|
float f;
|
||||||
|
@ -3095,12 +3097,14 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
|
||||||
float boneinfo[12];
|
float boneinfo[12];
|
||||||
|
|
||||||
Mod_GetTag(ent.model, b, &ent.framestate, boneinfo);
|
Mod_GetTag(ent.model, b, &ent.framestate, boneinfo);
|
||||||
|
//fixme: no axis transform
|
||||||
VectorSet(start, boneinfo[3], boneinfo[7], boneinfo[11]);
|
VectorSet(start, boneinfo[3], boneinfo[7], boneinfo[11]);
|
||||||
VectorAdd(start, ent.origin, start);
|
VectorAdd(start, ent.origin, start);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
Mod_GetTag(ent.model, p, &ent.framestate, boneinfo);
|
Mod_GetTag(ent.model, p, &ent.framestate, boneinfo);
|
||||||
|
//fixme: no axis transform
|
||||||
VectorSet(end, boneinfo[3], boneinfo[7], boneinfo[11]);
|
VectorSet(end, boneinfo[3], boneinfo[7], boneinfo[11]);
|
||||||
VectorAdd(end, ent.origin, end);
|
VectorAdd(end, ent.origin, end);
|
||||||
CLQ1_DrawLine(lineshader, start, end, 1, (b-1 == mods->boneidx)?0:1, 1, 1);
|
CLQ1_DrawLine(lineshader, start, end, 1, (b-1 == mods->boneidx)?0:1, 1, 1);
|
||||||
|
|
|
@ -2029,7 +2029,11 @@ void Mod_AddSingleSurface(entity_t *ent, int surfaceidx, shader_t *shader)
|
||||||
}
|
}
|
||||||
for (i = 0; i < mod->numverts; i++)
|
for (i = 0; i < mod->numverts; i++)
|
||||||
{
|
{
|
||||||
VectorAdd(ent->origin, posedata[i], cl_strisvertv[t->firstvert+i]);
|
VectorMA(ent->origin, posedata[i][0], ent->axis[0], cl_strisvertv[t->firstvert+i]);
|
||||||
|
VectorMA(cl_strisvertv[t->firstvert+i], posedata[i][1], ent->axis[1], cl_strisvertv[t->firstvert+i]);
|
||||||
|
VectorMA(cl_strisvertv[t->firstvert+i], posedata[i][2], ent->axis[2], cl_strisvertv[t->firstvert+i]);
|
||||||
|
// VectorAdd(ent->origin, posedata[i], cl_strisvertv[t->firstvert+i]);
|
||||||
|
|
||||||
Vector2Set(cl_strisvertt[t->firstvert+i], 0.5, 0.5);
|
Vector2Set(cl_strisvertt[t->firstvert+i], 0.5, 0.5);
|
||||||
Vector4Set(cl_strisvertc[t->firstvert+i], (mod->contents?1:0), 1, 1, 0.1);
|
Vector4Set(cl_strisvertc[t->firstvert+i], (mod->contents?1:0), 1, 1, 0.1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,32 +582,32 @@ void QDECL R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]
|
||||||
in1[2][2] * in2[2][3] + in1[2][3];
|
in1[2][2] * in2[2][3] + in1[2][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
//R_ConcatTransforms where there's no offset values
|
//R_ConcatTransforms where there's no offset values, and a transposed axis
|
||||||
void R_ConcatTransformsAxis (float in1[3][3], float in2[3][4], float out[3][4])
|
void R_ConcatTransformsAxis (float in1[3][3], float in2[3][4], float out[3][4])
|
||||||
{
|
{
|
||||||
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] +
|
out[0][0] = in1[0][0] * in2[0][0] + in1[1][0] * in2[1][0] +
|
||||||
in1[0][2] * in2[2][0];
|
in1[2][0] * in2[2][0];
|
||||||
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
|
out[0][1] = in1[0][0] * in2[0][1] + in1[1][0] * in2[1][1] +
|
||||||
in1[0][2] * in2[2][1];
|
in1[2][0] * in2[2][1];
|
||||||
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
|
out[0][2] = in1[0][0] * in2[0][2] + in1[1][1] * in2[1][2] +
|
||||||
in1[0][2] * in2[2][2];
|
in1[2][0] * in2[2][2];
|
||||||
out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
|
out[0][3] = in1[0][0] * in2[0][3] + in1[1][1] * in2[1][3] +
|
||||||
in1[0][2] * in2[2][3];
|
in1[2][0] * in2[2][3];
|
||||||
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
|
out[1][0] = in1[0][1] * in2[0][0] + in1[1][1] * in2[1][0] +
|
||||||
in1[1][2] * in2[2][0];
|
in1[2][1] * in2[2][0];
|
||||||
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
|
out[1][1] = in1[0][1] * in2[0][1] + in1[1][1] * in2[1][1] +
|
||||||
in1[1][2] * in2[2][1];
|
in1[2][1] * in2[2][1];
|
||||||
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
|
out[1][2] = in1[0][1] * in2[0][2] + in1[1][1] * in2[1][2] +
|
||||||
in1[1][2] * in2[2][2];
|
in1[2][1] * in2[2][2];
|
||||||
out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
|
out[1][3] = in1[0][1] * in2[0][3] + in1[1][1] * in2[1][3] +
|
||||||
in1[1][2] * in2[2][3];
|
in1[2][1] * in2[2][3];
|
||||||
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
|
out[2][0] = in1[0][2] * in2[0][0] + in1[1][2] * in2[1][0] +
|
||||||
in1[2][2] * in2[2][0];
|
in1[2][2] * in2[2][0];
|
||||||
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
|
out[2][1] = in1[0][2] * in2[0][1] + in1[1][2] * in2[1][1] +
|
||||||
in1[2][2] * in2[2][1];
|
in1[2][2] * in2[2][1];
|
||||||
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
|
out[2][2] = in1[0][2] * in2[0][2] + in1[1][2] * in2[1][2] +
|
||||||
in1[2][2] * in2[2][2];
|
in1[2][2] * in2[2][2];
|
||||||
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
|
out[2][3] = in1[0][2] * in2[0][3] + in1[1][2] * in2[1][3] +
|
||||||
in1[2][2] * in2[2][3];
|
in1[2][2] * in2[2][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -843,10 +843,6 @@ qboolean HLMDL_Trace (model_t *model, int hulloverride, framestate_t *framestat
|
||||||
qboolean startout, endout;
|
qboolean startout, endout;
|
||||||
int enterplane;
|
int enterplane;
|
||||||
|
|
||||||
extern cvar_t temp1;
|
|
||||||
p1[2] += temp1.value;
|
|
||||||
p2[2] += temp1.value;
|
|
||||||
|
|
||||||
memset (trace, 0, sizeof(trace_t));
|
memset (trace, 0, sizeof(trace_t));
|
||||||
trace->fraction = trace->truefraction = 1;
|
trace->fraction = trace->truefraction = 1;
|
||||||
if (!(against & FTECONTENTS_BODY))
|
if (!(against & FTECONTENTS_BODY))
|
||||||
|
@ -1288,9 +1284,15 @@ void HLMDL_DrawHitBoxes(entity_t *rent)
|
||||||
int bonecount = HLMDL_GetBoneData(rent->model, 0, MAX_BONES, &rent->framestate, relbones);
|
int bonecount = HLMDL_GetBoneData(rent->model, 0, MAX_BONES, &rent->framestate, relbones);
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
VectorCopy(rent->axis[0], entitymatrix[0]);
|
entitymatrix[0][0] = rent->axis[0][0];
|
||||||
VectorCopy(rent->axis[1], entitymatrix[1]);
|
entitymatrix[0][1] = rent->axis[1][0];
|
||||||
VectorCopy(rent->axis[2], entitymatrix[2]);
|
entitymatrix[0][2] = rent->axis[2][0];
|
||||||
|
entitymatrix[1][0] = rent->axis[0][1];
|
||||||
|
entitymatrix[1][1] = rent->axis[1][1];
|
||||||
|
entitymatrix[1][2] = rent->axis[2][1];
|
||||||
|
entitymatrix[2][0] = rent->axis[0][2];
|
||||||
|
entitymatrix[2][1] = rent->axis[1][2];
|
||||||
|
entitymatrix[2][2] = rent->axis[2][2];
|
||||||
entitymatrix[0][3] = rent->origin[0];
|
entitymatrix[0][3] = rent->origin[0];
|
||||||
entitymatrix[1][3] = rent->origin[1];
|
entitymatrix[1][3] = rent->origin[1];
|
||||||
entitymatrix[2][3] = rent->origin[2];
|
entitymatrix[2][3] = rent->origin[2];
|
||||||
|
|
Loading…
Reference in a new issue