From b3ff10b2874fa284d2b71c2f6db370e0dcbd1a69 Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 18 Dec 2024 08:22:00 +0500 Subject: [PATCH] * add prefs->Build->Region Box Shader (shader to use on the box generated around region) --- docs/changelog-custom.txt | 1 + radiant/brushmanip.cpp | 13 +++++++++++-- radiant/watchbsp.cpp | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/changelog-custom.txt b/docs/changelog-custom.txt index c6ca755e..37ed74ab 100644 --- a/docs/changelog-custom.txt +++ b/docs/changelog-custom.txt @@ -1098,6 +1098,7 @@ misc... * fix: do not modify light intensity on transformations besides light radius transformation * light radiuses: don't render biggest radius, make them less occluding in 3D * fix surface inspector updates on patch texturing changes, on UV Tool edits + * add prefs->Build->Region Box Shader (shader to use on the box generated around region) diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index e81f4867..ded008f0 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -463,7 +463,16 @@ void Brush_ConstructPrefab( Brush& brush, EBrushPrefab type, const AABB& bounds, } +CopiedString g_regionBoxShader; + void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins, const Vector3& region_maxs ){ + const char *shader = g_regionBoxShader.empty() + ? texdef_name_default() + : texdef_name_valid( g_regionBoxShader.c_str() ) + ? g_regionBoxShader.c_str() + : ( globalWarningStream() << "g_regionBoxShader " << makeQuoted( g_regionBoxShader ) << " !texdef_name_valid()\n" + , texdef_name_default() ); + { // set mins const Vector3 mins( region_mins - Vector3( 32 ) ); @@ -473,7 +482,7 @@ void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins { Vector3 maxs( region_maxs + Vector3( 32 ) ); maxs[i] = region_mins[i]; - Brush_ConstructCuboid( *Node_getBrush( *brushes[i] ), aabb_for_minmax( mins, maxs ), texdef_name_default(), TextureProjection() ); + Brush_ConstructCuboid( *Node_getBrush( *brushes[i] ), aabb_for_minmax( mins, maxs ), shader, TextureProjection() ); } } @@ -486,7 +495,7 @@ void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins { Vector3 mins( region_mins - Vector3( 32 ) ); mins[i] = region_maxs[i]; - Brush_ConstructCuboid( *Node_getBrush( *brushes[i + 3] ), aabb_for_minmax( mins, maxs ), texdef_name_default(), TextureProjection() ); + Brush_ConstructCuboid( *Node_getBrush( *brushes[i + 3] ), aabb_for_minmax( mins, maxs ), shader, TextureProjection() ); } } } diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index 6b181eda..e30b9a63 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -222,6 +222,8 @@ static DefaultableString g_engineExecutableMP( []()->CopiedString{ return g_pGam static DefaultableString g_engineArgs( constructEngineArgs ); static DefaultableString g_engineArgsMP( constructEngineArgs ); +extern CopiedString g_regionBoxShader; + void Build_constructPreferences( PreferencesPage& page ){ QCheckBox* monitorbsp = page.appendCheckBox( "", "Enable Build Process Monitoring", g_WatchBSP_Enabled ); @@ -242,6 +244,8 @@ void Build_constructPreferences( PreferencesPage& page ){ } page.appendCheckBox( "", "Dump non Monitored Builds Log", g_WatchBSP0_DumpLog ); + + page.appendEntry( "Region Box Shader", g_regionBoxShader ); } void Build_constructPage( PreferenceGroup& group ){ PreferencesPage page( group.createPage( "Build", "Build Preferences" ) ); @@ -267,7 +271,7 @@ void BuildMonitor_Construct(){ GlobalPreferenceSystem().registerPreference( "BuildEngineArgs", g_engineArgs.getImportCaller(), g_engineArgs.getExportCaller() ); GlobalPreferenceSystem().registerPreference( "BuildEngineArgsMP", g_engineArgsMP.getImportCaller(), g_engineArgsMP.getExportCaller() ); GlobalPreferenceSystem().registerPreference( "BuildDumpLog", BoolImportStringCaller( g_WatchBSP0_DumpLog ), BoolExportStringCaller( g_WatchBSP0_DumpLog ) ); - + GlobalPreferenceSystem().registerPreference( "RegionBoxShader", CopiedStringImportStringCaller( g_regionBoxShader ), CopiedStringExportStringCaller( g_regionBoxShader ) ); Build_registerPreferencesPage(); }