fix the build

This commit is contained in:
Garux 2021-11-06 23:10:15 +03:00
parent aa110638d4
commit d75792d9a9
12 changed files with 93 additions and 106 deletions

View File

@ -484,7 +484,7 @@ static int FilterBrushIntoTree_r( brush_t&& b, node_t *node ){
fragment all the detail brushes into the structural leafs
*/
void FilterDetailBrushesIntoTree( entity_t *e, tree_t& tree ){
void FilterDetailBrushesIntoTree( const entity_t& e, tree_t& tree ){
int c_unique = 0, c_clusters = 0;
@ -494,7 +494,7 @@ void FilterDetailBrushesIntoTree( entity_t *e, tree_t& tree ){
/* walk the list of brushes */
c_unique = 0;
c_clusters = 0;
for ( brush_t& b : e->brushes )
for ( const brush_t& b : e.brushes )
{
if ( !b.detail ) {
continue;
@ -515,12 +515,12 @@ void FilterDetailBrushesIntoTree( entity_t *e, tree_t& tree ){
Mark the leafs as opaque and areaportals
=====================
*/
void FilterStructuralBrushesIntoTree( entity_t *e, tree_t& tree ) {
void FilterStructuralBrushesIntoTree( const entity_t& e, tree_t& tree ) {
int c_unique = 0, c_clusters = 0;
Sys_FPrintf( SYS_VRB, "--- FilterStructuralBrushesIntoTree ---\n" );
for ( brush_t& b : e->brushes ) {
for ( const brush_t& b : e.brushes ) {
if ( b.detail ) {
continue;
}

View File

@ -217,12 +217,12 @@ static void SetCloneModelNumbers(){
matches brushsides back to their appropriate drawsurface and shader
*/
static void FixBrushSides( entity_t *e ){
static void FixBrushSides( const entity_t& e ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- FixBrushSides ---\n" );
/* walk list of drawsurfaces */
for ( int i = e->firstDrawSurf; i < numMapDrawSurfs; i++ )
for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
/* get surface and try to early out */
const mapDrawSurface_t& ds = mapDrawSurfs[ i ];
@ -354,7 +354,7 @@ static void ProcessWorldModel( entity_t& e ){
AddEntitySurfaceModels( e );
/* generate bsp brushes from map brushes */
EmitBrushes( e->brushes, &e->firstBrush, &e->numBrushes );
EmitBrushes( e.brushes, &e.firstBrush, &e.numBrushes );
/* add references to the detail brushes */
FilterDetailBrushesIntoTree( e, tree );
@ -394,7 +394,7 @@ static void ProcessWorldModel( entity_t& e ){
/* ydnar: fog hull */
if ( e.read_keyvalue( value, "_foghull" ) ) {
const auto shader = String64()( "textures/", value );
MakeFogHullSurfs( e, shader );
MakeFogHullSurfs( shader );
}
/* ydnar: bug 645: do flares for lights */
@ -482,10 +482,10 @@ static void ProcessSubModel( entity_t& e ){
AddEntitySurfaceModels( e );
/* generate bsp brushes from map brushes */
EmitBrushes( e->brushes, &e->firstBrush, &e->numBrushes );
EmitBrushes( e.brushes, &e.firstBrush, &e.numBrushes );
/* just put all the brushes in headnode */
tree.headnode->brushlist = e->brushes;
tree.headnode->brushlist = e.brushes;
/* subdivide each drawsurf as required by shader tesselation */
if ( !nosubdivide ) {

View File

@ -713,7 +713,7 @@ static void ProjectDecalOntoTriangles( decalProjector_t *dp, mapDrawSurface_t *d
projects decals onto world surfaces
*/
void MakeEntityDecals( entity_t *e ){
void MakeEntityDecals( const entity_t& e ){
int i, j, fOld;
decalProjector_t dp;
mapDrawSurface_t *ds;
@ -739,10 +739,10 @@ void MakeEntityDecals( entity_t *e ){
}
/* get projector */
TransformDecalProjector( &projectors[ i ], g_vector3_axes, e->origin, &dp );
TransformDecalProjector( &projectors[ i ], g_vector3_axes, e.origin, &dp );
/* walk the list of surfaces in the entity */
for ( j = e->firstDrawSurf; j < numMapDrawSurfs; j++ )
for ( j = e.firstDrawSurf; j < numMapDrawSurfs; ++j )
{
/* get surface */
ds = &mapDrawSurfs[ j ];

View File

@ -244,7 +244,7 @@ static void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front,
chops a patch up by a fog brush
*/
static bool ChopPatchSurfaceByBrush( entity_t *e, mapDrawSurface_t *ds, const brush_t *b ){
static bool ChopPatchSurfaceByBrush( mapDrawSurface_t *ds, const brush_t *b ){
int i, j;
mesh_t *outside[MAX_BRUSH_SIDES];
int numOutside;
@ -357,7 +357,7 @@ winding_t WindingFromDrawSurf( const mapDrawSurface_t *ds ){
chops up a face drawsurface by a fog brush, with a potential fragment left inside
*/
static bool ChopFaceSurfaceByBrush( entity_t *e, mapDrawSurface_t *ds, const brush_t *b ){
static bool ChopFaceSurfaceByBrush( const entity_t& e, mapDrawSurface_t *ds, const brush_t *b ){
std::list<winding_t> outside;
mapDrawSurface_t *newds;
@ -443,7 +443,7 @@ static bool ChopFaceSurfaceByBrush( entity_t *e, mapDrawSurface_t *ds, const bru
call after the surface list has been pruned, before tjunction fixing
*/
void FogDrawSurfaces( entity_t *e ){
void FogDrawSurfaces( const entity_t& e ){
int fogged, numFogged;
int numBaseDrawSurfs;
@ -503,7 +503,7 @@ void FogDrawSurfaces( entity_t *e ){
/* handle patches */
case ESurfaceType::Patch:
fogged = ChopPatchSurfaceByBrush( e, ds, fog.brush );
fogged = ChopPatchSurfaceByBrush( ds, fog.brush );
break;
/* handle triangle surfaces (fixme: split triangle surfaces) */

View File

@ -1260,17 +1260,17 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
adds misc_model surfaces to the bsp
*/
void AddTriangleModels( entity_t *eparent ){
void AddTriangleModels( entity_t& eparent ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- AddTriangleModels ---\n" );
/* get current brush entity targetname */
const char *targetName;
if ( eparent == &entities[0] ) {
if ( &eparent == &entities[0] ) {
targetName = "";
}
else{ /* misc_model entities target non-worldspawn brush model entities */
if ( !eparent->read_keyvalue( targetName, "targetname" ) ) {
if ( !eparent.read_keyvalue( targetName, "targetname" ) ) {
return;
}
}
@ -1302,7 +1302,7 @@ void AddTriangleModels( entity_t *eparent ){
const int frame = e.intForKey( "_frame", "frame" );
int castShadows, recvShadows;
if ( eparent == &entities[0] ) { /* worldspawn (and func_groups) default to cast/recv shadows in worldspawn group */
if ( &eparent == &entities[0] ) { /* worldspawn (and func_groups) default to cast/recv shadows in worldspawn group */
castShadows = WORLDSPAWN_CAST_SHADOWS;
recvShadows = WORLDSPAWN_RECV_SHADOWS;
}
@ -1312,13 +1312,13 @@ void AddTriangleModels( entity_t *eparent ){
}
/* get explicit shadow flags */
GetEntityShadowFlags( &e, eparent, &castShadows, &recvShadows );
GetEntityShadowFlags( &e, &eparent, &castShadows, &recvShadows );
/* get spawnflags */
const int spawnFlags = e.intForKey( "spawnflags" );
/* get origin */
const Vector3 origin = e.vectorForKey( "origin" ) - eparent->origin; /* offset by parent */
const Vector3 origin = e.vectorForKey( "origin" ) - eparent.origin; /* offset by parent */
/* get scale */
Vector3 scale( 1 );
@ -1410,6 +1410,6 @@ void AddTriangleModels( entity_t *eparent ){
/* insert the model */
InsertModel( model, skin, frame, transform, &remaps, celShader, *eparent, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle, clipDepth );
InsertModel( model, skin, frame, transform, &remaps, celShader, eparent, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle, clipDepth );
}
}

View File

@ -372,7 +372,7 @@ static void GrowGroup_r( parseMesh_t *pm, int patchNum, int patchCount, parseMes
pull apart.
*/
void PatchMapDrawSurfs( entity_t *e ){
void PatchMapDrawSurfs( entity_t& e ){
int i, j, k, l, c1, c2;
parseMesh_t *pm;
parseMesh_t *check, *scan;
@ -390,7 +390,7 @@ void PatchMapDrawSurfs( entity_t *e ){
Sys_FPrintf( SYS_VRB, "--- PatchMapDrawSurfs ---\n" );
patchCount = 0;
for ( pm = e->patches; pm; pm = pm->next ) {
for ( pm = e.patches; pm; pm = pm->next ) {
meshes[patchCount] = pm;
patchCount++;
}

View File

@ -1418,8 +1418,8 @@ Vector3 SnapWeldVector( const Vector3& a, const Vector3& b )
bool CreateBrushWindings( brush_t& brush );
void WriteBSPBrushMap( const char *name, const brushlist_t& list );
void FilterDetailBrushesIntoTree( entity_t *e, tree_t& tree );
void FilterStructuralBrushesIntoTree( entity_t *e, tree_t& tree );
void FilterDetailBrushesIntoTree( const entity_t& e, tree_t& tree );
void FilterStructuralBrushesIntoTree( const entity_t& e, tree_t& tree );
bool WindingIsTiny( const winding_t& w );
@ -1490,7 +1490,7 @@ void EmitBrushes( brushlist_t& brushes, int *firstBrush,
void EmitFogs();
void BeginModel( const entity_t& e );
void EndModel( entity_t *e, node_t *headnode );
void EndModel( const entity_t& e, node_t *headnode );
/* tree.c */
@ -1500,16 +1500,16 @@ inline node_t *AllocNode(){ return new node_t(); }
/* patch.c */
void ParsePatch( bool onlyLights, entity_t& mapEnt, int mapPrimitiveNum );
void PatchMapDrawSurfs( entity_t *e );
void PatchMapDrawSurfs( entity_t& e );
/* tjunction.c */
void FixTJunctions( entity_t *e );
void FixTJunctions( const entity_t& e );
/* fog.c */
winding_t WindingFromDrawSurf( const mapDrawSurface_t *ds );
void FogDrawSurfaces( entity_t *e );
void FogDrawSurfaces( const entity_t& e );
int FogForPoint( const Vector3& point, float epsilon );
int FogForBounds( const MinMax& minmax, float epsilon );
void CreateMapFogs();
@ -1524,7 +1524,7 @@ tree_t FaceBSP( facelist_t& list );
/* model.c */
void assimp_init();
void InsertModel( const char *name, int skin, int frame, const Matrix4& transform, const std::list<remap_t> *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth );
void AddTriangleModels( entity_t *e );
void AddTriangleModels( entity_t& eparent );
/* surface.c */
@ -1533,20 +1533,20 @@ void StripFaceSurface( mapDrawSurface_t *ds );
void MaxAreaFaceSurface( mapDrawSurface_t *ds );
Vector3 CalcLightmapAxis( const Vector3& normal );
void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds );
void ClassifyEntitySurfaces( entity_t *e );
void TidyEntitySurfaces( entity_t *e );
void ClassifyEntitySurfaces( const entity_t& e );
void TidyEntitySurfaces( const entity_t& e );
mapDrawSurface_t *CloneSurface( mapDrawSurface_t *src, shaderInfo_t *si );
bool IsTriangleDegenerate( bspDrawVert_t *points, int a, int b, int c );
void ClearSurface( mapDrawSurface_t *ds );
mapDrawSurface_t *DrawSurfaceForSide( const entity_t *e, const brush_t& b, const side_t& s, const winding_t& w );
mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh );
mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const side_t& s, const winding_t& w );
mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t *mesh );
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, const Vector3& origin, const Vector3& normal, const Vector3& color, const char *flareShader, int lightStyle );
void ClipSidesIntoTree( entity_t *e, const tree_t& tree );
void ClipSidesIntoTree( entity_t& e, const tree_t& tree );
void MakeDebugPortalSurfs( const tree_t& tree );
void MakeFogHullSurfs( entity_t *e, const char *shader );
void SubdivideFaceSurfaces( entity_t *e );
void AddEntitySurfaceModels( entity_t *e );
void FilterDrawsurfsIntoTree( entity_t *e, tree_t& tree );
void MakeFogHullSurfs( const char *shader );
void SubdivideFaceSurfaces( const entity_t& e );
void AddEntitySurfaceModels( entity_t& e );
void FilterDrawsurfsIntoTree( entity_t& e, tree_t& tree );
/* surface_fur.c */
@ -1559,7 +1559,7 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity );
/* ydnar: surface_meta.c */
void ClearMetaTriangles();
void MakeEntityMetaTriangles( entity_t *e );
void MakeEntityMetaTriangles( const entity_t& e );
void FixMetaTJunctions();
void SmoothMetaTriangles();
void MergeMetaTriangles();
@ -1575,7 +1575,7 @@ void LoadSurfaceExtraFile( const char *path );
/* decals.c */
void ProcessDecals();
void MakeEntityDecals( entity_t *e );
void MakeEntityDecals( const entity_t& e );
/* map.c */
std::array<Vector3, 2> TextureAxisFromPlane( const plane_t& plane );
@ -1647,7 +1647,7 @@ const image_t *ImageLoad( const char *name );
/* shaders.c */
void ColorMod( colorMod_t *am, int numVerts, bspDrawVert_t *drawVerts );
void ColorMod( const colorMod_t *am, int numVerts, bspDrawVert_t *drawVerts );
void TCMod( const tcMod_t& mod, Vector2& st );

View File

@ -45,7 +45,7 @@ static int numCustSurfaceParms;
routines for dealing with vertex color/alpha modification
*/
void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts ){
void ColorMod( const colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts ){
/* dummy check */
if ( cm == NULL || numVerts < 1 || drawVerts == NULL ) {
return;

View File

@ -262,7 +262,7 @@ void ClearSurface( mapDrawSurface_t *ds ){
deletes all empty or bad surfaces from the surface list
*/
void TidyEntitySurfaces( entity_t *e ){
void TidyEntitySurfaces( const entity_t& e ){
int i, j, deleted;
mapDrawSurface_t *out, *in = NULL;
@ -272,7 +272,7 @@ void TidyEntitySurfaces( entity_t *e ){
/* walk the surface list */
deleted = 0;
for ( i = e->firstDrawSurf, j = e->firstDrawSurf; j < numMapDrawSurfs; i++, j++ )
for ( i = e.firstDrawSurf, j = e.firstDrawSurf; j < numMapDrawSurfs; ++i, ++j )
{
/* get out surface */
out = &mapDrawSurfs[ i ];
@ -567,12 +567,12 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){
classifies all surfaces in an entity
*/
void ClassifyEntitySurfaces( entity_t *e ){
void ClassifyEntitySurfaces( const entity_t& e ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- ClassifyEntitySurfaces ---\n" );
/* walk the surface list */
for ( int i = e->firstDrawSurf; i < numMapDrawSurfs; ++i )
for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
FinishSurface( &mapDrawSurfs[ i ] );
ClassifySurfaces( 1, &mapDrawSurfs[ i ] );
@ -712,7 +712,7 @@ const double SNAP_INT_TO_FLOAT = ( 1.0 / SNAP_FLOAT_TO_INT );
static mapDrawSurface_t *DrawSurfaceForShader( const char *shader );
mapDrawSurface_t *DrawSurfaceForSide( const entity_t *e, const brush_t& b, const side_t& s, const winding_t& w ){
mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const side_t& s, const winding_t& w ){
mapDrawSurface_t *ds;
shaderInfo_t *si, *parent;
bspDrawVert_t *dv;
@ -802,7 +802,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t *e, const brush_t& b, const
/* round the xyz to a given precision and translate by origin */
for ( size_t i = 0; i < 3; i++ )
dv->xyz[ i ] = SNAP_INT_TO_FLOAT * floor( dv->xyz[ i ] * SNAP_FLOAT_TO_INT + 0.5 );
vTranslated = dv->xyz + e->originbrush_origin;
vTranslated = dv->xyz + e.originbrush_origin;
/* ydnar: tek-fu celshading support for flat shaded shit */
if ( flat ) {
@ -866,7 +866,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t *e, const brush_t& b, const
moved here from patch.c
*/
mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh ){
mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t *mesh ){
int i, numVerts;
Plane3f plane;
bool planar;
@ -1011,7 +1011,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh
/* ydnar: gs mods: added support for explicit shader texcoord generation */
else if ( si->tcGen ) {
/* translate by origin and project the texture */
const Vector3 vTranslated = dv->xyz + e->origin;
const Vector3 vTranslated = dv->xyz + e.origin;
dv->st[ 0 ] = vector3_dot( si->vecs[ 0 ], vTranslated );
dv->st[ 1 ] = vector3_dot( si->vecs[ 1 ], vTranslated );
}
@ -1140,7 +1140,7 @@ static void AddSurfaceFlare( mapDrawSurface_t *ds, const Vector3& entityOrigin )
subdivides a face surface until it is smaller than the specified size (subdivisions)
*/
static void SubdivideFace_r( entity_t *e, const brush_t& brush, const side_t& side, winding_t& w, int fogNum, float subdivisions ){
static void SubdivideFace_r( const entity_t& e, const brush_t& brush, const side_t& side, winding_t& w, int fogNum, float subdivisions ){
int axis;
MinMax bounds;
const float epsilon = 0.1;
@ -1209,12 +1209,12 @@ static void SubdivideFace_r( entity_t *e, const brush_t& brush, const side_t& si
ydnar: and subdivide surfaces that exceed specified texture coordinate range
*/
void SubdivideFaceSurfaces( entity_t *e ){
void SubdivideFaceSurfaces( const entity_t& e ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- SubdivideFaceSurfaces ---\n" );
/* walk the list of original surfaces, numMapDrawSurfs may increase in the process */
for ( mapDrawSurface_t& ds : Span( mapDrawSurfs + e->firstDrawSurf, numMapDrawSurfs ) )
for ( mapDrawSurface_t& ds : Span( mapDrawSurfs + e.firstDrawSurf, numMapDrawSurfs ) )
{
/* only subdivide brush sides */
if ( ds.type != ESurfaceType::Face || ds.mapBrush == NULL || ds.sideRef == NULL || ds.sideRef->side == NULL ) {
@ -1361,7 +1361,7 @@ static bool SideInBrush( side_t& side, const brush_t& b ){
culls obscured or buried brushsides from the map
*/
static void CullSides( entity_t *e ){
static void CullSides( entity_t& e ){
int k, l, first, second, dir;
@ -1372,7 +1372,7 @@ static void CullSides( entity_t *e ){
g_numCoinFaces = 0;
/* brush interator 1 */
for ( brushlist_t::iterator b1 = e->brushes.begin(); b1 != e->brushes.end(); ++b1 )
for ( brushlist_t::iterator b1 = e.brushes.begin(); b1 != e.brushes.end(); ++b1 )
{
/* sides check */
if ( b1->sides.empty() ) {
@ -1380,7 +1380,7 @@ static void CullSides( entity_t *e ){
}
/* brush iterator 2 */
for ( brushlist_t::iterator b2 = std::next( b1 ); b2 != e->brushes.end(); ++b2 )
for ( brushlist_t::iterator b2 = std::next( b1 ); b2 != e.brushes.end(); ++b2 )
{
/* sides check */
if ( b2->sides.empty() ) {
@ -1542,7 +1542,7 @@ static void CullSides( entity_t *e ){
to be trimmed off automatically.
*/
void ClipSidesIntoTree( entity_t *e, const tree_t& tree ){
void ClipSidesIntoTree( entity_t& e, const tree_t& tree ){
/* ydnar: cull brush sides */
CullSides( e );
@ -1550,7 +1550,7 @@ void ClipSidesIntoTree( entity_t *e, const tree_t& tree ){
Sys_FPrintf( SYS_VRB, "--- ClipSidesIntoTree ---\n" );
/* walk the brush list */
for ( brush_t& b : e->brushes )
for ( brush_t& b : e.brushes )
{
/* walk the brush sides */
for ( side_t& side : b.sides )
@ -2198,9 +2198,9 @@ static void EmitFlareSurface( mapDrawSurface_t *ds ){
emits a bsp patch drawsurface
*/
static void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds ){
static void EmitPatchSurface( const entity_t& e, mapDrawSurface_t *ds ){
/* vortex: _patchMeta support */
const bool forcePatchMeta = e->boolForKey( "_patchMeta", "patchMeta" );
const bool forcePatchMeta = e.boolForKey( "_patchMeta", "patchMeta" );
/* invert the surface if necessary */
if ( ds->backSide || ds->shaderInfo->invert ) {
@ -2636,7 +2636,7 @@ void MakeDebugPortalSurfs( const tree_t& tree ){
generates drawsurfaces for a foghull (this MUST use a sky shader)
*/
void MakeFogHullSurfs( entity_t *e, const char *shader ){
void MakeFogHullSurfs( const char *shader ){
shaderInfo_t *si;
mapDrawSurface_t *ds;
int indexes[] =
@ -3005,16 +3005,13 @@ static int AddSurfaceModels( mapDrawSurface_t *ds, entity_t& entity ){
adds surfacemodels to an entity's surfaces
*/
void AddEntitySurfaceModels( entity_t *e ){
int i;
void AddEntitySurfaceModels( entity_t& e ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- AddEntitySurfaceModels ---\n" );
/* walk the surface list */
for ( i = e->firstDrawSurf; i < numMapDrawSurfs; i++ )
numSurfaceModels += AddSurfaceModels( &mapDrawSurfs[ i ], *e );
for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i )
numSurfaceModels += AddSurfaceModels( &mapDrawSurfs[ i ], e );
}
@ -3024,9 +3021,9 @@ void AddEntitySurfaceModels( entity_t *e ){
applies brush/volumetric color/alpha modulation to vertexes
*/
static void VolumeColorMods( entity_t *e, mapDrawSurface_t *ds ){
static void VolumeColorMods( const entity_t& e, mapDrawSurface_t *ds ){
/* iterate brushes */
for ( const brush_t *b : e->colorModBrushes )
for ( const brush_t *b : e.colorModBrushes )
{
/* worldspawn alpha brushes affect all, grouped ones only affect original entity */
if ( b->entityNum != 0 && b->entityNum != ds->entityNum ) {
@ -3041,20 +3038,10 @@ static void VolumeColorMods( entity_t *e, mapDrawSurface_t *ds ){
/* iterate verts */
for ( bspDrawVert_t& vert : Span( ds->verts, ds->numVerts ) )
{
/* iterate planes */
size_t j;
for ( j = 0; j < b->sides.size(); ++j )
{
/* point-plane test */
if ( plane3_distance_to_point( mapplanes[ b->sides[ j ].planenum ].plane, vert.xyz ) > 1.0f ) {
break;
}
}
/* apply colormods */
if ( j == b->sides.size() ) {
if( std::none_of( b->sides.cbegin(), b->sides.cend(), [&vert]( const side_t& side ){
return plane3_distance_to_point( mapplanes[ side.planenum ].plane, vert.xyz ) > 1.0f; } ) ) /* point-plane test */
/* apply colormods */
ColorMod( b->contentShader->colorMod, 1, &vert );
}
}
}
}
@ -3068,7 +3055,7 @@ static void VolumeColorMods( entity_t *e, mapDrawSurface_t *ds ){
will have valid final indexes
*/
void FilterDrawsurfsIntoTree( entity_t *e, tree_t& tree ){
void FilterDrawsurfsIntoTree( entity_t& e, tree_t& tree ){
int refs;
int numSurfs, numRefs, numSkyboxSurfaces;
bool sb;
@ -3081,7 +3068,7 @@ void FilterDrawsurfsIntoTree( entity_t *e, tree_t& tree ){
numSurfs = 0;
numRefs = 0;
numSkyboxSurfaces = 0;
for ( int i = e->firstDrawSurf; i < numMapDrawSurfs; ++i )
for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
/* get surface and try to early out */
mapDrawSurface_t *ds = &mapDrawSurfs[ i ];
@ -3122,12 +3109,12 @@ void FilterDrawsurfsIntoTree( entity_t *e, tree_t& tree ){
/* ydnar/sd: make foliage surfaces */
if ( !si->foliage.empty() ) {
Foliage( ds, *e );
Foliage( ds, e );
}
/* create a flare surface if necessary */
if ( !strEmptyOrNull( si->flareShader ) ) {
AddSurfaceFlare( ds, e->origin );
AddSurfaceFlare( ds, e.origin );
}
/* ydnar: don't emit nodraw surfaces (like nodraw fog) */
@ -3139,9 +3126,9 @@ void FilterDrawsurfsIntoTree( entity_t *e, tree_t& tree ){
BiasSurfaceTextures( ds );
/* ydnar: globalizing of fog volume handling (eek a hack) */
if ( e != &entities[0] && !si->noFog ) {
if ( &e != &entities[0] && !si->noFog ) {
/* offset surface by entity origin */
const MinMax minmax( ds->minmax.mins + e->origin, ds->minmax.maxs + e->origin );
const MinMax minmax( ds->minmax.mins + e.origin, ds->minmax.maxs + e.origin );
/* set the fog number for this surface */
ds->fogNum = FogForBounds( minmax, 1.0f ); //% FogForPoint( origin, 0.0f );

View File

@ -341,13 +341,13 @@ static void SurfaceToMetaTriangles( mapDrawSurface_t *ds ){
creates triangles from a patch
*/
static void TriangulatePatchSurface( entity_t *e, mapDrawSurface_t *ds ){
static void TriangulatePatchSurface( const entity_t& e, mapDrawSurface_t *ds ){
int x, y, pw[ 5 ], r;
mapDrawSurface_t *dsNew;
mesh_t src, *subdivided, *mesh;
/* vortex: _patchMeta, _patchQuality, _patchSubdivide support */
const bool forcePatchMeta = e->boolForKey( "_patchMeta", "patchMeta" );
const bool forcePatchMeta = e.boolForKey( "_patchMeta", "patchMeta" );
/* try to early out */
if ( ds->numVerts == 0 || ds->type != ESurfaceType::Patch || ( !patchMeta && !forcePatchMeta ) ) {
@ -361,11 +361,11 @@ static void TriangulatePatchSurface( entity_t *e, mapDrawSurface_t *ds ){
int iterations;
int patchSubdivision;
if ( e->read_keyvalue( patchSubdivision, "_patchSubdivide", "patchSubdivide" ) ) {
if ( e.read_keyvalue( patchSubdivision, "_patchSubdivide", "patchSubdivide" ) ) {
iterations = IterationsForCurve( ds->longestCurve, patchSubdivision );
}
else{
const int patchQuality = e->intForKey( "_patchQuality", "patchQuality" );
const int patchQuality = e.intForKey( "_patchQuality", "patchQuality" );
iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions / ( patchQuality == 0? 1 : patchQuality ) );
}
@ -855,7 +855,7 @@ void EmitMetaStats(){
builds meta triangles from brush faces (tristrips and fans)
*/
void MakeEntityMetaTriangles( entity_t *e ){
void MakeEntityMetaTriangles( const entity_t& e ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- MakeEntityMetaTriangles ---\n" );
@ -864,10 +864,10 @@ void MakeEntityMetaTriangles( entity_t *e ){
Timer timer;
/* walk the list of surfaces in the entity */
for ( int i = e->firstDrawSurf; i < numMapDrawSurfs; ++i )
for ( int i = e.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
/* print pacifier */
if ( const int f = 10 * ( i - e->firstDrawSurf ) / ( numMapDrawSurfs - e->firstDrawSurf ); f != fOld ) {
if ( const int f = 10 * ( i - e.firstDrawSurf ) / ( numMapDrawSurfs - e.firstDrawSurf ); f != fOld ) {
fOld = f;
Sys_FPrintf( SYS_VRB, "%d...", f );
}
@ -920,7 +920,7 @@ void MakeEntityMetaTriangles( entity_t *e ){
}
/* print time */
if ( ( numMapDrawSurfs - e->firstDrawSurf ) ) {
if ( ( numMapDrawSurfs - e.firstDrawSurf ) ) {
Sys_FPrintf( SYS_VRB, " (%d)\n", int( timer.elapsed_sec() ) );
}

View File

@ -548,7 +548,7 @@ static bool FixBrokenSurface( mapDrawSurface_t& ds ){
call after the surface list has been pruned
*/
void FixTJunctions( entity_t *ent ){
void FixTJunctions( const entity_t& ent ){
int axialEdgeLines;
/* meta mode has its own t-junction code (currently not as good as this code) */
@ -564,7 +564,7 @@ void FixTJunctions( entity_t *ent ){
// this actually creates axial edges, but it
// only creates originalEdge_t structures
// for non-axial edges
for ( int i = ent->firstDrawSurf; i < numMapDrawSurfs; ++i )
for ( int i = ent.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
/* get surface and early out if possible */
mapDrawSurface_t& ds = mapDrawSurfs[ i ];
@ -610,7 +610,7 @@ void FixTJunctions( entity_t *ent ){
Sys_FPrintf( SYS_VRB, "%9d degenerate edges\n", c_degenerateEdges );
// insert any needed vertexes
for ( int i = ent->firstDrawSurf; i < numMapDrawSurfs; ++i )
for ( int i = ent.firstDrawSurf; i < numMapDrawSurfs; ++i )
{
/* get surface and early out if possible */
mapDrawSurface_t& ds = mapDrawSurfs[ i ];

View File

@ -534,7 +534,7 @@ void BeginModel( const entity_t& e ){
finish a model's processing
*/
void EndModel( entity_t *e, node_t *headnode ){
void EndModel( const entity_t& e, node_t *headnode ){
/* note it */
Sys_FPrintf( SYS_VRB, "--- EndModel ---\n" );
@ -544,6 +544,6 @@ void EndModel( entity_t *e, node_t *headnode ){
/* set surfaces and brushes */
mod.numBSPSurfaces = bspDrawSurfaces.size() - mod.firstBSPSurface;
mod.firstBSPBrush = e->firstBrush;
mod.numBSPBrushes = e->numBrushes;
mod.firstBSPBrush = e.firstBrush;
mod.numBSPBrushes = e.numBrushes;
}