mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added sites to the map
This commit is contained in:
parent
8c1fb3255c
commit
c0bd0279fc
@ -45,7 +45,7 @@ void main() {
|
|||||||
diffuse_light *= f_light * ao;
|
diffuse_light *= f_light * ao;
|
||||||
diffuse_light += point_light * ao;
|
diffuse_light += point_light * ao;
|
||||||
|
|
||||||
vec3 col = f_col + hash(vec4(floor(f_chunk_pos * 3.0 + 0.5), 0)) * 0.02; // Small-scale noise
|
vec3 col = f_col + hash(vec4(floor(f_chunk_pos * 3.0 + 0.01), 0)) * 0.02; // Small-scale noise
|
||||||
vec3 surf_color = illuminate(srgb_to_linear(col), light, diffuse_light, ambient_light);
|
vec3 surf_color = illuminate(srgb_to_linear(col), light, diffuse_light, ambient_light);
|
||||||
|
|
||||||
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
|
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
|
||||||
|
@ -156,6 +156,7 @@ impl MapConfig {
|
|||||||
downhill,
|
downhill,
|
||||||
river_kind,
|
river_kind,
|
||||||
is_path,
|
is_path,
|
||||||
|
near_site,
|
||||||
) = sampler
|
) = sampler
|
||||||
.get(pos)
|
.get(pos)
|
||||||
.map(|sample| {
|
.map(|sample| {
|
||||||
@ -168,6 +169,9 @@ impl MapConfig {
|
|||||||
sample.downhill,
|
sample.downhill,
|
||||||
sample.river.river_kind,
|
sample.river.river_kind,
|
||||||
sample.path.is_path(),
|
sample.path.is_path(),
|
||||||
|
sample.sites
|
||||||
|
.iter()
|
||||||
|
.any(|site| site.get_origin().distance_squared(pos * TerrainChunkSize::RECT_SIZE.x as i32) < 64i32.pow(2)),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.unwrap_or((
|
.unwrap_or((
|
||||||
@ -179,6 +183,7 @@ impl MapConfig {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
));
|
));
|
||||||
let humidity = humidity.min(1.0).max(0.0);
|
let humidity = humidity.min(1.0).max(0.0);
|
||||||
let temperature = temperature.min(1.0).max(-1.0) * 0.5 + 0.5;
|
let temperature = temperature.min(1.0).max(-1.0) * 0.5 + 0.5;
|
||||||
@ -305,7 +310,9 @@ impl MapConfig {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
let rgba = if is_path {
|
let rgba = if near_site {
|
||||||
|
(0x57, 0x39, 0x33, 0xFF)
|
||||||
|
} else if is_path {
|
||||||
(0x37, 0x29, 0x23, 0xFF)
|
(0x37, 0x29, 0x23, 0xFF)
|
||||||
} else {
|
} else {
|
||||||
rgba
|
rgba
|
||||||
|
@ -67,6 +67,8 @@ impl Dungeon {
|
|||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_origin(&self) -> Vec2<i32> { self.origin }
|
||||||
|
|
||||||
pub fn radius(&self) -> f32 { 1200.0 }
|
pub fn radius(&self) -> f32 { 1200.0 }
|
||||||
|
|
||||||
pub fn spawn_rules(&self, _wpos: Vec2<i32>) -> SpawnRules {
|
pub fn spawn_rules(&self, _wpos: Vec2<i32>) -> SpawnRules {
|
||||||
|
@ -74,6 +74,13 @@ impl Site {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_origin(&self) -> Vec2<i32> {
|
||||||
|
match self {
|
||||||
|
Site::Settlement(s) => s.get_origin(),
|
||||||
|
Site::Dungeon(d) => d.get_origin(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn spawn_rules(&self, wpos: Vec2<i32>) -> SpawnRules {
|
pub fn spawn_rules(&self, wpos: Vec2<i32>) -> SpawnRules {
|
||||||
match self {
|
match self {
|
||||||
Site::Settlement(s) => s.spawn_rules(wpos),
|
Site::Settlement(s) => s.spawn_rules(wpos),
|
||||||
|
@ -147,6 +147,10 @@ impl Settlement {
|
|||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_origin(&self) -> Vec2<i32> {
|
||||||
|
self.origin
|
||||||
|
}
|
||||||
|
|
||||||
/// Designate hazardous terrain based on world data
|
/// Designate hazardous terrain based on world data
|
||||||
pub fn designate_from_world(&mut self, sim: &WorldSim, rng: &mut impl Rng) {
|
pub fn designate_from_world(&mut self, sim: &WorldSim, rng: &mut impl Rng) {
|
||||||
let tile_radius = self.radius() as i32 / AREA_SIZE as i32;
|
let tile_radius = self.radius() as i32 / AREA_SIZE as i32;
|
||||||
|
Loading…
Reference in New Issue
Block a user