mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-10 07:11:36 +00:00
IOQ3 commit 2328
This commit is contained in:
parent
b80f1e3241
commit
9e6551e291
5 changed files with 16 additions and 15 deletions
|
@ -835,8 +835,8 @@ the bits are allocated as follows:
|
||||||
17-30 : sorted shader index
|
17-30 : sorted shader index
|
||||||
*/
|
*/
|
||||||
#define QSORT_FOGNUM_SHIFT 2
|
#define QSORT_FOGNUM_SHIFT 2
|
||||||
#define QSORT_ENTITYNUM_SHIFT 7
|
#define QSORT_REFENTITYNUM_SHIFT 7
|
||||||
#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS)
|
#define QSORT_SHADERNUM_SHIFT (QSORT_REFENTITYNUM_SHIFT+REFENTITYNUM_BITS)
|
||||||
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
|
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
|
||||||
#error "Need to update sorting, too many bits."
|
#error "Need to update sorting, too many bits."
|
||||||
#endif
|
#endif
|
||||||
|
@ -953,7 +953,7 @@ typedef struct {
|
||||||
trRefEntity_t *currentEntity;
|
trRefEntity_t *currentEntity;
|
||||||
trRefEntity_t worldEntity; // point currentEntity at this when rendering world
|
trRefEntity_t worldEntity; // point currentEntity at this when rendering world
|
||||||
int currentEntityNum;
|
int currentEntityNum;
|
||||||
int shiftedEntityNum; // currentEntityNum << QSORT_ENTITYNUM_SHIFT
|
int shiftedEntityNum; // currentEntityNum << QSORT_REFENTITYNUM_SHIFT
|
||||||
model_t *currentModel;
|
model_t *currentModel;
|
||||||
|
|
||||||
viewParms_t viewParms;
|
viewParms_t viewParms;
|
||||||
|
@ -1704,7 +1704,7 @@ typedef enum {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
drawSurf_t drawSurfs[MAX_DRAWSURFS];
|
drawSurf_t drawSurfs[MAX_DRAWSURFS];
|
||||||
dlight_t dlights[MAX_DLIGHTS];
|
dlight_t dlights[MAX_DLIGHTS];
|
||||||
trRefEntity_t entities[MAX_ENTITIES];
|
trRefEntity_t entities[MAX_REFENTITIES];
|
||||||
srfPoly_t *polys;//[MAX_POLYS];
|
srfPoly_t *polys;//[MAX_POLYS];
|
||||||
polyVert_t *polyVerts;//[MAX_POLYVERTS];
|
polyVert_t *polyVerts;//[MAX_POLYVERTS];
|
||||||
renderCommandList_t commands;
|
renderCommandList_t commands;
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader,
|
||||||
int *fogNum, int *dlightMap ) {
|
int *fogNum, int *dlightMap ) {
|
||||||
*fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31;
|
*fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31;
|
||||||
*shader = tr.sortedShaders[ ( sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1) ];
|
*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;
|
*dlightMap = sort & 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1208,7 @@ void R_AddEntitySurfaces (void) {
|
||||||
ent->needDlights = qfalse;
|
ent->needDlights = qfalse;
|
||||||
|
|
||||||
// preshift the value we are going to OR into the drawsurf sort
|
// 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 --
|
// the weapon model must be handled special --
|
||||||
|
|
|
@ -101,7 +101,7 @@ void R_AddPolygonSurfaces( void ) {
|
||||||
srfPoly_t *poly;
|
srfPoly_t *poly;
|
||||||
|
|
||||||
tr.currentEntityNum = REFENTITYNUM_WORLD;
|
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++ ) {
|
for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) {
|
||||||
sh = R_GetShaderByHandle( poly->hShader );
|
sh = R_GetShaderByHandle( poly->hShader );
|
||||||
|
@ -208,8 +208,8 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
|
||||||
if ( !tr.registered ) {
|
if ( !tr.registered ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( r_numentities >= MAX_ENTITIES ) {
|
if ( r_numentities >= MAX_REFENTITIES ) {
|
||||||
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_ENTITIES\n");
|
ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_REFENTITIES\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) {
|
if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) {
|
||||||
|
|
|
@ -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 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
|
#define REFENTITYNUM_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,
|
#define REFENTITYNUM_MASK ((1<<REFENTITYNUM_BITS) - 1)
|
||||||
// and this is reflected by the value of MAX_ENTITIES (which therefore is not a power-of-2)
|
// the last N-bit number (2^REFENTITYNUM_BITS - 1) is reserved for the special world refentity,
|
||||||
#define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1)
|
// and this is reflected by the value of MAX_REFENTITIES (which therefore is not a power-of-2)
|
||||||
#define REFENTITYNUM_WORLD ((1<<ENTITYNUM_BITS) - 1)
|
#define MAX_REFENTITIES ((1<<REFENTITYNUM_BITS) - 1)
|
||||||
|
#define REFENTITYNUM_WORLD ((1<<REFENTITYNUM_BITS) - 1)
|
||||||
|
|
||||||
// renderfx flags
|
// renderfx flags
|
||||||
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)
|
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)
|
||||||
|
|
|
@ -652,7 +652,7 @@ void R_AddWorldSurfaces (void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.currentEntityNum = REFENTITYNUM_WORLD;
|
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
|
// determine which leaves are in the PVS / areamask
|
||||||
R_MarkLeaves ();
|
R_MarkLeaves ();
|
||||||
|
|
Loading…
Reference in a new issue