Skip to content

Commit

Permalink
remove unused config params
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriopass committed Feb 3, 2024
1 parent 9c8f202 commit 7200ac7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 70 deletions.
47 changes: 2 additions & 45 deletions assets/config.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
{
"disable_trees": false,
"tree_col": {
"r": 0.17265666,
"g": 0.40392157,
"b": 0.18353972,
"a": 1.0
},
"grass_col": {
"r": 0.18736649,
"g": 0.36862746,
"b": 0.15757015,
"a": 1.0
},
"sand_col": {
"r": 0.5411765,
"g": 0.49019608,
Expand All @@ -36,18 +23,6 @@
"b": 1.0,
"a": 1.0
},
"gui_bg_col": {
"r": 0.05111864,
"g": 0.09006373,
"b": 0.09677422,
"a": 0.8392157
},
"gui_title_col": {
"r": 0.08627451,
"g": 0.14901961,
"b": 0.34509805,
"a": 0.7921569
},
"gui_success": {
"r": 0.3,
"g": 0.8,
Expand All @@ -61,8 +36,8 @@
"a": 1.0
},
"gui_primary": {
"r": 0.3,
"g": 0.4,
"r": 0.29411766,
"g": 0.39607844,
"b": 1.0,
"a": 1.0
},
Expand Down Expand Up @@ -113,23 +88,5 @@
"g": 0.6,
"b": 0.25,
"a": 1.0
},
"lot_commercial_col": {
"r": 0.2303883,
"g": 0.46921328,
"b": 0.827451,
"a": 1.0
},
"special_building_col": {
"r": 0.38039216,
"g": 0.7882353,
"b": 0.27058825,
"a": 0.5019608
},
"special_building_invalid_col": {
"r": 1.0,
"g": 0.73333335,
"b": 0.73333335,
"a": 0.5019608
}
}
1 change: 0 additions & 1 deletion assets/shaders/render_params.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ struct RenderParams {
cam_dir: vec4<f32>,
sun: vec3<f32>,
sun_col: vec4<f32>,
grass_col: vec4<f32>,
sand_col: vec4<f32>,
sea_col: vec4<f32>,
viewport: vec2<f32>,
Expand Down
2 changes: 0 additions & 2 deletions engine/src/gfx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ pub struct RenderParams {
pub sun: Vec3,
pub _pad2: f32,
pub sun_col: LinearColor,
pub grass_col: LinearColor,
pub sand_col: LinearColor,
pub sea_col: LinearColor,
pub viewport: Vec2,
Expand Down Expand Up @@ -200,7 +199,6 @@ impl Default for RenderParams {
inv_proj: Matrix4::zero(),
sun_shadow_proj: [Matrix4::zero(); N_CASCADES],
sun_col: Default::default(),
grass_col: Default::default(),
sand_col: Default::default(),
sea_col: Default::default(),
cam_pos: Default::default(),
Expand Down
13 changes: 10 additions & 3 deletions geom/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@ impl Color {

let m = val - c;
Self {
r: (r + m),
g: (g + m),
b: (b + m),
r: r + m,
g: g + m,
b: b + m,
a,
}
}

pub fn adjust_luminosity(mut self, factor: f32) -> Self {
self.r = (self.r * factor).min(1.0);
self.g = (self.g * factor).min(1.0);
self.b = (self.b * factor).min(1.0);
self
}

pub fn a(self, a: f32) -> Self {
Self { a, ..self }
}
Expand Down
1 change: 0 additions & 1 deletion native_app/src/game_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ impl State {
.unwrap_or_default();
drop(camera);
let c = simulation::config();
params.grass_col = c.grass_col.into();
params.sand_col = c.sand_col.into();
params.sea_col = c.sea_col.into();
drop(c);
Expand Down
6 changes: 4 additions & 2 deletions native_app/src/newgui/tools/specialbuilding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ pub fn specialbuilding(sim: &Simulation, uiworld: &mut UiWorld) {
let mut draw = |obb, red| {
let p = asset.to_string();
let col = if red {
simulation::config().special_building_invalid_col
simulation::config().gui_danger.adjust_luminosity(1.3)
} else {
simulation::config().special_building_col
simulation::config()
.gui_primary
.adjust_luminosity(tweak!(1.5))
};

if p.ends_with(".png") || p.ends_with(".jpg") {
Expand Down
5 changes: 0 additions & 5 deletions native_app/src/rendering/map_rendering/trees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use engine::{
Drawable, FrameContext, GfxContext, InstancedMesh, InstancedMeshBuilder, MeshInstance,
};
use geom::{vec3, vec4, Camera, HeightmapChunk, Intersect3, LinearColor, Matrix4, Vec3, AABB3};
use simulation::config;
use simulation::map::{Map, MapSubscriber, SubscriberChunkID, UpdateType};

pub struct TreesRender {
Expand Down Expand Up @@ -58,10 +57,6 @@ impl TreesRender {
profiling::scope!("draw trees");
self.build(map, ctx);

if config().disable_trees {
return;
}

let camcenter = cam.pos.xy();

struct TreeMesh(InstancedMesh, Vec3);
Expand Down
11 changes: 0 additions & 11 deletions simulation/src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@ use std::sync::Arc;
#[derive(Default, Clone, Serialize, Deserialize, Inspect)]
#[serde(default)]
pub struct Config {
pub disable_trees: bool,

pub tree_col: Color,

pub grass_col: Color,
pub sand_col: Color,
pub sea_col: Color,

pub roof_col: Color,
pub house_col: Color,

pub gui_bg_col: Color,
pub gui_title_col: Color,
pub gui_success: Color,
pub gui_danger: Color,
pub gui_primary: Color,
Expand All @@ -36,10 +29,6 @@ pub struct Config {

pub lot_unassigned_col: Color,
pub lot_residential_col: Color,
pub lot_commercial_col: Color,

pub special_building_col: Color,
pub special_building_invalid_col: Color,
}

fn load_config_start() -> Config {
Expand Down

0 comments on commit 7200ac7

Please sign in to comment.