summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2012-10-17 21:20:29 +0000
committerTim Angus <tim@ngus.net>2013-01-12 20:48:53 +0000
commit9f48a26a280b631489573794e23058734ec73c30 (patch)
treee9e9d7959089c54aac220b048a51a6c1e4a7edb1 /src
parentca65a17b271d34e6eedcbb0bc5f0a3ffb40af3ae (diff)
From /dev/humancontroller: to further reduce confusion, rename constants like MAX_ENTITIES to MAX_REFENTITIES
Diffstat (limited to 'src')
-rw-r--r--src/renderer/tr_local.h8
-rw-r--r--src/renderer/tr_main.c4
-rw-r--r--src/renderer/tr_scene.c6
-rw-r--r--src/renderer/tr_types.h11
-rw-r--r--src/renderer/tr_world.c2
5 files changed, 16 insertions, 15 deletions
diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h
index 9a194401..c7b584da 100644
--- a/src/renderer/tr_local.h
+++ b/src/renderer/tr_local.h
@@ -836,8 +836,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
@@ -954,7 +954,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;
@@ -1703,7 +1703,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;
diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c
index 08b739bd..8d5c444f 100644
--- a/src/renderer/tr_main.c
+++ b/src/renderer/tr_main.c
@@ -1128,7 +1128,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;
}
@@ -1209,7 +1209,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 --
diff --git a/src/renderer/tr_scene.c b/src/renderer/tr_scene.c
index 72e078d5..49c0e593 100644
--- a/src/renderer/tr_scene.c
+++ b/src/renderer/tr_scene.c
@@ -102,7 +102,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 );
@@ -209,8 +209,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]) ) {
diff --git a/src/renderer/tr_types.h b/src/renderer/tr_types.h
index 6c394628..1ddb9a18 100644
--- a/src/renderer/tr_types.h
+++ b/src/renderer/tr_types.h
@@ -27,11 +27,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)
diff --git a/src/renderer/tr_world.c b/src/renderer/tr_world.c
index 1cdc3630..2bd5f316 100644
--- a/src/renderer/tr_world.c
+++ b/src/renderer/tr_world.c
@@ -653,7 +653,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 ();