Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shadow map generation for briefing #3509

Merged
merged 1 commit into from Jun 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 17 additions & 4 deletions code/missionui/missionbrief.cpp
Expand Up @@ -21,6 +21,7 @@
#include "globalincs/linklist.h"
#include "graphics/font.h"
#include "graphics/matrix.h"
#include "graphics/shadows.h"
#include "hud/hud.h"
#include "io/key.h"
#include "io/mouse.h"
Expand Down Expand Up @@ -1045,10 +1046,6 @@ void brief_render_closeup(int ship_class, float frametime)

g3_start_frame(1);
g3_set_view_matrix(&Closeup_cam_pos, &view_orient, Closeup_zoom);


gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
gr_set_view_matrix(&Eye_position, &Eye_matrix);

// the following is copied from menuui/techmenu.cpp ... it works heehee :D - delt.
// lighting for techroom
Expand All @@ -1070,13 +1067,29 @@ void brief_render_closeup(int ship_class, float frametime)
model_render_params render_info;
render_info.set_detail_level_lock(0);

if (Shadow_quality != ShadowQuality::Disabled)
{
auto pm = model_get(Closeup_icon->modelnum);

gr_reset_clip();
shadows_start_render(&Eye_matrix, &Eye_position, Proj_fov, gr_screen.clip_aspect, -Closeup_cam_pos.xyz.z + pm->rad, -Closeup_cam_pos.xyz.z + pm->rad + 200.0f, -Closeup_cam_pos.xyz.z + pm->rad + 2000.0f, -Closeup_cam_pos.xyz.z + pm->rad + 10000.0f);
render_info.set_flags(MR_NO_TEXTURING | MR_NO_LIGHTING | MR_AUTOCENTER);

model_render_immediate(&render_info, Closeup_icon->modelnum, Closeup_icon->model_instance_num, &Closeup_orient, &Closeup_pos);
shadows_end_render();
gr_set_clip(Closeup_region[gr_screen.res][0], Closeup_region[gr_screen.res][1], w, h, GR_RESIZE_MENU);
}

if ( Closeup_icon->type == ICON_JUMP_NODE) {
render_info.set_color(HUD_color_red, HUD_color_green, HUD_color_blue);
render_info.set_flags(MR_NO_LIGHTING | MR_AUTOCENTER | MR_NO_POLYS | MR_SHOW_OUTLINE_HTL | MR_NO_TEXTURING);
} else {
render_info.set_flags(MR_AUTOCENTER);
}

gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
gr_set_view_matrix(&Eye_position, &Eye_matrix);

model_render_immediate( &render_info, Closeup_icon->modelnum, Closeup_icon->model_instance_num, &Closeup_orient, &Closeup_pos );

The_mission.flags.set(Mission::Mission_Flags::Fullneb, neb_restore);
Expand Down