Fix warnings from world

This commit is contained in:
Songtronix 2019-07-01 18:40:41 +00:00 committed by Joshua Barretto
parent 4cba73ff72
commit 863731f3ae
4 changed files with 25 additions and 40 deletions

View File

@ -3,14 +3,14 @@ mod tree;
use crate::{
column::{ColumnGen, ColumnSample},
util::{HashCache, RandomField, Sampler, SamplerMut},
World, CONFIG,
World,
};
use common::{
terrain::{structure::StructureBlock, Block},
vol::{ReadVol, Vox},
};
use noise::NoiseFn;
use std::ops::{Add, Div, Mul, Neg, Sub};
use std::ops::{Add, Div, Mul, Neg};
use vek::*;
pub struct BlockGen<'a> {
@ -91,19 +91,19 @@ impl<'a> SamplerMut for BlockGen<'a> {
alt,
chaos,
water_level,
river,
//river,
surface_color,
sub_surface_color,
tree_density,
forest_kind,
//tree_density,
//forest_kind,
close_trees,
cave_xy,
cave_alt,
rock,
cliffs,
//cliffs,
cliff_hill,
close_cliffs,
temp,
//temp,
..
} = Self::sample_column(column_gen, column_cache, Vec2::from(wpos))?;
@ -159,15 +159,15 @@ impl<'a> SamplerMut for BlockGen<'a> {
// Sample blocks
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 stone = Block::new(2, stone_col);
let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
let dirt = Block::new(1, dirt_col);
let sand = Block::new(1, Rgb::new(180, 150, 50));
// let stone = Block::new(2, stone_col);
// let surface_stone = Block::new(1, Rgb::new(200, 220, 255));
// let dirt = Block::new(1, dirt_col);
// 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 warm_stone = Block::new(1, Rgb::new(165, 165, 130));
let grass_depth = 2.0;
let block = if (wposf.z as f32) < height - grass_depth {
@ -244,7 +244,7 @@ impl<'a> SamplerMut for BlockGen<'a> {
pos: Vec3<i32>,
structure_pos: Vec2<i32>,
structure_seed: u32,
sample: &ColumnSample,
_sample: &ColumnSample,
) -> Block {
let field = RandomField::new(structure_seed + 0);

View File

@ -1,18 +1,9 @@
use crate::{
all::ForestKind,
sim::{Location, LocationInfo},
util::Sampler,
World, CONFIG,
};
use common::{
terrain::{Block, TerrainChunkSize},
vol::{VolSize, Vox},
};
use crate::{all::ForestKind, sim::LocationInfo, util::Sampler, World, CONFIG};
use common::{terrain::TerrainChunkSize, vol::VolSize};
use noise::NoiseFn;
use std::{
f32,
ops::{Add, Div, Mul, Neg, Sub},
sync::Arc,
};
use vek::*;

View File

@ -13,7 +13,7 @@ pub use crate::config::CONFIG;
use crate::{
block::BlockGen,
column::{ColumnGen, ColumnSample},
util::{HashCache, Sampler, SamplerMut},
util::{Sampler, SamplerMut},
};
use common::{
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
@ -42,7 +42,7 @@ impl World {
&self.sim
}
pub fn tick(&self, dt: Duration) {
pub fn tick(&self, _dt: Duration) {
// TODO
}
@ -84,7 +84,7 @@ impl World {
for y in 0..TerrainChunkSize::SIZE.y as i32 {
let wpos2d = Vec2::new(x, y)
+ 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
.sim

View File

@ -14,15 +14,9 @@ use common::{
terrain::{BiomeKind, TerrainChunkSize},
vol::VolSize,
};
use noise::{
BasicMulti, HybridMulti, MultiFractal, NoiseFn, OpenSimplex, RidgedMulti, Seedable,
SuperSimplex,
};
use noise::{BasicMulti, HybridMulti, MultiFractal, NoiseFn, RidgedMulti, Seedable, SuperSimplex};
use rand::{prng::XorShiftRng, Rng, SeedableRng};
use std::{
ops::{Add, Div, Mul, Neg, Sub},
sync::Arc,
};
use std::ops::{Add, Div, Mul, Sub};
use vek::*;
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.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
let near = gen.get(chunk_pos);
@ -359,7 +353,7 @@ impl SimChunk {
.add(0.3)
.max(0.0);
let dryness = (gen_ctx.dry_nz.get(
let dryness = gen_ctx.dry_nz.get(
(wposf
.add(Vec2::new(
gen_ctx
@ -370,7 +364,7 @@ impl SimChunk {
))
.div(2_000.0))
.into_array(),
) as f32);
) as f32;
let chaos = (gen_ctx.chaos_nz.get((wposf.div(4_000.0)).into_array()) as f32)
.add(1.0)
@ -409,7 +403,7 @@ impl SimChunk {
.mul(chaos)
.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;