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

609 channel picker with shader #632

Merged
merged 2 commits into from
Jan 30, 2025
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Windows:
Install Nasm from https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/

Mac:
`brew install nasm`
`brew install nasm cmake`

## Updates

Expand Down
32 changes: 21 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ fn init(_app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins) -> OculanteSt
// Set up egui style / theme
plugins.egui(|ctx| {
// FIXME: Wait for https://github.com/Nazariglez/notan/issues/315 to close, then remove

let mut fonts = FontDefinitions::default();
egui_extras::install_image_loaders(ctx);

Expand Down Expand Up @@ -349,10 +349,8 @@ fn init(_app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins) -> OculanteSt
.unwrap()
.insert(0, "inter".to_owned());


let fonts = load_system_fonts(fonts);


debug!("Theme {:?}", state.persistent_settings.theme);
apply_theme(&mut state, ctx);
ctx.set_fonts(fonts);
Expand Down Expand Up @@ -950,27 +948,39 @@ fn drawe(app: &mut App, gfx: &mut Graphics, plugins: &mut Plugins, state: &mut O
debug!("Received image buffer: {:?}", img.dimensions(),);
state.image_geometry.dimensions = img.dimensions();

state
.current_texture
.set_image(&img, gfx, &state.persistent_settings);
if let Err(error) =
state
.current_texture
.set_image(&img, gfx, &state.persistent_settings)
{
state.send_message_warn(&format!("Error while displaying image: {error}"));
}
state.current_image = Some(img);
}
Frame::UpdateTexture => {
// Only update the texture.

// Prefer the edit result, if present
if state.edit_state.result_pixel_op != Default::default() {
state.current_texture.set_image(
if let Err(error) = state.current_texture.set_image(
&state.edit_state.result_pixel_op,
gfx,
&state.persistent_settings,
);
) {
state.send_message_warn(&format!("Error while displaying image: {error}"));
}
} else {
// update from image
if let Some(img) = &state.current_image {
state
.current_texture
.set_image(&img, gfx, &state.persistent_settings);
if let Err(error) =
state
.current_texture
.set_image(&img, gfx, &state.persistent_settings)
{
state.send_message_warn(&format!(
"Error while displaying image: {error}"
));
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/texture_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ impl TextureWrapperManager {
&& tex.height() as u32 == img.height()
&& img.color() == tex.image_format
{
debug!("Re-using texture as it is the same size and type.");
match tex.update_textures(gfx, img) {
Ok(_) => {}
Ok(_) => return Ok(()),
Err(error) => {
self.clear();
error!("{error}");
Expand Down
4 changes: 3 additions & 1 deletion src/ui/edit_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ pub fn edit_ui(app: &mut App, ctx: &Context, state: &mut OculanteState, gfx: &mu
if ui.add(egui::Button::new("Original").min_size(vec2(ui.available_width()/2., 0.))).clicked() {
if let Some(img) = &state.current_image {
state.image_geometry.dimensions = img.dimensions();
state.current_texture.set_image(img, gfx, &state.persistent_settings);
if let Err(error) = state.current_texture.set_image(img, gfx, &state.persistent_settings){
state.send_message_warn(&format!("Error while displaying image: {error}"));
}
}
}
if ui.add(egui::Button::new("Modified").min_size(vec2(ui.available_width(), 0.))).clicked() {
Expand Down
Loading