mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'songtronix/fix-warnings-from-world' into 'master'
Fix warnings from world See merge request veloren/veloren!282
This commit is contained in:
@ -3,14 +3,14 @@ mod tree;
|
|||||||
use crate::{
|
use crate::{
|
||||||
column::{ColumnGen, ColumnSample},
|
column::{ColumnGen, ColumnSample},
|
||||||
util::{HashCache, RandomField, Sampler, SamplerMut},
|
util::{HashCache, RandomField, Sampler, SamplerMut},
|
||||||
World, CONFIG,
|
World,
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
terrain::{structure::StructureBlock, Block},
|
terrain::{structure::StructureBlock, Block},
|
||||||
vol::{ReadVol, Vox},
|
vol::{ReadVol, Vox},
|
||||||
};
|
};
|
||||||
use noise::NoiseFn;
|
use noise::NoiseFn;
|
||||||
use std::ops::{Add, Div, Mul, Neg, Sub};
|
use std::ops::{Add, Div, Mul, Neg};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub struct BlockGen<'a> {
|
pub struct BlockGen<'a> {
|
||||||
@ -91,19 +91,19 @@ impl<'a> SamplerMut for BlockGen<'a> {
|
|||||||
alt,
|
alt,
|
||||||
chaos,
|
chaos,
|
||||||
water_level,
|
water_level,
|
||||||
river,
|
//river,
|
||||||
surface_color,
|
surface_color,
|
||||||
sub_surface_color,
|
sub_surface_color,
|
||||||
tree_density,
|
//tree_density,
|
||||||
forest_kind,
|
//forest_kind,
|
||||||
close_trees,
|
close_trees,
|
||||||
cave_xy,
|
cave_xy,
|
||||||
cave_alt,
|
cave_alt,
|
||||||
rock,
|
rock,
|
||||||
cliffs,
|
//cliffs,
|
||||||
cliff_hill,
|
cliff_hill,
|
||||||
close_cliffs,
|
close_cliffs,
|
||||||
temp,
|
//temp,
|
||||||
..
|
..
|
||||||
} = Self::sample_column(column_gen, column_cache, Vec2::from(wpos))?;
|
} = Self::sample_column(column_gen, column_cache, Vec2::from(wpos))?;
|
||||||
|
|
||||||
@ -159,15 +159,15 @@ impl<'a> SamplerMut for BlockGen<'a> {
|
|||||||
// Sample blocks
|
// Sample blocks
|
||||||
|
|
||||||
let stone_col = Rgb::new(200, 220, 255);
|
let stone_col = Rgb::new(200, 220, 255);
|
||||||
let dirt_col = Rgb::new(79, 67, 60);
|
// let dirt_col = Rgb::new(79, 67, 60);
|
||||||
|
|
||||||
let air = Block::empty();
|
let air = Block::empty();
|
||||||
let stone = Block::new(2, stone_col);
|
// let stone = Block::new(2, stone_col);
|
||||||
let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
|
// let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
|
||||||
let dirt = Block::new(1, dirt_col);
|
// let dirt = Block::new(1, dirt_col);
|
||||||
let sand = Block::new(1, Rgb::new(180, 150, 50));
|
// let sand = Block::new(1, Rgb::new(180, 150, 50));
|
||||||
|
// let warm_stone = Block::new(1, Rgb::new(165, 165, 130));
|
||||||
let water = Block::new(1, Rgb::new(100, 150, 255));
|
let water = Block::new(1, Rgb::new(100, 150, 255));
|
||||||
let warm_stone = Block::new(1, Rgb::new(165, 165, 130));
|
|
||||||
|
|
||||||
let grass_depth = 2.0;
|
let grass_depth = 2.0;
|
||||||
let block = if (wposf.z as f32) < height - grass_depth {
|
let block = if (wposf.z as f32) < height - grass_depth {
|
||||||
@ -244,7 +244,7 @@ impl<'a> SamplerMut for BlockGen<'a> {
|
|||||||
pos: Vec3<i32>,
|
pos: Vec3<i32>,
|
||||||
structure_pos: Vec2<i32>,
|
structure_pos: Vec2<i32>,
|
||||||
structure_seed: u32,
|
structure_seed: u32,
|
||||||
sample: &ColumnSample,
|
_sample: &ColumnSample,
|
||||||
) -> Block {
|
) -> Block {
|
||||||
let field = RandomField::new(structure_seed + 0);
|
let field = RandomField::new(structure_seed + 0);
|
||||||
|
|
||||||
|
@ -1,18 +1,9 @@
|
|||||||
use crate::{
|
use crate::{all::ForestKind, sim::LocationInfo, util::Sampler, World, CONFIG};
|
||||||
all::ForestKind,
|
use common::{terrain::TerrainChunkSize, vol::VolSize};
|
||||||
sim::{Location, LocationInfo},
|
|
||||||
util::Sampler,
|
|
||||||
World, CONFIG,
|
|
||||||
};
|
|
||||||
use common::{
|
|
||||||
terrain::{Block, TerrainChunkSize},
|
|
||||||
vol::{VolSize, Vox},
|
|
||||||
};
|
|
||||||
use noise::NoiseFn;
|
use noise::NoiseFn;
|
||||||
use std::{
|
use std::{
|
||||||
f32,
|
f32,
|
||||||
ops::{Add, Div, Mul, Neg, Sub},
|
ops::{Add, Div, Mul, Neg, Sub},
|
||||||
sync::Arc,
|
|
||||||
};
|
};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ pub use crate::config::CONFIG;
|
|||||||
use crate::{
|
use crate::{
|
||||||
block::BlockGen,
|
block::BlockGen,
|
||||||
column::{ColumnGen, ColumnSample},
|
column::{ColumnGen, ColumnSample},
|
||||||
util::{HashCache, Sampler, SamplerMut},
|
util::{Sampler, SamplerMut},
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
||||||
@ -42,7 +42,7 @@ impl World {
|
|||||||
&self.sim
|
&self.sim
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tick(&self, dt: Duration) {
|
pub fn tick(&self, _dt: Duration) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ impl World {
|
|||||||
for y in 0..TerrainChunkSize::SIZE.y as i32 {
|
for y in 0..TerrainChunkSize::SIZE.y as i32 {
|
||||||
let wpos2d = Vec2::new(x, y)
|
let wpos2d = Vec2::new(x, y)
|
||||||
+ Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32);
|
+ Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32);
|
||||||
let wposf2d = wpos2d.map(|e| e as f64);
|
let _wposf2d = wpos2d.map(|e| e as f64);
|
||||||
|
|
||||||
let min_z = self
|
let min_z = self
|
||||||
.sim
|
.sim
|
||||||
|
@ -14,15 +14,9 @@ use common::{
|
|||||||
terrain::{BiomeKind, TerrainChunkSize},
|
terrain::{BiomeKind, TerrainChunkSize},
|
||||||
vol::VolSize,
|
vol::VolSize,
|
||||||
};
|
};
|
||||||
use noise::{
|
use noise::{BasicMulti, HybridMulti, MultiFractal, NoiseFn, RidgedMulti, Seedable, SuperSimplex};
|
||||||
BasicMulti, HybridMulti, MultiFractal, NoiseFn, OpenSimplex, RidgedMulti, Seedable,
|
|
||||||
SuperSimplex,
|
|
||||||
};
|
|
||||||
use rand::{prng::XorShiftRng, Rng, SeedableRng};
|
use rand::{prng::XorShiftRng, Rng, SeedableRng};
|
||||||
use std::{
|
use std::ops::{Add, Div, Mul, Sub};
|
||||||
ops::{Add, Div, Mul, Neg, Sub},
|
|
||||||
sync::Arc,
|
|
||||||
};
|
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 };
|
pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 };
|
||||||
@ -193,7 +187,7 @@ impl WorldSim {
|
|||||||
chunk_pos.x * TerrainChunkSize::SIZE.x as i32,
|
chunk_pos.x * TerrainChunkSize::SIZE.x as i32,
|
||||||
chunk_pos.y * TerrainChunkSize::SIZE.y as i32,
|
chunk_pos.y * TerrainChunkSize::SIZE.y as i32,
|
||||||
);
|
);
|
||||||
let cell_pos = Vec2::new(i / cell_size, j / cell_size);
|
let _cell_pos = Vec2::new(i / cell_size, j / cell_size);
|
||||||
|
|
||||||
// Find the distance to each region
|
// Find the distance to each region
|
||||||
let near = gen.get(chunk_pos);
|
let near = gen.get(chunk_pos);
|
||||||
@ -359,7 +353,7 @@ impl SimChunk {
|
|||||||
.add(0.3)
|
.add(0.3)
|
||||||
.max(0.0);
|
.max(0.0);
|
||||||
|
|
||||||
let dryness = (gen_ctx.dry_nz.get(
|
let dryness = gen_ctx.dry_nz.get(
|
||||||
(wposf
|
(wposf
|
||||||
.add(Vec2::new(
|
.add(Vec2::new(
|
||||||
gen_ctx
|
gen_ctx
|
||||||
@ -370,7 +364,7 @@ impl SimChunk {
|
|||||||
))
|
))
|
||||||
.div(2_000.0))
|
.div(2_000.0))
|
||||||
.into_array(),
|
.into_array(),
|
||||||
) as f32);
|
) as f32;
|
||||||
|
|
||||||
let chaos = (gen_ctx.chaos_nz.get((wposf.div(4_000.0)).into_array()) as f32)
|
let chaos = (gen_ctx.chaos_nz.get((wposf.div(4_000.0)).into_array()) as f32)
|
||||||
.add(1.0)
|
.add(1.0)
|
||||||
@ -409,7 +403,7 @@ impl SimChunk {
|
|||||||
.mul(chaos)
|
.mul(chaos)
|
||||||
.mul(CONFIG.mountain_scale);
|
.mul(CONFIG.mountain_scale);
|
||||||
|
|
||||||
let temp = (gen_ctx.temp_nz.get((wposf.div(8192.0)).into_array()) as f32);
|
let temp = gen_ctx.temp_nz.get((wposf.div(8192.0)).into_array()) as f32;
|
||||||
|
|
||||||
let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2;
|
let cliff = gen_ctx.cliff_nz.get((wposf.div(2048.0)).into_array()) as f32 + chaos * 0.2;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user