diff --git a/r_bsp.c b/r_bsp.c index a27a98b1..3478e1cf 100644 --- a/r_bsp.c +++ b/r_bsp.c @@ -143,7 +143,7 @@ void R_RotateBmodel (void) R_TransformFrustum (); } -#if 1 +#if 0 /* ================ @@ -472,7 +472,8 @@ void R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf) { if (pn->contents != CONTENTS_SOLID) { - r_currentbkey = ((mleaf_t *)pn)->cluster; + //r_currentbkey = ((mleaf_t *)pn)->cluster; + r_currentbkey = LEAF_KEY (((mleaf_t *)pn)); R_RenderBmodelFace (psideedges[i], psurf); } } @@ -718,7 +719,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode) if (((psurf->flags & SURF_PLANEBACK) && (dot < -BACKFACE_EPSILON)) || (!(psurf->flags & SURF_PLANEBACK) && (dot > BACKFACE_EPSILON))) { - r_currentkey = ((mleaf_t *)topnode)->cluster; + r_currentkey = LEAF_KEY(((mleaf_t *)topnode)); // FIXME: use bounding-box-based frustum clipping info? R_RenderFace (psurf, clipflags); @@ -730,6 +731,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode) int c_drawnode; +int r_leafkeys[MAX_MAP_LEAFS]; /* ================ @@ -812,7 +814,9 @@ void R_RecursiveWorldNode (mnode_t *node, int clipflags) gEngfuncs.R_StoreEfrags(&pleaf->efrags,tr.realframecount); } - pleaf->cluster = r_currentkey; + + // pleaf->cluster + LEAF_KEY(pleaf) = r_currentkey; r_currentkey++; // all bmodels in a leaf share the same key } else diff --git a/r_local.h b/r_local.h index d3e8320e..4eb47a99 100644 --- a/r_local.h +++ b/r_local.h @@ -1239,6 +1239,9 @@ extern qboolean insubmodel; extern vec3_t r_entorigin; +extern int r_leafkeys[MAX_MAP_LEAFS]; +#define LEAF_KEY(pleaf) r_leafkeys[(pleaf - WORLDMODEL->leafs)] + // // r_blitscreen.c // diff --git a/r_main.c b/r_main.c index 3c3310e0..5521419d 100644 --- a/r_main.c +++ b/r_main.c @@ -398,7 +398,8 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type ) if( type == ET_FRAGMENTED ) r_stats.c_client_ents++; - if( R_OpaqueEntity( clent )) + // debug: mark all solid + if( true ) // R_OpaqueEntity( clent )) { // opaque if( tr.draw_list->num_solid_entities >= MAX_VISIBLE_PACKET ) @@ -1261,9 +1262,6 @@ void R_DrawBEntitiesOnList (void) float minmaxs[6]; mnode_t *topnode; - if (!r_drawentities->value) - return; - VectorCopy (modelorg, oldorigin); insubmodel = true; //r_dlightframecount = r_framecount; @@ -1284,12 +1282,21 @@ void R_DrawBEntitiesOnList (void) // trivial accept status RotatedBBox (RI.currentmodel->mins, RI.currentmodel->maxs, RI.currententity->angles, mins, maxs); +#if 0 + mins[0] = mins[0] - 100; + mins[1] = mins[1] - 100; + mins[2] = mins[2] - 100; + maxs[0] = maxs[0] + 100; + maxs[1] = maxs[1] + 100; + maxs[2] = maxs[2] + 100; +#endif VectorAdd (mins, RI.currententity->origin, minmaxs); VectorAdd (maxs, RI.currententity->origin, (minmaxs+3)); clipflags = R_BmodelCheckBBox (minmaxs); if (clipflags == BMODEL_FULLY_CLIPPED) continue; // off the edge of the screen + //clipflags = 0; topnode = R_FindTopnode (minmaxs, minmaxs+3); if (!topnode) @@ -1319,13 +1326,13 @@ void R_DrawBEntitiesOnList (void) // RI.currententity = tr.draw_list->solid_entities[i]; RI.currententity->topnode = topnode; //ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model ); - if (topnode->contents >= 0) + //if (topnode->contents >= 0) { // not a leaf; has to be clipped to the world BSP r_clipflags = clipflags; R_DrawSolidClippedSubmodelPolygons (RI.currentmodel, topnode); } - else + //else { // falls entirely in one leaf, so we just put all the // edges in the edge list and let 1/z sorting handle @@ -1333,7 +1340,7 @@ void R_DrawBEntitiesOnList (void) //ASSERT( RI.currentmodel == tr.draw_list->solid_entities[i]->model ); - R_DrawSubmodelPolygons (RI.currentmodel, clipflags, topnode); + //R_DrawSubmodelPolygons (RI.currentmodel, clipflags, topnode); } RI.currententity->topnode = NULL; diff --git a/r_surf.c b/r_surf.c index 5708906a..0a1db660 100644 --- a/r_surf.c +++ b/r_surf.c @@ -180,7 +180,7 @@ texture_t *R_TextureAnimation( msurface_t *s ) return base; } - +static char r_transtexture; /* =============== R_DrawSurface @@ -200,6 +200,7 @@ void R_DrawSurface (void) surfrowbytes = r_drawsurf.rowbytes; mt = r_drawsurf.image; + r_transtexture = mt->transparent; r_source = mt->pixels[r_drawsurf.surfmip]; @@ -276,6 +277,7 @@ void R_DrawSurfaceBlock8_mip0 (void) psource = pbasesource; prowdest = prowdestbase; + char transtexture = r_transtexture; for (v=0 ; v=0; b--) { pix = psource[b]; + if( transtexture ) + pix = pix << 3; prowdest[b] = pix; //((unsigned char *)vid.colormap) //[(light & 0xFF00) + pix]; @@ -324,6 +328,7 @@ void R_DrawSurfaceBlock8_mip1 (void) { int v, i, b, lightstep, lighttemp, light; pixel_t pix, *psource, *prowdest; + char transtexture = r_transtexture; psource = pbasesource; prowdest = prowdestbase; @@ -348,6 +353,8 @@ void R_DrawSurfaceBlock8_mip1 (void) for (b=7; b>=0; b--) { pix = psource[b]; + if( transtexture ) + pix = pix << 3; prowdest[b] = pix; //((unsigned char *)vid.colormap) //[(light & 0xFF00) + pix]; @@ -375,6 +382,7 @@ void R_DrawSurfaceBlock8_mip2 (void) { int v, i, b, lightstep, lighttemp, light; pixel_t pix, *psource, *prowdest; + char transtexture = r_transtexture; psource = pbasesource; prowdest = prowdestbase; @@ -399,6 +407,8 @@ void R_DrawSurfaceBlock8_mip2 (void) for (b=3; b>=0; b--) { pix = psource[b]; + if( transtexture ) + pix = pix << 3; prowdest[b] = pix; //((unsigned char *)vid.colormap) //[(light & 0xFF00) + pix]; @@ -426,6 +436,7 @@ void R_DrawSurfaceBlock8_mip3 (void) { int v, i, b, lightstep, lighttemp, light; pixel_t pix, *psource, *prowdest; + char transtexture = r_transtexture; psource = pbasesource; prowdest = prowdestbase; @@ -450,6 +461,8 @@ void R_DrawSurfaceBlock8_mip3 (void) for (b=1; b>=0; b--) { pix = psource[b]; + if( transtexture ) + pix = pix << 3; prowdest[b] = pix; //((unsigned char *)vid.colormap) //[(light & 0xFF00) + pix];