does the sw renderer work any better now?

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@910 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-03-20 19:41:41 +00:00
parent bf6b09ebfd
commit 57b89d3d3e
10 changed files with 332 additions and 151 deletions

View File

@ -1620,7 +1620,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
ent.flags = renderfx | Q2RF_TRANSLUCENT;
ent.alpha = 0.30;
ent.fatness = 1;
#ifdef Q3SHADERS
#ifdef Q3SHADERS //fixme: do better.
//fixme: this is woefully gl specific. :(
ent.shaderRGBA[0] = (!!(renderfx & Q2RF_SHELL_RED)) * 255;
ent.shaderRGBA[1] = (!!(renderfx & Q2RF_SHELL_GREEN)) * 255;
@ -1630,7 +1630,9 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
#endif
V_AddLerpEntity (&ent);
}
#ifdef Q3SHADERS
ent.forcedshader = NULL;
#endif
// ent.skin = NULL; // never use a custom skin on others
ent.skinnum = 0;
@ -1865,6 +1867,7 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
if (ps->fov > 90)
return;
//generate root matrix..
view = &cl.viewent[0];
VectorCopy(cl.simorg[0], view->origin);
AngleVectors(cl.simangles[0], view->axis[0], view->axis[1], view->axis[2]);
@ -1887,10 +1890,10 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
// set up gun position
for (i=0 ; i<3 ; i++)
{
gun.origin[i] = ops->gunoffset[i]
+ cl.lerpfrac * (ps->gunoffset[i] - ops->gunoffset[i]);
gun.angles[i] = LerpAngle (ops->gunangles[i],
ps->gunangles[i], cl.lerpfrac);
gun.origin[i] = 0;//ops->gunoffset[i]
// + cl.lerpfrac * (ps->gunoffset[i] - ops->gunoffset[i]);
gun.angles[i] = 0;//LerpAngle (ops->gunangles[i],
// ps->gunangles[i], cl.lerpfrac);
}
gun.angles[0]*=-1;
@ -1911,7 +1914,7 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
gun.flags = Q2RF_MINLIGHT | Q2RF_DEPTHHACK | Q2RF_WEAPONMODEL;
gun.lerptime = 1.0 - cl.lerpfrac;
VectorCopy (gun.origin, gun.oldorigin); // don't lerp at all
V_AddLerpEntity (&gun);
V_AddEntity (&gun);
#endif
}

View File

@ -1373,7 +1373,10 @@ void CMod_LoadFaces (lump_t *l)
out->extents[i] = 16384;
out->texturemins[i] = -8192;
}
GL_SubdivideSurface (out, 64); // cut up polygon for warps
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
GL_SubdivideSurface (out, 64); // cut up polygon for warps
#endif
}
}

View File

@ -106,7 +106,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /G5 /ML /W3 /Gm- /Gi- /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /Yu"quakedef.h" /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c
# SUBTRACT CPP /X
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@ -7997,6 +7997,8 @@ SOURCE=..\server\sv_sys_win.c
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# ADD CPP /Yu"qwsvdef.h"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
# PROP BASE Exclude_From_Build 1
@ -8052,6 +8054,8 @@ SOURCE=..\server\svmodel.c
!ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server"
# ADD CPP /Yu"qwsvdef.h"
!ELSEIF "$(CFG)" == "ftequake - Win32 MinSW"
# PROP BASE Exclude_From_Build 1

View File

@ -138,7 +138,8 @@ void SWD_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
void D_DisableBackBufferAccess (void);
void GLD_EndDirectRect (int x, int y, int width, int height);
void SWD_EndDirectRect (int x, int y, int width, int height);
void D_PolysetDraw (void);
void D_PolysetDrawAsm (void);
void D_PolysetDrawC (void); //C version supports transparency
void D_PolysetDraw16 (void);
void D_PolysetDraw32 (void);
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);

View File

@ -56,7 +56,7 @@ lzistepx: .long 0
#ifndef NeXT
.extern C(D_PolysetSetEdgeTable)
.extern C(D_RasterizeAliasPolySmooth8)
.extern C(D_RasterizeAliasPolySmooth8Asm)
#endif
//----------------------------------------------------------------------
@ -1083,8 +1083,8 @@ C(D_Aff8Patch):
// triangle drawing code
//----------------------------------------------------------------------
.globl C(D_PolysetDraw)
C(D_PolysetDraw):
.globl C(D_PolysetDrawAsm)
C(D_PolysetDrawAsm):
// spanpackage_t spans[DPS_MAXSPANS + 1 +
// ((CACHE_SIZE - 1) / sizeof(spanpackage_t)) + 1];
@ -1727,9 +1727,9 @@ LFacesFront:
fstps C(d_xdenom)
// D_PolysetSetEdgeTable ();
// D_RasterizeAliasPolySmooth8 ();
// D_RasterizeAliasPolySmooth8Asm ();
call C(D_PolysetSetEdgeTable)
call C(D_RasterizeAliasPolySmooth8)
call C(D_RasterizeAliasPolySmooth8Asm)
LNextTri:
movl C(r_affinetridesc)+atd_ptriangles,%esi

View File

@ -129,12 +129,15 @@ void D_PolysetDrawSpans8 (spanpackage_t *pspanpackage);
void D_PolysetCalcGradients (int skinwidth);
void D_PolysetCalcGradients32 (int skinwidth);
void D_DrawSubdiv (void);
void D_DrawSubdiv32 (void);
void D_DrawSubdivC (void);
void D_DrawSubdiv32C (void);
void D_DrawNonSubdiv (void);
void D_DrawNonSubdiv32 (void);
void D_DrawNonSubdivC (void);
void D_DrawNonSubdiv32C (void);
void D_PolysetRecursiveTriangle (int *p1, int *p2, int *p3);
void D_PolysetSetEdgeTable (void);
void D_RasterizeAliasPolySmooth8 (void);
void D_RasterizeAliasPolySmooth8Asm (void);
void D_RasterizeAliasPolySmooth8C (void);
void D_PolysetScanLeftEdgeC (int height);
void D_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
@ -629,7 +632,7 @@ void D_PolysetDrawSpans8Trans (spanpackage_t *pspanpackage)
return;
}
if (d_aspancount<0||ubasestep<0)
if (d_aspancount<0)
return;
do
@ -942,7 +945,7 @@ void D_PolysetFillSpans8Trans (spanpackage_t *pspanpackage)
void D_RasterizeAliasPolySmoothTrans (void)
void D_RasterizeAliasPolySmoothC (void)
{
int initialleftheight, initialrightheight;
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
@ -1167,11 +1170,11 @@ void D_PolysetDraw32 (void)
if (r_affinetridesc.drawtype)
{
D_DrawSubdiv32 ();
D_DrawSubdiv32C ();
}
else
{
D_DrawNonSubdiv32 ();
D_DrawNonSubdiv32C ();
}
}
@ -1196,14 +1199,12 @@ void D_PolysetDraw16 (void)
}
#if !id386
/*
================
D_PolysetDraw
================
*/
void D_PolysetDraw (void)
void D_PolysetDrawC (void)
{
spanpackage_t spans[DPS_MAXSPANS + 1 +
((CACHE_SIZE - 1) / sizeof(spanpackage_t)) + 1];
@ -1214,11 +1215,11 @@ void D_PolysetDraw (void)
if (r_affinetridesc.drawtype)
{
D_DrawSubdiv ();
D_DrawSubdivC ();
}
else
{
D_DrawNonSubdiv ();
D_DrawNonSubdivC ();
}
}
@ -1228,7 +1229,7 @@ void D_PolysetDraw (void)
D_PolysetDrawFinalVerts
================
*/
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
void D_PolysetDrawFinalVertsC (finalvert_t *fv, int numverts)
{
int i, z;
short *zbuf;
@ -1261,7 +1262,7 @@ void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
D_DrawSubdiv
================
*/
void D_DrawSubdiv (void)
void D_DrawSubdivC (void)
{
mtriangle_t *ptri;
finalvert_t *pfv, *index0, *index1, *index2;
@ -1348,8 +1349,8 @@ void D_DrawSubdiv (void)
D_PolysetRecursiveTriangle(index0->v, index1->v, index2->v);
}
}
#endif
void D_DrawSubdiv32 (void)
void D_DrawSubdiv32C (void)
{
mtriangle_t *ptri;
finalvert_t *pfv, *index0, *index1, *index2;
@ -1395,13 +1396,12 @@ void D_DrawSubdiv32 (void)
}
}
#if !id386
/*
================
D_DrawNonSubdiv
================
*/
void D_DrawNonSubdiv (void)
void D_DrawNonSubdivC (void)
{
mtriangle_t *ptri;
finalvert_t *pfv, *index0, *index1, *index2;
@ -1415,62 +1415,9 @@ void D_DrawNonSubdiv (void)
ptri = r_affinetridesc.ptriangles;
lnumtriangles = r_affinetridesc.numtriangles;
#ifdef PEXT_TRANS
if (currententity->alpha != 1)
{
Set_TransLevelF(currententity->alpha);
if (!(t_state & TT_ONE))
{
if (t_state & TT_ZERO)
return;
for (i=0 ; i<lnumtriangles ; i++, ptri++)
{
index0 = pfv + ptri->xyz_index[0];
index1 = pfv + ptri->xyz_index[1];
index2 = pfv + ptri->xyz_index[2];
d_xdenom = (index0->v[1]-index1->v[1]) *
(index0->v[0]-index2->v[0]) -
(index0->v[0]-index1->v[0])*(index0->v[1]-index2->v[1]);
if (d_xdenom >= 0)
{
continue;
}
st0 = pst + ptri->st_index[0];
st1 = pst + ptri->st_index[1];
st2 = pst + ptri->st_index[2];
r_p0[0] = index0->v[0]; // u
r_p0[1] = index0->v[1]; // v
r_p0[2] = st0->s; // s
r_p0[3] = st0->t; // t
r_p0[4] = index0->v[4]; // light
r_p0[5] = index0->v[5]; // iz
r_p1[0] = index1->v[0];
r_p1[1] = index1->v[1];
r_p1[2] = st1->s;
r_p1[3] = st1->t;
r_p1[4] = index1->v[4];
r_p1[5] = index1->v[5];
r_p2[0] = index2->v[0];
r_p2[1] = index2->v[1];
r_p2[2] = st2->s;
r_p2[3] = st2->t;
r_p2[4] = index2->v[4];
r_p2[5] = index2->v[5];
D_PolysetSetEdgeTable ();
D_RasterizeAliasPolySmoothTrans ();
}
return;
}
}
#endif
Set_TransLevelF(currententity->alpha);
if (t_state & TT_ZERO)
return;
for (i=0 ; i<lnumtriangles ; i++, ptri++)
{
@ -1493,8 +1440,8 @@ void D_DrawNonSubdiv (void)
r_p0[0] = index0->v[0]; // u
r_p0[1] = index0->v[1]; // v
r_p0[2] = st0->s; // s
r_p0[3] = st0->t; // t
r_p0[2] = st0->s; // s
r_p0[3] = st0->t; // t
r_p0[4] = index0->v[4]; // light
r_p0[5] = index0->v[5]; // iz
@ -1513,12 +1460,11 @@ void D_DrawNonSubdiv (void)
r_p2[5] = index2->v[5];
D_PolysetSetEdgeTable ();
D_RasterizeAliasPolySmooth8 ();
D_RasterizeAliasPolySmoothC ();
}
}
#endif
void D_DrawNonSubdiv32 (void)
void D_DrawNonSubdiv32C (void)
{
mtriangle_t *ptri;
finalvert_t *pfv, *index0, *index1, *index2;
@ -1596,7 +1542,7 @@ void D_DrawNonSubdiv32 (void)
#endif
D_PolysetSetEdgeTable ();
D_RasterizeAliasPolySmoothTrans ();
D_RasterizeAliasPolySmoothC ();
}
}
@ -1820,7 +1766,7 @@ void D_PolysetSetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
D_PolysetCalcGradients
================
*/
void D_PolysetCalcGradients (int skinwidth)
void D_PolysetCalcGradientsAsm (int skinwidth)
{
float xstepdenominv, ystepdenominv, t0, t1;
float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
@ -2060,7 +2006,8 @@ void D_PolysetFillSpans8 (spanpackage_t *pspanpackage)
D_RasterizeAliasPolySmooth
================
*/
void D_RasterizeAliasPolySmooth8 (void)
#if id386
void D_RasterizeAliasPolySmooth8Asm (void)
{
int initialleftheight, initialrightheight;
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
@ -2104,17 +2051,17 @@ void D_RasterizeAliasPolySmooth8 (void)
d_ptex = (qbyte *)r_affinetridesc.pskin + (plefttop[2] >> 16) +
(plefttop[3] >> 16) * r_affinetridesc.skinwidth;
#if id386
//#if id386
d_sfrac = (plefttop[2] & 0xFFFF) << 16;
d_tfrac = (plefttop[3] & 0xFFFF) << 16;
d_pzbasestep = (d_zwidth + ubasestep) << 1;
d_pzextrastep = d_pzbasestep + 2;
#else
d_sfrac = plefttop[2] & 0xFFFF;
d_tfrac = plefttop[3] & 0xFFFF;
d_pzbasestep = d_zwidth + ubasestep;
d_pzextrastep = d_pzbasestep + 1;
#endif
//#else
// d_sfrac = plefttop[2] & 0xFFFF;
// d_tfrac = plefttop[3] & 0xFFFF;
// d_pzbasestep = d_zwidth + ubasestep;
// d_pzextrastep = d_pzbasestep + 1;
//#endif
d_light = plefttop[4];
d_zi = plefttop[5];
@ -2138,26 +2085,26 @@ void D_RasterizeAliasPolySmooth8 (void)
d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
((r_tstepy + r_tstepx * ubasestep) >> 16) *
r_affinetridesc.skinwidth;
#if id386
//#if id386
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) << 16;
#else
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
#endif
//#else
// d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
// d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
//#endif
d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
d_zibasestep = r_zistepy + r_zistepx * ubasestep;
d_ptexextrastep = ((r_sstepy + r_sstepx * d_countextrastep) >> 16) +
((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
r_affinetridesc.skinwidth;
#if id386
//#if id386
d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) << 16;
d_tfracextrastep = (r_tstepy + r_tstepx*d_countextrastep) << 16;
#else
d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) & 0xFFFF;
d_tfracextrastep = (r_tstepy + r_tstepx*d_countextrastep) & 0xFFFF;
#endif
//#else
// d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) & 0xFFFF;
// d_tfracextrastep = (r_tstepy + r_tstepx*d_countextrastep) & 0xFFFF;
//#endif
d_lightextrastep = d_lightbasestep + working_lstepx;
d_ziextrastep = d_zibasestep + r_zistepx;
@ -2192,13 +2139,13 @@ void D_RasterizeAliasPolySmooth8 (void)
d_pdestbasestep = (screenwidth + ubasestep)*r_pixbytes;
d_pdestextrastep = d_pdestbasestep + r_pixbytes;
d_pdest = (qbyte *)d_viewbuffer + (ystart * screenwidth + plefttop[0])*r_pixbytes;
#if id386
//#if id386
d_pzbasestep = (d_zwidth + ubasestep) << 1;
d_pzextrastep = d_pzbasestep + 2;
#else
d_pzbasestep = d_zwidth + ubasestep;
d_pzextrastep = d_pzbasestep + 1;
#endif
//#else
// d_pzbasestep = d_zwidth + ubasestep;
// d_pzextrastep = d_pzbasestep + 1;
//#endif
d_pz = d_pzbuffer + ystart * d_zwidth + plefttop[0];
if (ubasestep < 0)
@ -2210,26 +2157,240 @@ void D_RasterizeAliasPolySmooth8 (void)
d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
((r_tstepy + r_tstepx * ubasestep) >> 16) *
r_affinetridesc.skinwidth;
#if id386
//#if id386
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) << 16;
#else
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
#endif
//#else
// d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
// d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
//#endif
d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
d_zibasestep = r_zistepy + r_zistepx * ubasestep;
d_ptexextrastep = ((r_sstepy + r_sstepx * d_countextrastep) >> 16) +
((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
r_affinetridesc.skinwidth;
#if id386
//#if id386
d_sfracextrastep = ((r_sstepy+r_sstepx*d_countextrastep) & 0xFFFF)<<16;
d_tfracextrastep = ((r_tstepy+r_tstepx*d_countextrastep) & 0xFFFF)<<16;
#else
//#else
// d_sfracextrastep = (r_sstepy+r_sstepx*d_countextrastep) & 0xFFFF;
// d_tfracextrastep = (r_tstepy+r_tstepx*d_countextrastep) & 0xFFFF;
//#endif
d_lightextrastep = d_lightbasestep + working_lstepx;
d_ziextrastep = d_zibasestep + r_zistepx;
D_PolysetScanLeftEdge (height);
}
// scan out the top (and possibly only) part of the right edge, updating the
// count field
d_pedgespanpackage = a_spans;
D_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
prightbottom[0], prightbottom[1]);
d_aspancount = 0;
d_countextrastep = ubasestep + 1;
originalcount = a_spans[initialrightheight].count;
a_spans[initialrightheight].count = -999999; // mark end of the spanpackages
DrawSpans (a_spans);
// scan out the bottom part of the right edge, if it exists
if (pedgetable->numrightedges == 2)
{
int height;
spanpackage_t *pstart;
pstart = a_spans + initialrightheight;
pstart->count = originalcount;
d_aspancount = prightbottom[0] - prighttop[0];
prighttop = prightbottom;
prightbottom = pedgetable->prightedgevert2;
height = prightbottom[1] - prighttop[1];
D_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
prightbottom[0], prightbottom[1]);
d_countextrastep = ubasestep + 1;
a_spans[initialrightheight + height].count = -999999;
// mark end of the spanpackages
DrawSpans (pstart);
}
}
#endif
void D_RasterizeAliasPolySmooth8C (void)
{
int initialleftheight, initialrightheight;
int *plefttop, *prighttop, *pleftbottom, *prightbottom;
int working_lstepx, originalcount;
void (*DrawSpans) (spanpackage_t *pspanpackage);
if (r_pixbytes == 1)
DrawSpans = D_PolysetDrawSpans8;
else
DrawSpans = D_PolysetDrawSpans16;
plefttop = pedgetable->pleftedgevert0;
prighttop = pedgetable->prightedgevert0;
pleftbottom = pedgetable->pleftedgevert1;
prightbottom = pedgetable->prightedgevert1;
initialleftheight = pleftbottom[1] - plefttop[1];
initialrightheight = prightbottom[1] - prighttop[1];
//
// set the s, t, and light gradients, which are consistent across the triangle
// because being a triangle, things are affine
//
D_PolysetCalcGradients (r_affinetridesc.skinwidth);
//
// rasterize the polygon
//
//
// scan out the top (and possibly only) part of the left edge
//
D_PolysetSetUpForLineScan(plefttop[0], plefttop[1],
pleftbottom[0], pleftbottom[1]);
d_pedgespanpackage = a_spans;
ystart = plefttop[1];
d_aspancount = plefttop[0] - prighttop[0];
d_ptex = (qbyte *)r_affinetridesc.pskin + (plefttop[2] >> 16) +
(plefttop[3] >> 16) * r_affinetridesc.skinwidth;
//#if id386
// d_sfrac = (plefttop[2] & 0xFFFF) << 16;
// d_tfrac = (plefttop[3] & 0xFFFF) << 16;
// d_pzbasestep = (d_zwidth + ubasestep) << 1;
// d_pzextrastep = d_pzbasestep + 2;
//#else
d_sfrac = plefttop[2] & 0xFFFF;
d_tfrac = plefttop[3] & 0xFFFF;
d_pzbasestep = d_zwidth + ubasestep;
d_pzextrastep = d_pzbasestep + 1;
//#endif
d_light = plefttop[4];
d_zi = plefttop[5];
d_pdestbasestep = (screenwidth + ubasestep)*r_pixbytes;
d_pdestextrastep = d_pdestbasestep + r_pixbytes;
d_pdest = (qbyte *)d_viewbuffer +
(ystart * screenwidth + plefttop[0])*r_pixbytes;
d_pz = d_pzbuffer + ystart * d_zwidth + plefttop[0];
// TODO: can reuse partial expressions here
// for negative steps in x along left edge, bias toward overflow rather than
// underflow (sort of turning the floor () we did in the gradient calcs into
// ceil (), but plus a little bit)
if (ubasestep < 0)
working_lstepx = r_lstepx - 1;
else
working_lstepx = r_lstepx;
d_countextrastep = ubasestep + 1;
d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
((r_tstepy + r_tstepx * ubasestep) >> 16) *
r_affinetridesc.skinwidth;
//#if id386
// d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16;
// d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) << 16;
//#else
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
//#endif
d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
d_zibasestep = r_zistepy + r_zistepx * ubasestep;
d_ptexextrastep = ((r_sstepy + r_sstepx * d_countextrastep) >> 16) +
((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
r_affinetridesc.skinwidth;
//#if id386
// d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) << 16;
// d_tfracextrastep = (r_tstepy + r_tstepx*d_countextrastep) << 16;
//#else
d_sfracextrastep = (r_sstepy + r_sstepx*d_countextrastep) & 0xFFFF;
d_tfracextrastep = (r_tstepy + r_tstepx*d_countextrastep) & 0xFFFF;
//#endif
d_lightextrastep = d_lightbasestep + working_lstepx;
d_ziextrastep = d_zibasestep + r_zistepx;
D_PolysetScanLeftEdge (initialleftheight);
//
// scan out the bottom part of the left edge, if it exists
//
if (pedgetable->numleftedges == 2)
{
int height;
plefttop = pleftbottom;
pleftbottom = pedgetable->pleftedgevert2;
D_PolysetSetUpForLineScan(plefttop[0], plefttop[1],
pleftbottom[0], pleftbottom[1]);
height = pleftbottom[1] - plefttop[1];
// TODO: make this a function; modularize this function in general
ystart = plefttop[1];
d_aspancount = plefttop[0] - prighttop[0];
d_ptex = (qbyte *)r_affinetridesc.pskin + (plefttop[2] >> 16) +
(plefttop[3] >> 16) * r_affinetridesc.skinwidth;
d_sfrac = 0;
d_tfrac = 0;
d_light = plefttop[4];
d_zi = plefttop[5];
d_pdestbasestep = (screenwidth + ubasestep)*r_pixbytes;
d_pdestextrastep = d_pdestbasestep + r_pixbytes;
d_pdest = (qbyte *)d_viewbuffer + (ystart * screenwidth + plefttop[0])*r_pixbytes;
//#if id386
// d_pzbasestep = (d_zwidth + ubasestep) << 1;
// d_pzextrastep = d_pzbasestep + 2;
//#else
d_pzbasestep = d_zwidth + ubasestep;
d_pzextrastep = d_pzbasestep + 1;
//#endif
d_pz = d_pzbuffer + ystart * d_zwidth + plefttop[0];
if (ubasestep < 0)
working_lstepx = r_lstepx - 1;
else
working_lstepx = r_lstepx;
d_countextrastep = ubasestep + 1;
d_ptexbasestep = ((r_sstepy + r_sstepx * ubasestep) >> 16) +
((r_tstepy + r_tstepx * ubasestep) >> 16) *
r_affinetridesc.skinwidth;
//#if id386
// d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) << 16;
// d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) << 16;
//#else
d_sfracbasestep = (r_sstepy + r_sstepx * ubasestep) & 0xFFFF;
d_tfracbasestep = (r_tstepy + r_tstepx * ubasestep) & 0xFFFF;
//#endif
d_lightbasestep = r_lstepy + working_lstepx * ubasestep;
d_zibasestep = r_zistepy + r_zistepx * ubasestep;
d_ptexextrastep = ((r_sstepy + r_sstepx * d_countextrastep) >> 16) +
((r_tstepy + r_tstepx * d_countextrastep) >> 16) *
r_affinetridesc.skinwidth;
//#if id386
// d_sfracextrastep = ((r_sstepy+r_sstepx*d_countextrastep) & 0xFFFF)<<16;
// d_tfracextrastep = ((r_tstepy+r_tstepx*d_countextrastep) & 0xFFFF)<<16;
//#else
d_sfracextrastep = (r_sstepy+r_sstepx*d_countextrastep) & 0xFFFF;
d_tfracextrastep = (r_tstepy+r_tstepx*d_countextrastep) & 0xFFFF;
#endif
//#endif
d_lightextrastep = d_lightbasestep + working_lstepx;
d_ziextrastep = d_zibasestep + r_zistepx;
@ -2274,7 +2435,7 @@ void D_RasterizeAliasPolySmooth8 (void)
}
}
void D_RasterizeAliasPolySmooth1 (void)
void D_RasterizeAliasPolySmooth1Asm (void)
{
int initialleftheight, initialrightheight;
int *plefttop, *prighttop, *pleftbottom, *prightbottom;

View File

@ -234,7 +234,7 @@ int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count,
R_AliasClipTriangle
================
*/
void R_AliasClipTriangle (mtriangle_t *ptri)
void R_AliasClipTriangle (mtriangle_t *ptri, void (*drawfnc) (void))
{
int i, k, pingpong;
mtriangle_t mtri;
@ -348,10 +348,7 @@ void R_AliasClipTriangle (mtriangle_t *ptri)
mtri.st_index[1] = i;
mtri.xyz_index[2] = i+1;
mtri.st_index[2] = i+1;
if (r_pixbytes == 4)
D_PolysetDraw32 ();
else
D_PolysetDraw ();
drawfnc ();
}
r_affinetridesc.pstverts = pst;
}

View File

@ -264,13 +264,13 @@ qboolean R_AliasCheckBBox (void)
if (allclip)
return false; // trivial reject off one side
// currententity->trivial_accept = !anyclip & !zclipped;
currententity->trivial_accept = !anyclip & !zclipped;
if (currententity->trivial_accept)
{
if (minz > (r_aliastransition + (pmdl->size * r_resfudge)))
{
// currententity->trivial_accept |= 2;
currententity->trivial_accept |= 2;
}
}
@ -299,6 +299,7 @@ General clipped case
*/
void R_AliasPreparePoints (void)
{
void (*drawfnc) (void);
int i;
mstvert_t *pstverts;
finalvert_t *fv;
@ -310,14 +311,26 @@ void R_AliasPreparePoints (void)
fv = pfinalverts;
av = pauxverts;
#ifdef PEXT_TRANS
/*
if (currententity->alpha != 1)
#if id386
if (currententity->alpha == 1) //use the asm routines if we have it, and don't have alpha
{
Set_TransLevelF(currententity->alpha);
if (r_pixbytes == 4)
drawfnc = D_PolysetDraw32;
else if (r_pixbytes == 2)
drawfnc = D_PolysetDraw16;
else
drawfnc = D_PolysetDrawAsm;
}
*/
else
#endif
{
if (r_pixbytes == 4)
drawfnc = D_PolysetDraw32;
else if (r_pixbytes == 2)
drawfnc = D_PolysetDraw16;
else
drawfnc = D_PolysetDrawC;
}
for (i=0 ; i<r_anumverts ; i++, fv++, av++, r_apnewverts++, r_apoldverts++)
{
@ -369,16 +382,11 @@ void R_AliasPreparePoints (void)
{ // totally unclipped
r_affinetridesc.pfinalverts = pfinalverts;
r_affinetridesc.ptriangles = ptri;
if (r_pixbytes == 4)
D_PolysetDraw32 ();
else if (r_pixbytes == 2)
D_PolysetDraw16 ();
else
D_PolysetDraw ();
drawfnc ();
}
else
{ // partially clipped
R_AliasClipTriangle (ptri);
R_AliasClipTriangle (ptri, drawfnc);
}
}
}
@ -616,8 +624,12 @@ void R_AliasPrepareUnclippedPoints (void)
if (r_pixbytes == 4)
D_PolysetDraw32 ();
#if id386
else if (currententity->alpha == 1)
D_PolysetDrawAsm ();
#endif
else
D_PolysetDraw ();
D_PolysetDrawC ();
}
/*

View File

@ -271,7 +271,7 @@ extern int r_outofedges;
extern mvertex_t *r_pcurrentvertbase;
extern int r_maxvalidedgeoffset;
void R_AliasClipTriangle (mtriangle_t *ptri);
void R_AliasClipTriangle (mtriangle_t *ptri, void (*drawfnc) (void));
extern float r_time1;
extern float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;

View File

@ -535,9 +535,9 @@ void SWR_Q1BSP_AddNodeDecal (mnode_t *node)
void SWR_AddDecal(vec3_t org)
{
VectorCopy(org, decalorg);
decalradius = 320;
SWR_Q1BSP_AddNodeDecal(cl.worldmodel->nodes+cl.worldmodel->hulls[0].firstclipnode);
// VectorCopy(org, decalorg);
// decalradius = 320;
// SWR_Q1BSP_AddNodeDecal(cl.worldmodel->nodes+cl.worldmodel->hulls[0].firstclipnode);
}