Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions renderer/src/frame_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ impl FramePayload {
},
}
}

pub fn is_tsunami_payload(&self) -> bool {
match self {
FramePayload::Earthquake(_) => false,
FramePayload::TsunamiFirst(_) | FramePayload::TsunamiSecond(_) => true,
}
}
}

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/worker/drawer_inset_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn draw_background<F: ?Sized + Facade, S: ?Sized + Surface>(
&frame_context.resources.inset.background_vertex_buffer,
NoIndices(PrimitiveType::TriangleStrip),
&ShapeUniform {
color: frame_context.theme.inset_background_color,
color: frame_context.theme.tsunami_clear_color,
},
frame_context.draw_parameters,
)
Expand Down
21 changes: 16 additions & 5 deletions renderer/src/worker/drawer_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub fn draw<F: ?Sized + Facade, S: ?Sized + Surface>(
frame_context: &FrameContext<F, S>,
layers: MapLayerConfig,
region: Option<InsetRegion>,
is_tsunami_rendering: bool,
) {
let theme = frame_context.theme;
let params = frame_context.draw_parameters;
Expand Down Expand Up @@ -55,6 +56,20 @@ pub fn draw<F: ?Sized + Facade, S: ?Sized + Surface>(
// lakeと県境線は本土のみに存在するため、Main以外のinset描画時はskip
let draws_mainland = region.is_none_or(|region| region == InsetRegion::Main);

let color = if is_tsunami_rendering {
[
theme.tsunami_clear_color[0],
theme.tsunami_clear_color[1],
theme.tsunami_clear_color[2],
]
} else {
[
theme.clear_color[0],
theme.clear_color[1],
theme.clear_color[2],
]
};

if draws_mainland {
resources
.shader
Expand All @@ -64,11 +79,7 @@ pub fn draw<F: ?Sized + Facade, S: ?Sized + Surface>(
&resources.lake.vertex,
&resources.lake.index,
&MapUniform {
color: [
theme.clear_color[0],
theme.clear_color[1],
theme.clear_color[2],
],
color,
..map_uniform
},
params,
Expand Down
13 changes: 9 additions & 4 deletions renderer/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ fn render_frame<F: ?Sized + Facade>(
camera,
};

let clear_color = frame_context.theme.clear_color;
let clear_color = if request_frame_context.payload.is_tsunami_payload() {
frame_context.theme.tsunami_clear_color
} else {
frame_context.theme.clear_color
};

frame_buffer.borrow_mut().clear(
None,
Some((
Expand All @@ -327,7 +332,7 @@ fn render_frame<F: ?Sized + Facade>(

match &request_frame_context.payload {
FramePayload::Earthquake(earthquake) => {
drawer_map::draw(&frame_context, map_layers, None);
drawer_map::draw(&frame_context, map_layers, None, false);
drawer_intensity_icon::draw_all(&frame_context, earthquake);
drawer_epicenter::draw(&frame_context, earthquake);
drawer_overlay::draw(&frame_context, earthquake);
Expand Down Expand Up @@ -475,7 +480,7 @@ fn draw_tsunami_frame<F: ?Sized + Facade, S: ?Sized + Surface, T>(
let epicenter_buffer = drawer_epicenter::create_vertex_buffer(facade, payload.epicenter());
let levels = with_lines.then(|| drawer_tsunami_line::build_levels_texture(facade, payload));

drawer_map::draw(frame_context, map_layers, Some(InsetRegion::Main));
drawer_map::draw(frame_context, map_layers, Some(InsetRegion::Main), true);
if let Some(levels) = &levels {
drawer_tsunami_line::draw(frame_context, InsetRegion::Main, levels);
}
Expand Down Expand Up @@ -529,7 +534,7 @@ fn draw_insets<F: ?Sized + Facade, S: ?Sized + Surface>(
drawer_inset_frame::draw_stencil_mask(&frame_context, notch);
}
drawer_inset_frame::draw_background(&frame_context);
drawer_map::draw(&frame_context, layers, Some(inset.region));
drawer_map::draw(&frame_context, layers, Some(inset.region), true);
if let Some(levels) = levels {
drawer_tsunami_line::draw(&frame_context, inset.region, levels);
}
Expand Down
6 changes: 3 additions & 3 deletions renderer/src/worker/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use renderer_macros::{rgb, rgba};

pub struct Theme {
pub clear_color: [f32; 4],
pub tsunami_clear_color: [f32; 4],
pub ground_color: [f32; 3],
pub prefectural_border_color: [f32; 3],
pub prefectural_border_width: f32,
Expand All @@ -13,7 +14,6 @@ pub struct Theme {
pub tsunami_width: f32,
pub tsunami_legend_color: [f32; 4],
pub occurrence_time_color: [f32; 4],
pub inset_background_color: [f32; 4],
pub inset_border_color: [f32; 4],
pub inset_border_width: f32,
pub inset_label_color: [f32; 4],
Expand All @@ -24,7 +24,8 @@ pub struct Theme {
pub const DEFAULT: Theme = Theme {
#[allow(clippy::eq_op)]
clear_color: rgba!("#82BCFF", 1.0),
ground_color: rgb!("#DEE2E5"),
tsunami_clear_color: rgba!("#777777", 1.0),
ground_color: rgb!("#cbd1d6"),
prefectural_border_color: rgb!("#949799"),
prefectural_border_width: 2.0,
area_border_color: rgb!("#949799"),
Expand All @@ -38,7 +39,6 @@ pub const DEFAULT: Theme = Theme {
tsunami_width: 3.0,
tsunami_legend_color: rgba!("#000000", 0.8),
occurrence_time_color: rgba!("#000000", 0.63),
inset_background_color: rgba!("#82BCFF", 1.0),
inset_border_color: rgba!("#969BA0", 1.0),
inset_border_width: 3.0,
inset_label_color: rgba!("#000000", 0.8),
Expand Down
Loading