[quake3-commits] r2328 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Oct 17 17:20:29 EDT 2012


Author: ztm
Date: 2012-10-17 17:20:29 -0400 (Wed, 17 Oct 2012)
New Revision: 2328

Modified:
   trunk/code/renderer/tr_local.h
   trunk/code/renderer/tr_main.c
   trunk/code/renderer/tr_scene.c
   trunk/code/renderer/tr_types.h
   trunk/code/renderer/tr_world.c
Log:
>From /dev/humancontroller:
to further reduce confusion, rename constants like MAX_ENTITIES to MAX_REFENTITIES

Modified: trunk/code/renderer/tr_local.h
===================================================================
--- trunk/code/renderer/tr_local.h	2012-10-17 21:17:37 UTC (rev 2327)
+++ trunk/code/renderer/tr_local.h	2012-10-17 21:20:29 UTC (rev 2328)
@@ -835,8 +835,8 @@
 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 @@
 	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 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;

Modified: trunk/code/renderer/tr_main.c
===================================================================
--- trunk/code/renderer/tr_main.c	2012-10-17 21:17:37 UTC (rev 2327)
+++ trunk/code/renderer/tr_main.c	2012-10-17 21:20:29 UTC (rev 2328)
@@ -1127,7 +1127,7 @@
 					 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 @@
 		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 --

Modified: trunk/code/renderer/tr_scene.c
===================================================================
--- trunk/code/renderer/tr_scene.c	2012-10-17 21:17:37 UTC (rev 2327)
+++ trunk/code/renderer/tr_scene.c	2012-10-17 21:20:29 UTC (rev 2328)
@@ -101,7 +101,7 @@
 	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 @@
 	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]) ) {

Modified: trunk/code/renderer/tr_types.h
===================================================================
--- trunk/code/renderer/tr_types.h	2012-10-17 21:17:37 UTC (rev 2327)
+++ trunk/code/renderer/tr_types.h	2012-10-17 21:20:29 UTC (rev 2328)
@@ -26,11 +26,12 @@
 
 #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)

Modified: trunk/code/renderer/tr_world.c
===================================================================
--- trunk/code/renderer/tr_world.c	2012-10-17 21:17:37 UTC (rev 2327)
+++ trunk/code/renderer/tr_world.c	2012-10-17 21:20:29 UTC (rev 2328)
@@ -652,7 +652,7 @@
 	}
 
 	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 ();



More information about the quake3-commits mailing list