Skip to content

Commit

Permalink
add config to disable rendering trees
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriopass committed Dec 5, 2023
1 parent 8cb4c16 commit d4d2fd6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"disable_trees": true,
"tree_col": {
"r": 0.17265666,
"g": 0.40392157,
Expand Down
5 changes: 5 additions & 0 deletions native_app/src/rendering/map_rendering/trees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use engine::{
Drawable, FrameContext, GfxContext, InstancedMesh, InstancedMeshBuilder, MeshInstance,
};
use geom::{vec3, vec4, Camera, InfiniteFrustrum, Intersect3, LinearColor, Matrix4, Vec3, AABB3};
use simulation::config;
use simulation::map::{ChunkID, Map, MapSubscriber, UpdateType, CHUNK_SIZE};
use std::ops::Mul;

Expand Down Expand Up @@ -61,6 +62,10 @@ impl TreesRender {
) {
self.build(map, ctx);

if config().disable_trees {
return;
}

let camcenter = cam.pos.xy();

struct TreeMesh(InstancedMesh, Vec3);
Expand Down
3 changes: 3 additions & 0 deletions simulation/src/utils/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use std::sync::atomic::{AtomicUsize, Ordering};
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,
Expand Down

0 comments on commit d4d2fd6

Please sign in to comment.