Skip to content

Commit

Permalink
vk: rt: allow hiding all SURF_DRAWSKY surfaces while retaining skybox
Browse files Browse the repository at this point in the history
Neede for getting rid of some skybox 𝘱𝘦𝘯𝘦𝘵𝘳𝘢𝘵𝘪𝘰𝘯 glitches, see #579
  • Loading branch information
w23 committed Dec 14, 2023
1 parent 3cbc11a commit 6fc3181
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ref/vk/TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 2023-12-14 E346
# 2023-12-14 E346-E347
- [x] Optimize skybox loading, #706
- [x] Do not load skybox when there are no SURF_DRAWSKY, #579
- [x] Do not reload the same skybox
Expand Down
15 changes: 8 additions & 7 deletions ref/vk/data/valve/luchiki/maps/c2a5.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"_xvk_ent_id" "246" // DANGER sign
"origin" "1 0 0"
}
{
"_xvk_smoothing_threshold" "54" // FIXME
}
{
"_xvk_ent_id" "246" // DANGER sign
"origin" "1 0 0"
}
{
"_xvk_smoothing_threshold" "54" // FIXME
"_xvk_remove_all_sky_surfaces" "1"
}
8 changes: 7 additions & 1 deletion ref/vk/vk_brush.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,10 @@ static model_sizes_t computeSizes( const model_t *mod, qboolean is_worldmodel )
break;
case BrushSurface_Sky:
sizes.sky_surfaces_count++;

// Do not count towards surfaces that we'll load (still need to count if for the purpose of loading skybox)
if (g_map_entities.remove_all_sky_surfaces)
continue;
break;
case BrushSurface_Regular:
break;
Expand Down Expand Up @@ -1321,8 +1325,10 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
break;
case BrushSurface_Conveyor:
break;
case BrushSurface_Regular:
case BrushSurface_Sky:
if (g_map_entities.remove_all_sky_surfaces)
continue;
case BrushSurface_Regular:
break;
}

Expand Down
5 changes: 5 additions & 0 deletions ref/vk/vk_mapents.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ static void parseEntities( char *string, qboolean is_patch ) {
if (have_fields & Field__xvk_smoothing_group) {
addSmoothingGroup(&values);
}

if (have_fields & Field__xvk_remove_all_sky_surfaces) {
DEBUG("_xvk_remove_all_sky_surfaces=%d", values._xvk_remove_all_sky_surfaces);
g_map_entities.remove_all_sky_surfaces = values._xvk_remove_all_sky_surfaces;
}
}
}
break;
Expand Down
3 changes: 3 additions & 0 deletions ref/vk/vk_mapents.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
X(25, int, _xvk_smooth_entire_model, Int) \
X(26, int_array_t, _xvk_smoothing_excluded, IntArray) \
X(27, float, _xvk_tex_rotate, Float) \
X(28, int, _xvk_remove_all_sky_surfaces, Int) \

/* NOTE: not used
X(23, int, renderamt, Int) \
Expand Down Expand Up @@ -175,6 +176,8 @@ typedef struct {
int excluded_count;
int excluded[MAX_EXCLUDED_SMOOTHING_SURFACES];
} smoothing;

qboolean remove_all_sky_surfaces;
} xvk_map_entities_t;

// TODO expose a bunch of things here as funtions, not as internal structures
Expand Down

0 comments on commit 6fc3181

Please sign in to comment.