vk: add emissive water surfaces to polygon lights

Makes acid water surfaces emissive again.
However, they are not assinged proper emissive color values for direct
ray hits yet, so they do emit light, but look dar still.

Ref: #56
This commit is contained in:
Ivan Avdeev 2023-11-16 09:56:21 -05:00
parent 1040a9608d
commit e4d7858330
2 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,10 @@
# 2023-11-16 E331
- [ ] Emissive waters
- [x] add emissive water surface to polygon lights
- [ ] update emissive color for water surfaces
- [ ] dynamic UVs
- [ ] discuss integration test strategies
# 2023-11-14 E330
- [x] culling worldmodel waters
- [-] try simple flag culling (probably won't work)
@ -8,7 +15,6 @@
- [x] water -- doesn't seem to have 2nd face
- [x] glpoly_t winding order is reversed when camera origin is opposite to (SURF_PLANEBACK-aware) surface normal
- [x] discuss culling transparent surfaces strategies
- [ ] discuss integration test strategies
# 2023-11-13 E329
- [-] culling -> need to cull everything except opaque and blend. Alpha-mask is culled.

View File

@ -1242,7 +1242,6 @@ static qboolean fillBrushSurfaces(fill_geometries_args_t args) {
const xvk_mapent_func_any_t *const entity_patch = getModelFuncAnyPatch(args.mod);
connectVertices(args.mod, entity_patch ? entity_patch->smooth_entire_model : false);
// Load sorted by gl_texturenum
// TODO this does not make that much sense in vulkan (can sort later)
for (int t = 0; t <= args.sizes.max_texture_id; ++t) {
@ -1457,6 +1456,8 @@ static qboolean createRenderModel( const model_t *mod, vk_brush_model_t *bmodel,
vk_render_geometry_t *const geometries = Mem_Malloc(vk_core.pool, sizeof(vk_render_geometry_t) * sizes.num_surfaces);
bmodel->surface_to_geometry_index = Mem_Malloc(vk_core.pool, sizeof(int) * mod->nummodelsurfaces);
for (int i = 0; i < mod->nummodelsurfaces; ++i)
bmodel->surface_to_geometry_index[i] = -1;
bmodel->animated_indexes = Mem_Malloc(vk_core.pool, sizeof(int) * sizes.animated_count);
bmodel->animated_indexes_count = sizes.animated_count;
@ -1654,6 +1655,7 @@ void R_VkBrushModelCollectEmissiveSurfaces( const struct model_s *mod, qboolean
switch (getSurfaceType(surf, surface_index, is_worldmodel)) {
case BrushSurface_Regular:
case BrushSurface_Animated:
case BrushSurface_Water:
break;
default:
continue;
@ -1726,9 +1728,15 @@ void R_VkBrushModelCollectEmissiveSurfaces( const struct model_s *mod, qboolean
}
// Assign the emissive value to the right geometry
const int geom_index = bmodel->surface_to_geometry_index[s->model_surface_index];
geom_indices[i] = geom_index;
VectorCopy(polylight.emissive, bmodel->render_model.geometries[geom_index].emissive);
if (bmodel->surface_to_geometry_index) {
const int geom_index = bmodel->surface_to_geometry_index[s->model_surface_index];
if (geom_index != -1) {
ASSERT(geom_index >= 0);
ASSERT(geom_index < bmodel->render_model.num_geometries);
geom_indices[i] = geom_index;
VectorCopy(polylight.emissive, bmodel->render_model.geometries[geom_index].emissive);
}
}
}
if (emissive_surfaces_count > 0) {