mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
no longer tessellating in RB_SurfaceSizeGrid
This commit is contained in:
parent
e3f0afc117
commit
457ca2ab65
2 changed files with 24 additions and 9 deletions
|
@ -524,6 +524,8 @@ struct drawSurf_t {
|
|||
|
||||
void R_TessellateSurface( const surfaceType_t* surfType );
|
||||
void R_ComputeTessellatedSize( int* numVertexes, int* numIndexes, const surfaceType_t* surfType );
|
||||
// R_ComputeTessellatedSize is unused for now but might be of use a bit later
|
||||
// we can use it to compute the required size of the static geometry buffers in the GRP
|
||||
|
||||
|
||||
struct litSurf_t {
|
||||
|
|
|
@ -868,15 +868,28 @@ static void RB_SurfaceSizeFace( int* numVertexes, int* numIndexes, const srfSurf
|
|||
|
||||
static void RB_SurfaceSizeGrid( int* numVertexes, int* numIndexes, const srfGridMesh_t* surf )
|
||||
{
|
||||
// @TODO: estimate properly...
|
||||
// @TODO: this can overflow and call the old EndSurface/BeginSurface pair...
|
||||
const int prevNumVertexes = tess.numVertexes;
|
||||
const int prevNumIndexes = tess.numIndexes;
|
||||
RB_SurfaceGrid((srfGridMesh_t*)surf);
|
||||
*numVertexes = tess.numVertexes - prevNumVertexes;
|
||||
*numIndexes = tess.numIndexes - prevNumIndexes;
|
||||
tess.numVertexes = prevNumVertexes;
|
||||
tess.numIndexes = prevNumIndexes;
|
||||
srfGridMesh_t* const cv = (srfGridMesh_t*)surf;
|
||||
|
||||
const float lodError = LodErrorForVolume( cv->lodOrigin, cv->lodRadius );
|
||||
|
||||
int lodWidth = 1;
|
||||
for ( int i = 1; i < cv->width - 1; i++ ) {
|
||||
if ( cv->widthLodError[i] <= lodError ) {
|
||||
lodWidth++;
|
||||
}
|
||||
}
|
||||
lodWidth++;
|
||||
|
||||
int lodHeight = 1;
|
||||
for ( int i = 1; i < cv->height - 1; i++ ) {
|
||||
if ( cv->heightLodError[i] <= lodError ) {
|
||||
lodHeight++;
|
||||
}
|
||||
}
|
||||
lodHeight++;
|
||||
|
||||
*numVertexes = lodWidth * lodHeight;
|
||||
*numIndexes = max( lodWidth - 1, 0 ) * max( lodHeight - 1, 0 ) * 6;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue