vk: make transparent brushes closer to gl

some of render modes are not affected by light, disable lightmaps for them
This commit is contained in:
Ivan 'provod' Avdeev 2023-02-24 23:54:41 -08:00
parent 03efb6ce83
commit cd524c20cf
3 changed files with 10 additions and 2 deletions

View File

@ -358,6 +358,10 @@ void VK_BrushModelDraw( const cl_entity_t *ent, int render_mode, float blend, co
Vector4Set(bmodel->render_model.color, 1, 1, 1, blend);
}
// Only Normal and TransAlpha have lightmaps
// TODO: on big maps more than a single lightmap texture is possible
bmodel->render_model.lightmap = (render_mode == kRenderNormal || render_mode == kRenderTransAlpha) ? 1 : 0;
if (bmodel->num_water_surfaces) {
brushDrawWaterSurfaces(ent, bmodel->render_model.color);
}

View File

@ -674,6 +674,8 @@ void VK_RenderModelDraw( const cl_entity_t *ent, vk_render_model_t* model ) {
// TODO get rid of this dirty ubo thing
Vector4Copy(model->color, g_render_state.dirty_uniform_data.color);
ASSERT(model->lightmap <= MAX_LIGHTMAPS);
const int lightmap = model->lightmap > 0 ? tglob.lightmapTextures[model->lightmap - 1] : tglob.whiteTexture;
if (g_render_state.current_frame_is_ray_traced) {
if (ent != NULL && model != NULL) {
@ -706,7 +708,7 @@ void VK_RenderModelDraw( const cl_entity_t *ent, vk_render_model_t* model ) {
if (split) {
if (element_count) {
render_draw_t draw = {
.lightmap = tglob.lightmapTextures[0], // FIXME there can be more than one lightmap textures
.lightmap = lightmap,
.texture = current_texture,
.render_mode = model->render_mode,
.element_count = element_count,
@ -730,7 +732,7 @@ void VK_RenderModelDraw( const cl_entity_t *ent, vk_render_model_t* model ) {
if (element_count) {
const render_draw_t draw = {
.lightmap = tglob.lightmapTextures[0],
.lightmap = lightmap,
.texture = current_texture,
.render_mode = model->render_mode,
.element_count = element_count,
@ -761,6 +763,7 @@ void VK_RenderModelDynamicBegin( int render_mode, const vec4_t color, const char
g_dynamic_model.model.geometries = g_dynamic_model.geometries;
g_dynamic_model.model.num_geometries = 0;
g_dynamic_model.model.render_mode = render_mode;
g_dynamic_model.model.lightmap = 0;
Vector4Copy(color, g_dynamic_model.model.color);
}
void VK_RenderModelDynamicAddGeometry( const vk_render_geometry_t *geom ) {

View File

@ -69,6 +69,7 @@ typedef struct vk_render_model_s {
// FIXME: brushes, sprites, studio models, etc all treat render_mode differently
int render_mode;
vec4_t color;
int lightmap; // <= 0 if no lightmap
int num_geometries;
vk_render_geometry_t *geometries;