Skip to content

Commit c41ac32

Browse files
committed
format
1 parent 1280e87 commit c41ac32

27 files changed

Lines changed: 252 additions & 83 deletions

native/src/sbc/heightmap/commands/set_heightmap_brush_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use serde::Deserialize;
77

88
use crate::sbc::command_system::command::Command;
99
use crate::sbc::command_system::context::Context;
10-
use crate::sbc::command_system::registry::register_command;
1110
use crate::sbc::command_system::hashmap_to_vector::hashmap_to_vector;
11+
use crate::sbc::command_system::registry::register_command;
1212
use crate::sbc::heightmap::model::terrain_manager::GreyscaleShape;
1313

1414
// TODO: Load directly in Rust so we don't need to pass these large arrays

native/src/sbc/heightmap/commands/terrain_grass_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use log::debug;
55
use serde::Deserialize;
66
use spring_native::prelude::*;
77

8-
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
98
use crate::sbc::command_system::command::Command;
109
use crate::sbc::command_system::context::Context;
1110
use crate::sbc::command_system::registry::register_command;
11+
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
1212

1313
const GRASS_STEP: usize = 8 * 4;
1414

native/src/sbc/heightmap/commands/terrain_level_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use log::debug;
44
use serde::Deserialize;
55
use spring_native::prelude::*;
66

7-
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
8-
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
97
use crate::sbc::command_system::command::Command;
108
use crate::sbc::command_system::context::Context;
119
use crate::sbc::command_system::registry::register_command;
10+
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
11+
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
1212

1313
const SQUARE_SIZE: usize = 8;
1414

native/src/sbc/heightmap/commands/terrain_metal_command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use log::debug;
55
use serde::Deserialize;
66
use spring_native::prelude::*;
77

8-
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
98
use crate::sbc::command_system::command::Command;
109
use crate::sbc::command_system::context::Context;
1110
use crate::sbc::command_system::registry::register_command;
11+
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
1212

1313
const METAL_RESOLUTION: usize = 16;
1414

native/src/sbc/heightmap/commands/terrain_shape_modify_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::collections::HashMap;
33
use log::debug;
44
use serde::Deserialize;
55

6-
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
7-
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
86
use crate::sbc::command_system::command::Command;
97
use crate::sbc::command_system::context::Context;
108
use crate::sbc::command_system::registry::register_command;
9+
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
10+
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
1111

1212
const SQUARE_SIZE: usize = 8;
1313

native/src/sbc/heightmap/commands/terrain_smooth_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use log::debug;
55
use serde::Deserialize;
66
use spring_native::prelude::*;
77

8-
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
9-
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
108
use crate::sbc::command_system::command::Command;
119
use crate::sbc::command_system::context::Context;
1210
use crate::sbc::command_system::registry::register_command;
11+
use crate::sbc::heightmap::model::brush_modify::{BrushModify, BrushOptions, Params};
12+
use crate::sbc::heightmap::model::terrain_manager::TerrainManager;
1313

1414
const SQUARE_SIZE: usize = 8;
1515

native/src/sbc/textures/commands/terrain_change_texture_command.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,19 @@ impl TerrainChangeTextureCommand {
185185
if k == "diffuse" {
186186
paint.brush_diffuse = Some(Texture::from(s.to_string()));
187187
} else {
188-
paint.brush_shading.push((k.clone(), Texture::from(s.to_string())));
188+
paint
189+
.brush_shading
190+
.push((k.clone(), Texture::from(s.to_string())));
189191
}
190192
}
191193
}
192194
}
193195
if let Some(obj) = o.shading_texture.as_object() {
194196
for (k, v) in obj {
195197
if let Some(s) = v.as_str() {
196-
paint.shading_textures.push((k.clone(), Texture::from(s.to_string())));
198+
paint
199+
.shading_textures
200+
.push((k.clone(), Texture::from(s.to_string())));
197201
}
198202
}
199203
}

native/src/sbc/textures/commands/terrain_change_texture_merged_command.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub struct TerrainChangeTextureMergedCommand;
1313
impl Command for TerrainChangeTextureMergedCommand {
1414
fn execute(&mut self, ctx: &mut Context) {
1515
let id = ctx.current_command_id;
16-
ctx.model::<TextureModel>().history.close_or_redo_stroke(Some(id));
16+
ctx.model::<TextureModel>()
17+
.history
18+
.close_or_redo_stroke(Some(id));
1719
}
1820

1921
fn unexecute(&mut self, ctx: &mut Context) {

native/src/sbc/textures/model/draw/diffuse.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use crate::sbc::textures::model::texture_drawing::{
77
use crate::sbc::textures::model::texture_model::TextureModel;
88

99
use super::options::{PaintOptions, Region};
10-
use super::shared::{blend_mode_expr, set_diffuse_uniforms, set_region_uniforms, SHADER_PATH_DIFFUSE};
10+
use super::shared::{
11+
blend_mode_expr, set_diffuse_uniforms, set_region_uniforms, SHADER_PATH_DIFFUSE,
12+
};
1113

1214
pub fn paint_diffuse(
1315
interface: &NativeInterfaceRef,
@@ -22,7 +24,8 @@ pub fn paint_diffuse(
2224
return;
2325
};
2426
let Some(shader) =
25-
tm.shaders.get_or_compile(interface, SHADER_PATH_DIFFUSE, blend_mode_expr(opts.mode))
27+
tm.shaders
28+
.get_or_compile(interface, SHADER_PATH_DIFFUSE, blend_mode_expr(opts.mode))
2629
else {
2730
return;
2831
};
@@ -32,7 +35,13 @@ pub fn paint_diffuse(
3235
let size = region.size;
3336
let t_coord = generate_texture_coords(region.x, region.z, size, size, &opts.tex_coord_opts());
3437

35-
let tiles = tm.history.back_up_region(&tm.tiles, region.x, region.z, region.end_x(), region.end_z());
38+
let tiles = tm.history.back_up_region(
39+
&tm.tiles,
40+
region.x,
41+
region.z,
42+
region.end_x(),
43+
region.end_z(),
44+
);
3645
let mut jobs = Vec::new();
3746
for tile in tiles {
3847
let (m_coord, v_coord) = generate_map_coords(tile.offset_x, tile.offset_z, size, size);

native/src/sbc/textures/model/draw/filter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ pub fn paint_filter(
2424

2525
let size = end_x - start_x;
2626
let t_coord = generate_texture_coords(start_x, start_z, size, size, &opts.tex_coord_opts());
27-
let tiles = tm.history.back_up_region(&tm.tiles, start_x, start_z, end_x, end_z);
27+
let tiles = tm
28+
.history
29+
.back_up_region(&tm.tiles, start_x, start_z, end_x, end_z);
2830
let mut jobs = Vec::new();
2931
for tile in tiles {
3032
let (m_coord, v_coord) = generate_map_coords(tile.offset_x, tile.offset_z, size, size);

0 commit comments

Comments
 (0)