Skip to content

Commit

Permalink
vk: handle emissive brush surfaces earlier in the loading loop
Browse files Browse the repository at this point in the history
This makes c0a0d toxic pool emissive again, but it still doesn't make all known toxic water objects emissive.
  • Loading branch information
w23 committed Dec 18, 2024
1 parent e76d6d9 commit 8fb8ede
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions ref/vk/vk_brush.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "vk_brush.h"

#include "vk_core.h"
#include "vk_const.h"
#include "vk_math.h"
#include "r_textures.h"
#include "vk_lightmap.h"
Expand All @@ -10,7 +9,6 @@
#include "vk_light.h"
#include "vk_mapents.h"
#include "r_speeds.h"
#include "vk_staging.h"
#include "vk_logs.h"
#include "profiler.h"
#include "arrays.h"
Expand Down Expand Up @@ -1408,6 +1406,24 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
const xvk_patch_surface_t *const psurf = R_VkPatchGetSurface(surface_index);

const brush_surface_type_e type = getSurfaceType(surf, surface_index, args.is_worldmodel);

// Check whether this surface is emissive early, before bailing out on surface type.
// TODO consider moving this to outside of this loop, as it still might skip some surfaces
// e.g. if the model doesn't have any static surfaces at all.
surfaceHandleEmissive((SurfaceHandleEmissiveArgs){
.mod = args.mod,
.func_any = args.func_any,
.is_static = args.is_static,
.bmodel = args.bmodel,
.surf = surf,
.surface_index = surface_index,
.type = type,
.tex_id = tex_id,
.psurf = psurf,
.model_geometry = model_geometry,
.emissive_surfaces_count = &emissive_surfaces_count,
});

switch (type) {
case BrushSurface_Water:
case BrushSurface_WaterSide:
Expand Down Expand Up @@ -1495,20 +1511,6 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
if (type == BrushSurface_Animated)
model_geometry->ye_olde_texture = -1;

surfaceHandleEmissive((SurfaceHandleEmissiveArgs){
.mod = args.mod,
.func_any = args.func_any,
.is_static = args.is_static,
.bmodel = args.bmodel,
.surf = surf,
.surface_index = surface_index,
.type = type,
.tex_id = tex_id,
.psurf = psurf,
.model_geometry = model_geometry,
.emissive_surfaces_count = &emissive_surfaces_count,
});

model_geometry->surf_deprecate = surf;

model_geometry->vertex_offset = args.base_vertex_offset;
Expand Down

0 comments on commit 8fb8ede

Please sign in to comment.