From de097849adfa7a1ede08d3d0cce0e6bdf0de6482 Mon Sep 17 00:00:00 2001 From: Garux Date: Fri, 28 Mar 2025 03:14:08 +0500 Subject: [PATCH] * handle patch lodbounds in -shift and -scale --- docs/changelog-custom.txt | 1 + tools/quake3/q3map2/convert_bsp.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/changelog-custom.txt b/docs/changelog-custom.txt index 471f3be1..e815fb04 100644 --- a/docs/changelog-custom.txt +++ b/docs/changelog-custom.txt @@ -181,6 +181,7 @@ Q3map2: * fix deformvertexes autosprite2 on brushes and models * tighten FilterPatchIntoTree() regarding to even (pink) points * fix tiny structural brushes breaking bsp tree + * handle patch lodbounds in -shift and -scale diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index d4c67017..b97d50ff 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -469,6 +469,15 @@ int ScaleBSPMain( Args& args ){ leaf.minmax.maxs = scale * leaf.minmax.maxs; } + /* scale patch lodbounds */ + for ( bspDrawSurface_t& surf : bspDrawSurfaces ) + { + if ( surf.surfaceType == MST_PATCH ){ + surf.lightmapVecs[0] *= scale; + surf.lightmapVecs[1] *= scale; + } + } + if ( texscale ) { Sys_Printf( "Using texture unlocking (and probably breaking texture alignment a lot)\n" ); old_xyzst = bspDrawVerts; @@ -628,6 +637,15 @@ int ShiftBSPMain( Args& args ){ leaf.minmax.maxs += shift; } + /* shift patch lodbounds */ + for ( bspDrawSurface_t& surf : bspDrawSurfaces ) + { + if ( surf.surfaceType == MST_PATCH ){ + surf.lightmapVecs[0] += shift; + surf.lightmapVecs[1] += shift; + } + } + /* shift drawverts */ for ( bspDrawVert_t& vert : bspDrawVerts ) {