mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-22 11:51:41 +00:00
New Fixed Point Matrix functions
This commit is contained in:
parent
e5518a1241
commit
d11fbe4504
6 changed files with 131 additions and 54 deletions
28
src/m_misc.c
28
src/m_misc.c
|
@ -2024,34 +2024,6 @@ TVector *VectorMatrixMultiply(TVector v, matrix_t m)
|
||||||
return &ret;
|
return &ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_t *RotateXMatrix(angle_t rad)
|
|
||||||
{
|
|
||||||
static matrix_t ret;
|
|
||||||
const angle_t fa = rad>>ANGLETOFINESHIFT;
|
|
||||||
const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
|
|
||||||
|
|
||||||
ret.m[0] = FRACUNIT; ret.m[1] = 0; ret.m[2] = 0; ret.m[3] = 0;
|
|
||||||
ret.m[4] = 0; ret.m[5] = cosrad; ret.m[6] = sinrad; ret.m[7] = 0;
|
|
||||||
ret.m[8] = 0; ret.m[9] = -sinrad; ret.m[10] = cosrad; ret.m[11] = 0;
|
|
||||||
ret.m[12] = 0; ret.m[13] = 0; ret.m[11] = 0; ret.m[12] = FRACUNIT;
|
|
||||||
|
|
||||||
return &ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
matrix_t *RotateZMatrix(angle_t rad)
|
|
||||||
{
|
|
||||||
static matrix_t ret;
|
|
||||||
const angle_t fa = rad>>ANGLETOFINESHIFT;
|
|
||||||
const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
|
|
||||||
|
|
||||||
ret.m[0] = cosrad; ret.m[1] = sinrad; ret.m[2] = 0; ret.m[3] = 0;
|
|
||||||
ret.m[4] = -sinrad; ret.m[5] = cosrad; ret.m[6] = 0; ret.m[7] = 0;
|
|
||||||
ret.m[8] = 0; ret.m[9] = 0; ret.m[10] = FRACUNIT; ret.m[11] = 0;
|
|
||||||
ret.m[12] = 0; ret.m[10] = 0; ret.m[11] = 0; ret.m[12] = FRACUNIT;
|
|
||||||
|
|
||||||
return &ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set of functions to take in a size_t as an argument,
|
/** Set of functions to take in a size_t as an argument,
|
||||||
* put the argument in a character buffer, and return the
|
* put the argument in a character buffer, and return the
|
||||||
* pointer to that buffer.
|
* pointer to that buffer.
|
||||||
|
|
|
@ -84,8 +84,6 @@ const char *GetRevisionString(void);
|
||||||
typedef fixed_t TVector[4];
|
typedef fixed_t TVector[4];
|
||||||
|
|
||||||
TVector *VectorMatrixMultiply(TVector v, matrix_t m);
|
TVector *VectorMatrixMultiply(TVector v, matrix_t m);
|
||||||
matrix_t *RotateXMatrix(angle_t rad);
|
|
||||||
matrix_t *RotateZMatrix(angle_t rad);
|
|
||||||
|
|
||||||
// s1 = s2+s3+s1 (1024 lenghtmax)
|
// s1 = s2+s3+s1 (1024 lenghtmax)
|
||||||
void strcatbf(char *s1, const char *s2, const char *s3);
|
void strcatbf(char *s1, const char *s2, const char *s3);
|
||||||
|
|
|
@ -1517,6 +1517,7 @@ void A_PointyThink(mobj_t *actor)
|
||||||
INT32 i;
|
INT32 i;
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
mobj_t *ball;
|
mobj_t *ball;
|
||||||
|
matrix_t m;
|
||||||
TVector v;
|
TVector v;
|
||||||
TVector *res;
|
TVector *res;
|
||||||
angle_t fa;
|
angle_t fa;
|
||||||
|
@ -1593,9 +1594,12 @@ void A_PointyThink(mobj_t *actor)
|
||||||
v[2] = FixedMul(FINESINE(fa),radius);
|
v[2] = FixedMul(FINESINE(fa),radius);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->lastlook+i)));
|
FM_RotateX(&m, FixedAngle(actor->lastlook+i));
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
res = VectorMatrixMultiply(v, *RotateZMatrix(actor->angle+ANGLE_180));
|
|
||||||
|
FM_RotateZ(&m, actor->angle+ANGLE_180);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
|
|
||||||
P_UnsetThingPosition(ball);
|
P_UnsetThingPosition(ball);
|
||||||
|
|
57
src/p_mobj.c
57
src/p_mobj.c
|
@ -6194,6 +6194,7 @@ static void P_MoveHoop(mobj_t *mobj)
|
||||||
{
|
{
|
||||||
const fixed_t fuse = (mobj->fuse*mobj->extravalue2);
|
const fixed_t fuse = (mobj->fuse*mobj->extravalue2);
|
||||||
const angle_t fa = mobj->movedir*(FINEANGLES/mobj->extravalue1);
|
const angle_t fa = mobj->movedir*(FINEANGLES/mobj->extravalue1);
|
||||||
|
matrix_t m;
|
||||||
TVector v;
|
TVector v;
|
||||||
TVector *res;
|
TVector *res;
|
||||||
fixed_t finalx, finaly, finalz;
|
fixed_t finalx, finaly, finalz;
|
||||||
|
@ -6213,9 +6214,12 @@ static void P_MoveHoop(mobj_t *mobj)
|
||||||
v[2] = FixedMul(FINESINE(fa),fuse);
|
v[2] = FixedMul(FINESINE(fa),fuse);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(mobj->target->movedir*FRACUNIT)));
|
FM_RotateX(&m, FixedAngle(mobj->target->movedir*FRACUNIT));
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
res = VectorMatrixMultiply(v, *RotateZMatrix(FixedAngle(mobj->target->movecount*FRACUNIT)));
|
|
||||||
|
FM_RotateZ(&m, FixedAngle(mobj->target->movecount*FRACUNIT));
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
|
|
||||||
finalx = x + v[0];
|
finalx = x + v[0];
|
||||||
|
@ -6233,6 +6237,7 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT
|
||||||
{
|
{
|
||||||
mobj_t *mobj;
|
mobj_t *mobj;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
matrix_t m;
|
||||||
TVector v;
|
TVector v;
|
||||||
TVector *res;
|
TVector *res;
|
||||||
fixed_t finalx, finaly, finalz;
|
fixed_t finalx, finaly, finalz;
|
||||||
|
@ -6281,9 +6286,12 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT
|
||||||
v[2] = FixedMul(FINESINE(fa),radius);
|
v[2] = FixedMul(FINESINE(fa),radius);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
|
FM_RotateX(&m, rotangle);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
|
||||||
|
FM_RotateZ(&m, closestangle);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
|
|
||||||
finalx = x + v[0];
|
finalx = x + v[0];
|
||||||
|
@ -6299,6 +6307,7 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
||||||
{
|
{
|
||||||
mobj_t *mobj;
|
mobj_t *mobj;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
matrix_t m;
|
||||||
TVector v;
|
TVector v;
|
||||||
TVector *res;
|
TVector *res;
|
||||||
fixed_t finalx, finaly, finalz, dist;
|
fixed_t finalx, finaly, finalz, dist;
|
||||||
|
@ -6320,9 +6329,12 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
||||||
v[2] = FixedMul(FINESINE(fa),radius);
|
v[2] = FixedMul(FINESINE(fa),radius);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
|
FM_RotateX(&m, rotangle);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
|
|
||||||
|
FM_RotateZ(&m, closestangle);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof (v));
|
M_Memcpy(&v, res, sizeof (v));
|
||||||
|
|
||||||
finalx = x + v[0];
|
finalx = x + v[0];
|
||||||
|
@ -6494,6 +6506,7 @@ static void P_NightsItemChase(mobj_t *thing)
|
||||||
//
|
//
|
||||||
void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
|
void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
|
||||||
{
|
{
|
||||||
|
matrix_t m;
|
||||||
TVector unit_lengthways, unit_sideways, pos_lengthways, pos_sideways;
|
TVector unit_lengthways, unit_sideways, pos_lengthways, pos_sideways;
|
||||||
TVector *res;
|
TVector *res;
|
||||||
fixed_t radius, dist, zstore;
|
fixed_t radius, dist, zstore;
|
||||||
|
@ -6564,9 +6577,12 @@ void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the angle matrixes for the link.
|
// Calculate the angle matrixes for the link.
|
||||||
res = VectorMatrixMultiply(unit_lengthways, *RotateXMatrix(center->threshold << ANGLETOFINESHIFT));
|
FM_RotateX(&m, center->threshold << ANGLETOFINESHIFT);
|
||||||
|
res = VectorMatrixMultiply(unit_lengthways, m);
|
||||||
M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
|
M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
|
||||||
res = VectorMatrixMultiply(unit_lengthways, *RotateZMatrix(center->angle));
|
|
||||||
|
FM_RotateZ(&m, center->angle);
|
||||||
|
res = VectorMatrixMultiply(unit_lengthways, m);
|
||||||
M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
|
M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
|
||||||
|
|
||||||
lastthreshold = mobj->threshold;
|
lastthreshold = mobj->threshold;
|
||||||
|
@ -6587,9 +6603,12 @@ void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
|
||||||
unit_sideways[0] = unit_sideways[2] = 0;
|
unit_sideways[0] = unit_sideways[2] = 0;
|
||||||
unit_sideways[3] = FRACUNIT;
|
unit_sideways[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(unit_sideways, *RotateXMatrix(center->threshold << ANGLETOFINESHIFT));
|
FM_RotateX(&m, center->threshold << ANGLETOFINESHIFT);
|
||||||
|
res = VectorMatrixMultiply(unit_sideways, m);
|
||||||
M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
|
M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
|
||||||
res = VectorMatrixMultiply(unit_sideways, *RotateZMatrix(center->angle));
|
|
||||||
|
FM_RotateZ(&m, center->angle);
|
||||||
|
res = VectorMatrixMultiply(unit_sideways, m);
|
||||||
M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
|
M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13260,7 +13279,7 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
||||||
mobj_t *mobj = NULL;
|
mobj_t *mobj = NULL;
|
||||||
mobj_t *nextmobj = NULL;
|
mobj_t *nextmobj = NULL;
|
||||||
mobj_t *hoopcenter;
|
mobj_t *hoopcenter;
|
||||||
matrix_t *pitchmatrix, *yawmatrix;
|
matrix_t pitchmatrix, yawmatrix;
|
||||||
fixed_t radius = hoopsize*sizefactor;
|
fixed_t radius = hoopsize*sizefactor;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
angle_t fa;
|
angle_t fa;
|
||||||
|
@ -13280,9 +13299,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
||||||
|
|
||||||
// Scale 0-255 to 0-359 =(
|
// Scale 0-255 to 0-359 =(
|
||||||
hoopcenter->movedir = ((mthing->angle & 255)*360)/256; // Pitch
|
hoopcenter->movedir = ((mthing->angle & 255)*360)/256; // Pitch
|
||||||
pitchmatrix = RotateXMatrix(FixedAngle(hoopcenter->movedir << FRACBITS));
|
FM_RotateX(&pitchmatrix, FixedAngle(hoopcenter->movedir << FRACBITS));
|
||||||
hoopcenter->movecount = (((UINT16)mthing->angle >> 8)*360)/256; // Yaw
|
hoopcenter->movecount = (((UINT16)mthing->angle >> 8)*360)/256; // Yaw
|
||||||
yawmatrix = RotateZMatrix(FixedAngle(hoopcenter->movecount << FRACBITS));
|
FM_RotateZ(&yawmatrix, FixedAngle(hoopcenter->movecount << FRACBITS));
|
||||||
|
|
||||||
// For the hoop when it flies away
|
// For the hoop when it flies away
|
||||||
hoopcenter->extravalue1 = hoopsize;
|
hoopcenter->extravalue1 = hoopsize;
|
||||||
|
@ -13297,9 +13316,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
||||||
v[2] = FixedMul(FINESINE(fa), radius);
|
v[2] = FixedMul(FINESINE(fa), radius);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *pitchmatrix);
|
res = VectorMatrixMultiply(v, pitchmatrix);
|
||||||
M_Memcpy(&v, res, sizeof(v));
|
M_Memcpy(&v, res, sizeof(v));
|
||||||
res = VectorMatrixMultiply(v, *yawmatrix);
|
res = VectorMatrixMultiply(v, yawmatrix);
|
||||||
M_Memcpy(&v, res, sizeof(v));
|
M_Memcpy(&v, res, sizeof(v));
|
||||||
|
|
||||||
mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOP);
|
mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOP);
|
||||||
|
@ -13343,9 +13362,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
|
||||||
v[2] = FixedMul(FINESINE(fa), radius);
|
v[2] = FixedMul(FINESINE(fa), radius);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *pitchmatrix);
|
res = VectorMatrixMultiply(v, pitchmatrix);
|
||||||
M_Memcpy(&v, res, sizeof(v));
|
M_Memcpy(&v, res, sizeof(v));
|
||||||
res = VectorMatrixMultiply(v, *yawmatrix);
|
res = VectorMatrixMultiply(v, yawmatrix);
|
||||||
M_Memcpy(&v, res, sizeof(v));
|
M_Memcpy(&v, res, sizeof(v));
|
||||||
|
|
||||||
mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOPCOLLIDE);
|
mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOPCOLLIDE);
|
||||||
|
@ -13452,6 +13471,7 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
|
||||||
angle_t angle = FixedAngle(mthing->angle << FRACBITS);
|
angle_t angle = FixedAngle(mthing->angle << FRACBITS);
|
||||||
angle_t fa;
|
angle_t fa;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
matrix_t m;
|
||||||
TVector v, *res;
|
TVector v, *res;
|
||||||
|
|
||||||
for (i = 0; i < numitemtypes; i++)
|
for (i = 0; i < numitemtypes; i++)
|
||||||
|
@ -13485,7 +13505,8 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
|
||||||
v[2] = FixedMul(FINESINE(fa), size);
|
v[2] = FixedMul(FINESINE(fa), size);
|
||||||
v[3] = FRACUNIT;
|
v[3] = FRACUNIT;
|
||||||
|
|
||||||
res = VectorMatrixMultiply(v, *RotateZMatrix(angle));
|
FM_RotateZ(&m, angle);
|
||||||
|
res = VectorMatrixMultiply(v, m);
|
||||||
M_Memcpy(&v, res, sizeof(v));
|
M_Memcpy(&v, res, sizeof(v));
|
||||||
|
|
||||||
mobj = P_SpawnMobjFromMapThing(&dummything, x + v[0], y + v[1], z + v[2], itemtype);
|
mobj = P_SpawnMobjFromMapThing(&dummything, x + v[0], y + v[1], z + v[2], itemtype);
|
||||||
|
|
85
src/tables.c
85
src/tables.c
|
@ -407,9 +407,9 @@ void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle
|
||||||
rotVec->z = az+dz+ez;
|
rotVec->z = az+dz+ez;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
|
|
||||||
{
|
|
||||||
#define M(row,col) dest->m[row * 4 + col]
|
#define M(row,col) dest->m[row * 4 + col]
|
||||||
|
matrix_t *FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
|
||||||
|
{
|
||||||
const fixed_t sinA = FINESINE(angle>>ANGLETOFINESHIFT);
|
const fixed_t sinA = FINESINE(angle>>ANGLETOFINESHIFT);
|
||||||
const fixed_t cosA = FINECOSINE(angle>>ANGLETOFINESHIFT);
|
const fixed_t cosA = FINECOSINE(angle>>ANGLETOFINESHIFT);
|
||||||
const fixed_t invCosA = FRACUNIT - cosA;
|
const fixed_t invCosA = FRACUNIT - cosA;
|
||||||
|
@ -459,5 +459,84 @@ void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
|
||||||
M(1, 3) = 0;
|
M(1, 3) = 0;
|
||||||
M(2, 3) = 0;
|
M(2, 3) = 0;
|
||||||
M(3, 3) = FRACUNIT;
|
M(3, 3) = FRACUNIT;
|
||||||
#undef M
|
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
matrix_t *FM_RotateX(matrix_t *dest, angle_t rad)
|
||||||
|
{
|
||||||
|
const angle_t fa = rad>>ANGLETOFINESHIFT;
|
||||||
|
const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
|
||||||
|
|
||||||
|
M(0, 0) = FRACUNIT;
|
||||||
|
M(0, 1) = 0;
|
||||||
|
M(0, 2) = 0;
|
||||||
|
M(0, 3) = 0;
|
||||||
|
M(1, 0) = 0;
|
||||||
|
M(1, 1) = cosrad;
|
||||||
|
M(1, 2) = sinrad;
|
||||||
|
M(1, 3) = 0;
|
||||||
|
M(2, 0) = 0;
|
||||||
|
M(2, 1) = -sinrad;
|
||||||
|
M(2, 2) = cosrad;
|
||||||
|
M(2, 3) = 0;
|
||||||
|
M(3, 0) = 0;
|
||||||
|
M(3, 1) = 0;
|
||||||
|
M(3, 2) = 0;
|
||||||
|
M(3, 3) = FRACUNIT;
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_t *FM_RotateY(matrix_t *dest, angle_t rad)
|
||||||
|
{
|
||||||
|
const angle_t fa = rad>>ANGLETOFINESHIFT;
|
||||||
|
const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
|
||||||
|
|
||||||
|
M(0, 0) = cosrad;
|
||||||
|
M(0, 1) = 0;
|
||||||
|
M(0, 2) = -sinrad;
|
||||||
|
M(0, 3) = 0;
|
||||||
|
M(1, 0) = 0;
|
||||||
|
M(1, 1) = FRACUNIT;
|
||||||
|
M(1, 2) = 0;
|
||||||
|
M(1, 3) = 0;
|
||||||
|
M(2, 0) = sinrad;
|
||||||
|
M(2, 1) = 0;
|
||||||
|
M(2, 2) = cosrad;
|
||||||
|
M(2, 3) = 0;
|
||||||
|
M(3, 0) = 0;
|
||||||
|
M(3, 1) = 0;
|
||||||
|
M(3, 2) = 0;
|
||||||
|
M(3, 3) = FRACUNIT;
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_t *FM_RotateZ(matrix_t *dest, angle_t rad)
|
||||||
|
{
|
||||||
|
const angle_t fa = rad>>ANGLETOFINESHIFT;
|
||||||
|
const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
|
||||||
|
|
||||||
|
M(0, 0) = cosrad;
|
||||||
|
M(0, 1) = sinrad;
|
||||||
|
M(0, 2) = 0;
|
||||||
|
M(0, 3) = 0;
|
||||||
|
M(1, 0) = -sinrad;
|
||||||
|
M(1, 1) = cosrad;
|
||||||
|
M(1, 2) = 0;
|
||||||
|
M(1, 3) = 0;
|
||||||
|
M(2, 0) = 0;
|
||||||
|
M(2, 1) = 0;
|
||||||
|
M(2, 2) = FRACUNIT;
|
||||||
|
M(2, 3) = 0;
|
||||||
|
M(3, 0) = 0;
|
||||||
|
M(3, 1) = 0;
|
||||||
|
M(3, 2) = 0;
|
||||||
|
M(3, 3) = FRACUNIT;
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef M
|
||||||
|
|
|
@ -107,7 +107,10 @@ boolean FV3_InsidePolygon(const vector3_t *vIntersection, const vector3_t *Poly,
|
||||||
boolean FV3_IntersectedPolygon(const vector3_t *vPoly, const vector3_t *vLine, const INT32 vertexCount, vector3_t *collisionPoint);
|
boolean FV3_IntersectedPolygon(const vector3_t *vPoly, const vector3_t *vLine, const INT32 vertexCount, vector3_t *collisionPoint);
|
||||||
void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle);
|
void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle);
|
||||||
/// Fixed Point Matrix functions
|
/// Fixed Point Matrix functions
|
||||||
void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
|
matrix_t *FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
|
||||||
|
matrix_t *FM_RotateX(matrix_t *dest, angle_t rad);
|
||||||
|
matrix_t *FM_RotateY(matrix_t *dest, angle_t rad);
|
||||||
|
matrix_t *FM_RotateZ(matrix_t *dest, angle_t rad);
|
||||||
|
|
||||||
// The table values in tables.c are calculated with this many fractional bits.
|
// The table values in tables.c are calculated with this many fractional bits.
|
||||||
#define FINE_FRACBITS 16
|
#define FINE_FRACBITS 16
|
||||||
|
|
Loading…
Reference in a new issue