From f9c6eacb8443473dca055122cb5a2f7430c43557 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 15 Jul 2012 07:30:17 +0900 Subject: [PATCH] Really fix sw32 renderer loading. It seems I never tested the sw32 renderer in a non-static build since I put in IQM support. --- libs/video/renderer/sw32/namehack.h | 1 + libs/video/renderer/sw32/sw32_ralias.c | 2 +- libs/video/renderer/sw32/sw32_riqm.c | 29 ++++++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/libs/video/renderer/sw32/namehack.h b/libs/video/renderer/sw32/namehack.h index 967b7484e..cbdb673ce 100644 --- a/libs/video/renderer/sw32/namehack.h +++ b/libs/video/renderer/sw32/namehack.h @@ -114,6 +114,7 @@ #define TransformVector sw32_TransformVector #define Turbulent sw32_Turbulent #define acolormap sw32_acolormap +#define aliastransform sw32_aliastransform #define aliasxcenter sw32_aliasxcenter #define aliasxscale sw32_aliasxscale #define aliasycenter sw32_aliasycenter diff --git a/libs/video/renderer/sw32/sw32_ralias.c b/libs/video/renderer/sw32/sw32_ralias.c index 95400d0d0..167730ab1 100644 --- a/libs/video/renderer/sw32/sw32_ralias.c +++ b/libs/video/renderer/sw32/sw32_ralias.c @@ -70,7 +70,7 @@ int sw32_r_amodels_drawn; static int a_skinwidth; static int r_anumverts; -static float sw32_aliastransform[3][4]; +float sw32_aliastransform[3][4]; typedef struct { int index0; diff --git a/libs/video/renderer/sw32/sw32_riqm.c b/libs/video/renderer/sw32/sw32_riqm.c index a7eb35cde..b53186bd9 100644 --- a/libs/video/renderer/sw32/sw32_riqm.c +++ b/libs/video/renderer/sw32/sw32_riqm.c @@ -93,13 +93,13 @@ R_IQMTransformAndProjectFinalVerts (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame) vec3_t tv, tn; Mat4MultVec (mat, position, tv); Mat4as3MultVec (mat, normal, tn); - zi = 1.0 / (DotProduct (tv, aliastransform[2]) - + aliastransform[2][3]); + zi = 1.0 / (DotProduct (tv, sw32_aliastransform[2]) + + sw32_aliastransform[2][3]); fv->v[5] = zi; - fv->v[0] = (DotProduct (tv, aliastransform[0]) - + aliastransform[0][3]) * zi + aliasxcenter; - fv->v[1] = (DotProduct (tv, aliastransform[1]) - + aliastransform[1][3]) * zi + aliasxcenter; + fv->v[0] = (DotProduct (tv, sw32_aliastransform[0]) + + sw32_aliastransform[0][3]) * zi + aliasxcenter; + fv->v[1] = (DotProduct (tv, sw32_aliastransform[1]) + + sw32_aliastransform[1][3]) * zi + aliasxcenter; fv->v[2] = texcoord[0]; fv->v[3] = texcoord[1]; fv->v[4] = calc_light (tn); @@ -157,9 +157,12 @@ R_IQMPreparePoints (iqm_t *iqm, swiqm_t *sw, iqmframe_t *frame) vec3_t tv, tn; Mat4MultVec (mat, position, tv); Mat4as3MultVec (mat, normal, tn); - av->fv[0] = DotProduct (tv, aliastransform[0]) + aliastransform[0][3]; - av->fv[1] = DotProduct (tv, aliastransform[1]) + aliastransform[1][3]; - av->fv[2] = DotProduct (tv, aliastransform[2]) + aliastransform[2][3]; + av->fv[0] = DotProduct (tv, sw32_aliastransform[0]) + + sw32_aliastransform[0][3]; + av->fv[1] = DotProduct (tv, sw32_aliastransform[1]) + + sw32_aliastransform[1][3]; + av->fv[2] = DotProduct (tv, sw32_aliastransform[2]) + + sw32_aliastransform[2][3]; fv->v[2] = texcoord[0]; fv->v[3] = texcoord[1]; fv->flags = 0; @@ -258,7 +261,7 @@ R_IQMSetUpTransform (int trivial_accept) // viewmatrix[1][3] = 0; // viewmatrix[2][3] = 0; - R_ConcatTransforms (viewmatrix, rotationmatrix, aliastransform); + R_ConcatTransforms (viewmatrix, rotationmatrix, sw32_aliastransform); // do the scaling up of x and y to screen coordinates as part of the transform // for the unclipped case (it would mess up clipping in the clipped case). @@ -268,11 +271,11 @@ R_IQMSetUpTransform (int trivial_accept) if (trivial_accept) { for (i = 0; i < 4; i++) { - aliastransform[0][i] *= aliasxscale * + sw32_aliastransform[0][i] *= aliasxscale * (1.0 / ((float) 0x8000 * 0x10000)); - aliastransform[1][i] *= aliasyscale * + sw32_aliastransform[1][i] *= aliasyscale * (1.0 / ((float) 0x8000 * 0x10000)); - aliastransform[2][i] *= 1.0 / ((float) 0x8000 * 0x10000); + sw32_aliastransform[2][i] *= 1.0 / ((float) 0x8000 * 0x10000); } } }