std::vector<bspDrawVert_t> yDrawVerts

This commit is contained in:
Garux 2021-09-27 21:50:46 +03:00
parent 86a8b5f1eb
commit d1ccdb0fcf
4 changed files with 9 additions and 14 deletions

View File

@ -550,12 +550,8 @@ void CreateSurfaceLights( void ){
*/
void SetEntityOrigins( void ){
int j, k, f;
/* ydnar: copy drawverts into private storage for nefarious purposes */
yDrawVerts = safe_malloc( bspDrawVerts.size() * sizeof( bspDrawVert_t ) );
memcpy( yDrawVerts, bspDrawVerts.data(), bspDrawVerts.size() * sizeof( bspDrawVert_t ) );
yDrawVerts = bspDrawVerts;
/* set the entity origins */
for ( const auto& e : entities )
@ -575,16 +571,15 @@ void SetEntityOrigins( void ){
}
/* set origin for all surfaces for this model */
for ( j = 0; j < dm.numBSPSurfaces; j++ )
for ( int j = 0; j < dm.numBSPSurfaces; j++ )
{
/* get drawsurf */
const bspDrawSurface_t& ds = bspDrawSurfaces[ dm.firstBSPSurface + j ];
/* set its verts */
for ( k = 0; k < ds.numVerts; k++ )
for ( int k = 0; k < ds.numVerts; k++ )
{
f = ds.firstVert + k;
yDrawVerts[ f ].xyz = origin + bspDrawVerts[ f ].xyz;
yDrawVerts[ ds.firstVert + k ].xyz += origin;
}
}
}

View File

@ -974,7 +974,7 @@ void MapRawLightmap( int rawLightmapNum ){
{
case MST_PLANAR:
/* get verts */
verts = yDrawVerts + ds->firstVert;
verts = &yDrawVerts[ ds->firstVert ];
/* map the triangles */
for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ )
@ -2600,7 +2600,7 @@ void IlluminateVertexes( int num ){
CreateTraceLightsForSurface( num, &trace );
/* setup */
verts = yDrawVerts + ds->firstVert;
verts = &yDrawVerts[ ds->firstVert ];
numAvg = 0;
memset( avgColors, 0, sizeof( avgColors ) );
@ -2825,7 +2825,7 @@ void IlluminateVertexes( int num ){
maxRadius = std::max( lm->sw, lm->sh );
/* walk the surface verts */
verts = yDrawVerts + ds->firstVert;
verts = &yDrawVerts[ ds->firstVert ];
for ( i = 0; i < ds->numVerts; i++ )
{
/* do each lightmap */

View File

@ -1673,7 +1673,7 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){
{
case MST_PLANAR:
/* get verts */
verts = yDrawVerts + ds->firstVert;
verts = &yDrawVerts[ ds->firstVert ];
/* map the triangles */
info->approximated = true;

View File

@ -2217,7 +2217,7 @@ Q_EXTERN int numTriangleDiffuseLights;
Q_EXTERN int numPatchDiffuseLights;
/* ydnar: general purpose extra copy of drawvert list */
Q_EXTERN bspDrawVert_t *yDrawVerts;
Q_EXTERN std::vector<bspDrawVert_t> yDrawVerts;
Q_EXTERN int defaultLightSubdivide Q_ASSIGN( 999 );