Browse Source

ref_soft: Remove R_ConcatTransform, try fix transparent bmodels origin

pull/2/head
mittorn 6 years ago
parent
commit
6879c1f097
  1. 33
      r_bsp.c
  2. 7
      r_local.h
  3. 65
      r_main.c
  4. 5
      r_poly.c
  5. 6
      r_trialias.c

33
r_bsp.c

@ -48,6 +48,35 @@ static mvertex_t *pfrontenter, *pfrontexit; @@ -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) @@ -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) @@ -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) @@ -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 ; i<numsurfaces ; i++, psurf++)
{

7
r_local.h

@ -1308,11 +1308,6 @@ void D_FlushCaches( qboolean newmap ); @@ -1308,11 +1308,6 @@ void D_FlushCaches( qboolean newmap );
//
void Draw_Fill (int x, int y, int w, int h, int c);
//
// r_main.c
//
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
//
// r_misc.c
//
@ -1329,8 +1324,6 @@ void R_RenderFace (msurface_t *fa, int clipflags); @@ -1329,8 +1324,6 @@ void R_RenderFace (msurface_t *fa, int clipflags);
//
// r_main.c
//
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void R_RenderTriangle( finalvert_t *fv1 , finalvert_t *fv2, finalvert_t *fv3 );
void R_SetupFinalVert( finalvert_t *fv, float x, float y, float z, int light, int s, int t );

65
r_main.c

@ -139,68 +139,6 @@ int r_numallocatededges; @@ -139,68 +139,6 @@ int r_numallocatededges;
float r_aliasuvscale = 1.0;
/*
================
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];
}
/*
================
R_ConcatTransforms
================
*/
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
{
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[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
in1[0][2] * in2[2][3] + in1[0][3];
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[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
in1[1][2] * in2[2][3] + in1[1][3];
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];
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
in1[2][2] * in2[2][3] + in1[2][3];
}
static int R_RankForRenderMode( int rendermode )
{
switch( rendermode )
@ -1743,6 +1681,9 @@ void R_BeginFrame( qboolean clearScene ) @@ -1743,6 +1681,9 @@ void R_BeginFrame( qboolean clearScene )
// GL_RebuildLightmaps();
D_FlushCaches( false );
//glConfig.softwareGammaUpdate = false;
// next frame will be restored gamma
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
ClearBits( vid_gamma->flags, FCVAR_CHANGED );
}
R_Set2DMode( true );

5
r_poly.c

@ -1057,13 +1057,14 @@ void R_BuildPolygonFromSurface(msurface_t *fa) @@ -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 )

6
r_trialias.c

@ -122,7 +122,8 @@ void R_SetUpWorldTransform (void) @@ -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) @@ -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];

Loading…
Cancel
Save