From: bones_was_here Date: Fri, 10 Jun 2022 03:48:46 +0000 (+1000) Subject: Fix GCC 11 warns: Matrix4x4_ToArray12FloatGL overflow X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3b39e7b15f0b707ed91c386388c6cec166ddc7fa;p=xonotic%2Fdarkplaces.git Fix GCC 11 warns: Matrix4x4_ToArray12FloatGL overflow Signed-off-by: bones_was_here --- diff --git a/matrixlib.c b/matrixlib.c index 2724ce6a..ed9d1413 100644 --- a/matrixlib.c +++ b/matrixlib.c @@ -1318,34 +1318,34 @@ void Matrix4x4_FromArrayFloatD3D (matrix4x4_t *out, const float in[16]) #endif } -void Matrix4x4_ToArray12FloatGL(const matrix4x4_t *in, float out[12]) +void Matrix4x4_ToArray12FloatGL(const matrix4x4_t *in, float out[4][3]) { #ifdef MATRIX4x4_OPENGLORIENTATION - out[ 0] = in->m[0][0]; - out[ 1] = in->m[0][1]; - out[ 2] = in->m[0][2]; - out[ 3] = in->m[1][0]; - out[ 4] = in->m[1][1]; - out[ 5] = in->m[1][2]; - out[ 6] = in->m[2][0]; - out[ 7] = in->m[2][1]; - out[ 8] = in->m[2][2]; - out[ 9] = in->m[3][0]; - out[10] = in->m[3][1]; - out[11] = in->m[3][2]; + out[0][0] = in->m[0][0]; + out[0][1] = in->m[0][1]; + out[0][2] = in->m[0][2]; + out[1][0] = in->m[1][0]; + out[1][1] = in->m[1][1]; + out[1][2] = in->m[1][2]; + out[2][0] = in->m[2][0]; + out[2][1] = in->m[2][1]; + out[2][2] = in->m[2][2]; + out[3][0] = in->m[3][0]; + out[3][1] = in->m[3][1]; + out[3][2] = in->m[3][2]; #else - out[ 0] = in->m[0][0]; - out[ 1] = in->m[1][0]; - out[ 2] = in->m[2][0]; - out[ 3] = in->m[0][1]; - out[ 4] = in->m[1][1]; - out[ 5] = in->m[2][1]; - out[ 6] = in->m[0][2]; - out[ 7] = in->m[1][2]; - out[ 8] = in->m[2][2]; - out[ 9] = in->m[0][3]; - out[10] = in->m[1][3]; - out[11] = in->m[2][3]; + out[0][0] = in->m[0][0]; + out[0][1] = in->m[1][0]; + out[0][2] = in->m[2][0]; + out[1][0] = in->m[0][1]; + out[1][1] = in->m[1][1]; + out[1][2] = in->m[2][1]; + out[2][0] = in->m[0][2]; + out[2][1] = in->m[1][2]; + out[2][2] = in->m[2][2]; + out[3][0] = in->m[0][3]; + out[3][1] = in->m[1][3]; + out[3][2] = in->m[2][3]; #endif } diff --git a/matrixlib.h b/matrixlib.h index f2e60e28..bfae8c47 100644 --- a/matrixlib.h +++ b/matrixlib.h @@ -105,7 +105,7 @@ void Matrix4x4_ToArrayFloatD3D(const matrix4x4_t *in, float out[16]); void Matrix4x4_FromArrayFloatD3D(matrix4x4_t *out, const float in[16]); // converts a matrix4x4 to a float[12] array in the OpenGL orientation -void Matrix4x4_ToArray12FloatGL(const matrix4x4_t *in, float out[12]); +void Matrix4x4_ToArray12FloatGL(const matrix4x4_t *in, float out[4][3]); // creates a matrix4x4 from a float[12] array in the OpenGL orientation void Matrix4x4_FromArray12FloatGL(matrix4x4_t *out, const float in[12]); // converts a matrix4x4 to a float[12] array in the Direct3D orientation diff --git a/model_shared.c b/model_shared.c index 8e707337..bcf683e3 100644 --- a/model_shared.c +++ b/model_shared.c @@ -3203,7 +3203,7 @@ static void Mod_Decompile_SMD(model_t *model, const char *filename, int firstpos // strangely the smd angles are for a transposed matrix, so we // have to generate a transposed matrix, then convert that... Matrix4x4_FromBonePose7s(&posematrix, model->num_posescale, model->data_poses7s + 7*(model->num_bones * poseindex + transformindex)); - Matrix4x4_ToArray12FloatGL(&posematrix, mtest[0]); + Matrix4x4_ToArray12FloatGL(&posematrix, mtest); AnglesFromVectors(angles, mtest[0], mtest[2], false); if (angles[0] >= 180) angles[0] -= 360; if (angles[1] >= 180) angles[1] -= 360;