mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-29 23:32:03 +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_TessellateSurface( const surfaceType_t* surfType );
|
||||||
void R_ComputeTessellatedSize( int* numVertexes, int* numIndexes, 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 {
|
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 )
|
static void RB_SurfaceSizeGrid( int* numVertexes, int* numIndexes, const srfGridMesh_t* surf )
|
||||||
{
|
{
|
||||||
// @TODO: estimate properly...
|
srfGridMesh_t* const cv = (srfGridMesh_t*)surf;
|
||||||
// @TODO: this can overflow and call the old EndSurface/BeginSurface pair...
|
|
||||||
const int prevNumVertexes = tess.numVertexes;
|
const float lodError = LodErrorForVolume( cv->lodOrigin, cv->lodRadius );
|
||||||
const int prevNumIndexes = tess.numIndexes;
|
|
||||||
RB_SurfaceGrid((srfGridMesh_t*)surf);
|
int lodWidth = 1;
|
||||||
*numVertexes = tess.numVertexes - prevNumVertexes;
|
for ( int i = 1; i < cv->width - 1; i++ ) {
|
||||||
*numIndexes = tess.numIndexes - prevNumIndexes;
|
if ( cv->widthLodError[i] <= lodError ) {
|
||||||
tess.numVertexes = prevNumVertexes;
|
lodWidth++;
|
||||||
tess.numIndexes = prevNumIndexes;
|
}
|
||||||
|
}
|
||||||
|
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