IOQ3 commit 2328

This commit is contained in:
Richard Allen 2012-12-12 19:39:22 +00:00
parent b80f1e3241
commit 9e6551e291
5 changed files with 16 additions and 15 deletions

View File

@ -835,8 +835,8 @@ the bits are allocated as follows:
17-30 : sorted shader index
*/
#define QSORT_FOGNUM_SHIFT 2
#define QSORT_ENTITYNUM_SHIFT 7
#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS)
#define QSORT_REFENTITYNUM_SHIFT 7
#define QSORT_SHADERNUM_SHIFT (QSORT_REFENTITYNUM_SHIFT+REFENTITYNUM_BITS)
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
#error "Need to update sorting, too many bits."
#endif
@ -953,7 +953,7 @@ typedef struct {
trRefEntity_t *currentEntity;
trRefEntity_t worldEntity; // point currentEntity at this when rendering world
int currentEntityNum;
int shiftedEntityNum; // currentEntityNum << QSORT_ENTITYNUM_SHIFT
int shiftedEntityNum; // currentEntityNum << QSORT_REFENTITYNUM_SHIFT
model_t *currentModel;
viewParms_t viewParms;
@ -1704,7 +1704,7 @@ typedef enum {
typedef struct {
drawSurf_t drawSurfs[MAX_DRAWSURFS];
dlight_t dlights[MAX_DLIGHTS];
trRefEntity_t entities[MAX_ENTITIES];
trRefEntity_t entities[MAX_REFENTITIES];
srfPoly_t *polys;//[MAX_POLYS];
polyVert_t *polyVerts;//[MAX_POLYVERTS];
renderCommandList_t commands;

View File

@ -1127,7 +1127,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader,
int *fogNum, int *dlightMap ) {
*fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31;
*shader = tr.sortedShaders[ ( sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1) ];
*entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & MAX_ENTITIES;
*entityNum = ( sort >> QSORT_REFENTITYNUM_SHIFT ) & REFENTITYNUM_MASK;
*dlightMap = sort & 3;
}
@ -1208,7 +1208,7 @@ void R_AddEntitySurfaces (void) {
ent->needDlights = qfalse;
// preshift the value we are going to OR into the drawsurf sort
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
//
// the weapon model must be handled special --

View File

@ -101,7 +101,7 @@ void R_AddPolygonSurfaces( void ) {
srfPoly_t *poly;
tr.currentEntityNum = REFENTITYNUM_WORLD;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
sh = R_GetShaderByHandle( poly->hShader );
@ -208,8 +208,8 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
if ( !tr.registered ) {
return;
}
if ( r_numentities >= MAX_ENTITIES ) {
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_ENTITIES\n");
if ( r_numentities >= MAX_REFENTITIES ) {
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_REFENTITIES\n");
return;
}
if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) {

View File

@ -26,11 +26,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
#define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
// the last N-bit number (2^ENTITYNUM_BITS - 1) is reserved for the special world refentity,
// and this is reflected by the value of MAX_ENTITIES (which therefore is not a power-of-2)
#define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1)
#define REFENTITYNUM_WORLD ((1<<ENTITYNUM_BITS) - 1)
#define REFENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
#define REFENTITYNUM_MASK ((1<<REFENTITYNUM_BITS) - 1)
// the last N-bit number (2^REFENTITYNUM_BITS - 1) is reserved for the special world refentity,
// and this is reflected by the value of MAX_REFENTITIES (which therefore is not a power-of-2)
#define MAX_REFENTITIES ((1<<REFENTITYNUM_BITS) - 1)
#define REFENTITYNUM_WORLD ((1<<REFENTITYNUM_BITS) - 1)
// renderfx flags
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)

View File

@ -652,7 +652,7 @@ void R_AddWorldSurfaces (void) {
}
tr.currentEntityNum = REFENTITYNUM_WORLD;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT;
tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT;
// determine which leaves are in the PVS / areamask
R_MarkLeaves ();