diff --git a/r_bsp.c b/r_bsp.c index cdb8d6db..683e766a 100644 --- a/r_bsp.c +++ b/r_bsp.c @@ -48,6 +48,35 @@ static mvertex_t *pfrontenter, *pfrontexit; static qboolean makeclippededge; + +/* +================ +R_ConcatRotations +================ +*/ +void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]) +{ + out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + + in1[0][2] * in2[2][0]; + out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + + in1[0][2] * in2[2][1]; + out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + + in1[0][2] * in2[2][2]; + out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + + in1[1][2] * in2[2][0]; + out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + + in1[1][2] * in2[2][1]; + out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + + in1[1][2] * in2[2][2]; + out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + + in1[2][2] * in2[2][0]; + out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + + in1[2][2] * in2[2][1]; + out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + + in1[2][2] * in2[2][2]; +} + + //=========================================================================== /* @@ -952,7 +981,7 @@ void R_DrawBrushModel(cl_entity_t *pent) if (pmodel->nummodelsurfaces == 0) return; // clip brush only -#if 0 +#if 1 // FIXME: use bounding-box-based frustum clipping info? RotatedBBox (pmodel->mins, pmodel->maxs, RI.currententity->angles, mins, maxs); @@ -969,6 +998,7 @@ void R_DrawBrushModel(cl_entity_t *pent) VectorCopy (RI.currententity->origin, r_entorigin); VectorSubtract (r_origin, r_entorigin, modelorg); //VectorSubtract (r_origin, RI.currententity->origin, modelorg); + r_pcurrentvertbase = pmodel->vertexes; // calculate dynamic lighting for bmodel @@ -989,6 +1019,7 @@ void R_DrawBrushModel(cl_entity_t *pent) #endif psurf = &pmodel->surfaces[pmodel->firstmodelsurface]; numsurfaces = pmodel->nummodelsurfaces; + //R_TransformFrustum (); for (i=0 ; iflags, FCVAR_CHANGED ); + ClearBits( vid_gamma->flags, FCVAR_CHANGED ); } R_Set2DMode( true ); diff --git a/r_poly.c b/r_poly.c index 1a4264a1..0c7a1f9b 100644 --- a/r_poly.c +++ b/r_poly.c @@ -1057,13 +1057,14 @@ void R_BuildPolygonFromSurface(msurface_t *fa) vec = RI.currentmodel->vertexes[r_pedge->v[1]].position; } - VectorCopy (vec, pverts[i] ); + VectorAdd (vec, r_entorigin, pverts[i] ); + //VectorCopy( vec, pverts[i] ); } VectorCopy( fa->texinfo->vecs[0], r_polydesc.vright ); VectorCopy( fa->texinfo->vecs[1], r_polydesc.vup ); VectorCopy( fa->plane->normal, r_polydesc.vpn ); - VectorCopy( r_origin, r_polydesc.viewer_position ); + VectorCopy( modelorg, r_polydesc.viewer_position ); if ( fa->flags & SURF_PLANEBACK ) diff --git a/r_trialias.c b/r_trialias.c index 88989cb4..ab74ffae 100644 --- a/r_trialias.c +++ b/r_trialias.c @@ -122,7 +122,8 @@ void R_SetUpWorldTransform (void) // memcpy( aliasworldtransform, rotationmatrix, sizeof( aliastransform ) ); - R_ConcatTransforms (viewmatrix, aliasworldtransform, aliastransform); + //R_ConcatTransforms (viewmatrix, aliasworldtransform, aliastransform); + Matrix3x4_ConcatTransforms(aliastransform, viewmatrix, aliasworldtransform ); aliasworldtransform[0][3] = 0; aliasworldtransform[1][3] = 0; @@ -194,7 +195,8 @@ void R_AliasSetUpTransform (void) // memcpy( aliasworldtransform, rotationmatrix, sizeof( aliastransform ) ); - R_ConcatTransforms (viewmatrix, aliasworldtransform, aliastransform); + //R_ConcatTransforms (viewmatrix, aliasworldtransform, aliastransform); + Matrix3x4_ConcatTransforms(aliastransform, viewmatrix, aliasworldtransform ); aliasworldtransform[0][3] = RI.currententity->origin[0]; aliasworldtransform[1][3] = RI.currententity->origin[1];