mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'pfauenauge/plants_grass' into 'zesterer/instancing'
Pfauenauge/plants grass See merge request veloren/veloren!452
This commit is contained in:
commit
7e924d89a9
assets
voxygen/voxel/sprite
cacti
flowers
flower_blue_1.voxflower_blue_2.voxflower_pink_1.voxflower_pink_2.voxflower_pink_3.voxflower_purple_1.voxflower_red_1.voxflower_white_1.voxflower_yellow_1.voxsunflower_1.voxsunflower_2.vox
fruit
grass-0.voxgrass-1.voxgrass-2.voxgrass-3.voxgrass-4.voxgrass-5.voxgrass
grass_long_1.voxgrass_long_2.voxgrass_long_3.voxgrass_long_4.voxgrass_long_5.voxgrass_med_1.voxgrass_med_2.voxgrass_med_3.voxgrass_med_4.voxgrass_med_5.voxgrass_short_1.voxgrass_short_2.voxgrass_short_3.voxgrass_short_4.voxgrass_short_5.vox
velorite_small
velorite_1.voxvelorite_10.voxvelorite_2.voxvelorite_3.voxvelorite_4.voxvelorite_5.voxvelorite_6.voxvelorite_7.voxvelorite_8.voxvelorite_9.vox
wheat.voxworld/tree/fruit
common/src/terrain
voxygen/src/scene
world/src
BIN
assets/voxygen/voxel/sprite/cacti/barrel_cactus.vox
Normal file
BIN
assets/voxygen/voxel/sprite/cacti/barrel_cactus.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/cacti/large_cactus.vox
Normal file
BIN
assets/voxygen/voxel/sprite/cacti/large_cactus.vox
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_blue_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_blue_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_3.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_pink_3.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_purple_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_purple_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_red_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_red_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_white_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_white_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/flower_yellow_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/flower_yellow_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/sunflower_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/sunflower_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/flowers/sunflower_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/flowers/sunflower_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/fruit/apple.vox
Normal file
BIN
assets/voxygen/voxel/sprite/fruit/apple.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/fruit/apple_half.vox
Normal file
BIN
assets/voxygen/voxel/sprite/fruit/apple_half.vox
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_long_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_long_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_long_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_long_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_long_3.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_long_3.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_long_4.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_long_4.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_long_5.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_long_5.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_med_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_med_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_med_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_med_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_med_3.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_med_3.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_med_4.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_med_4.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_med_5.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_med_5.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_short_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_short_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_short_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_short_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_short_3.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_short_3.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_short_4.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_short_4.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/grass/grass_short_5.vox
Normal file
BIN
assets/voxygen/voxel/sprite/grass/grass_short_5.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_1.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_1.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_10.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_10.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_2.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_2.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_3.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_3.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_4.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_4.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_5.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_5.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_6.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_6.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_7.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_7.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_8.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_8.vox
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_9.vox
Normal file
BIN
assets/voxygen/voxel/sprite/velorite_small/velorite_9.vox
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -10,18 +10,38 @@ pub enum BlockKind {
|
||||
Normal,
|
||||
Dense,
|
||||
Water,
|
||||
Wheat,
|
||||
LargeCactus,
|
||||
BarrelCactus,
|
||||
BlueFlower,
|
||||
PinkFlower,
|
||||
PurpleFlower,
|
||||
RedFlower,
|
||||
WhiteFlower,
|
||||
YellowFlower,
|
||||
Sunflower,
|
||||
LongGrass,
|
||||
Flowers,
|
||||
MediumGrass,
|
||||
ShortGrass,
|
||||
Apple,
|
||||
}
|
||||
|
||||
impl BlockKind {
|
||||
pub fn is_air(&self) -> bool {
|
||||
match self {
|
||||
BlockKind::Air => true,
|
||||
BlockKind::Wheat => true,
|
||||
BlockKind::LargeCactus => false,
|
||||
BlockKind::BarrelCactus => true,
|
||||
BlockKind::BlueFlower => true,
|
||||
BlockKind::PinkFlower => true,
|
||||
BlockKind::PurpleFlower => true,
|
||||
BlockKind::RedFlower => true,
|
||||
BlockKind::WhiteFlower => true,
|
||||
BlockKind::YellowFlower => true,
|
||||
BlockKind::Sunflower => true,
|
||||
BlockKind::LongGrass => true,
|
||||
BlockKind::Flowers => true,
|
||||
BlockKind::MediumGrass => true,
|
||||
BlockKind::ShortGrass => true,
|
||||
BlockKind::Apple => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@ -37,9 +57,19 @@ impl BlockKind {
|
||||
match self {
|
||||
BlockKind::Air => false,
|
||||
BlockKind::Water => false,
|
||||
BlockKind::Wheat => false,
|
||||
BlockKind::LargeCactus => false,
|
||||
BlockKind::BarrelCactus => false,
|
||||
BlockKind::BlueFlower => false,
|
||||
BlockKind::PinkFlower => false,
|
||||
BlockKind::PurpleFlower => false,
|
||||
BlockKind::RedFlower => false,
|
||||
BlockKind::WhiteFlower => false,
|
||||
BlockKind::YellowFlower => false,
|
||||
BlockKind::Sunflower => false,
|
||||
BlockKind::LongGrass => false,
|
||||
BlockKind::Flowers => false,
|
||||
BlockKind::MediumGrass => false,
|
||||
BlockKind::ShortGrass => false,
|
||||
BlockKind::Apple => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
@ -48,9 +78,19 @@ impl BlockKind {
|
||||
match self {
|
||||
BlockKind::Air => false,
|
||||
BlockKind::Water => false,
|
||||
BlockKind::Wheat => false,
|
||||
BlockKind::LargeCactus => true,
|
||||
BlockKind::BarrelCactus => true,
|
||||
BlockKind::BlueFlower => false,
|
||||
BlockKind::PinkFlower => false,
|
||||
BlockKind::PurpleFlower => false,
|
||||
BlockKind::RedFlower => false,
|
||||
BlockKind::WhiteFlower => false,
|
||||
BlockKind::YellowFlower => false,
|
||||
BlockKind::Sunflower => false,
|
||||
BlockKind::LongGrass => false,
|
||||
BlockKind::Flowers => false,
|
||||
BlockKind::MediumGrass => false,
|
||||
BlockKind::ShortGrass => false,
|
||||
BlockKind::Apple => true,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ struct TerrainChunk {
|
||||
// GPU data
|
||||
opaque_model: Model<TerrainPipeline>,
|
||||
fluid_model: Model<FluidPipeline>,
|
||||
sprite_instances: HashMap<BlockKind, Instances<SpriteInstance>>,
|
||||
sprite_instances: HashMap<(BlockKind, usize), Instances<SpriteInstance>>,
|
||||
locals: Consts<TerrainLocals>,
|
||||
|
||||
visible: bool,
|
||||
@ -43,19 +43,68 @@ struct MeshWorkerResponse {
|
||||
z_bounds: (f32, f32),
|
||||
opaque_mesh: Mesh<TerrainPipeline>,
|
||||
fluid_mesh: Mesh<FluidPipeline>,
|
||||
sprite_instances: HashMap<BlockKind, Vec<SpriteInstance>>,
|
||||
sprite_instances: HashMap<(BlockKind, usize), Vec<SpriteInstance>>,
|
||||
started_tick: u64,
|
||||
}
|
||||
|
||||
struct SpriteConfig {
|
||||
variations: usize,
|
||||
wind_sway: f32, // 1.0 is normal
|
||||
}
|
||||
|
||||
fn sprite_config_for(kind: BlockKind) -> Option<SpriteConfig> {
|
||||
match kind {
|
||||
BlockKind::Wheat => Some(SpriteConfig { wind_sway: 1.0 }),
|
||||
BlockKind::LongGrass => Some(SpriteConfig { wind_sway: 1.0 }),
|
||||
BlockKind::Flowers => Some(SpriteConfig { wind_sway: 0.3 }),
|
||||
BlockKind::LargeCactus => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.0,
|
||||
}),
|
||||
BlockKind::BarrelCactus => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.0,
|
||||
}),
|
||||
|
||||
BlockKind::BlueFlower => Some(SpriteConfig {
|
||||
variations: 2,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
BlockKind::PinkFlower => Some(SpriteConfig {
|
||||
variations: 3,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
BlockKind::RedFlower => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
BlockKind::WhiteFlower => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
BlockKind::YellowFlower => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
BlockKind::Sunflower => Some(SpriteConfig {
|
||||
variations: 2,
|
||||
wind_sway: 0.3,
|
||||
}),
|
||||
|
||||
BlockKind::LongGrass => Some(SpriteConfig {
|
||||
variations: 5,
|
||||
wind_sway: 1.0,
|
||||
}),
|
||||
BlockKind::MediumGrass => Some(SpriteConfig {
|
||||
variations: 5,
|
||||
wind_sway: 1.0,
|
||||
}),
|
||||
BlockKind::ShortGrass => Some(SpriteConfig {
|
||||
variations: 5,
|
||||
wind_sway: 1.0,
|
||||
}),
|
||||
|
||||
BlockKind::Apple => Some(SpriteConfig {
|
||||
variations: 1,
|
||||
wind_sway: 0.0,
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@ -88,7 +137,7 @@ fn mesh_worker(
|
||||
let kind = volume.get(wpos).unwrap_or(&Block::empty()).kind();
|
||||
|
||||
if let Some(cfg) = sprite_config_for(kind) {
|
||||
let seed = x * 3 + y * 7 + z * 13 + x * y;
|
||||
let seed = wpos.x * 3 + wpos.y * 7 + wpos.z * 13 + wpos.x * wpos.y;
|
||||
|
||||
let instance = SpriteInstance::new(
|
||||
Mat4::identity()
|
||||
@ -101,7 +150,7 @@ fn mesh_worker(
|
||||
);
|
||||
|
||||
instances
|
||||
.entry(kind)
|
||||
.entry((kind, seed as usize % cfg.variations))
|
||||
.or_insert_with(|| Vec::new())
|
||||
.push(instance);
|
||||
}
|
||||
@ -125,7 +174,7 @@ pub struct Terrain {
|
||||
mesh_todo: HashMap<Vec2<i32>, ChunkMeshState>,
|
||||
|
||||
// GPU data
|
||||
sprite_models: HashMap<BlockKind, Model<SpritePipeline>>,
|
||||
sprite_models: HashMap<(BlockKind, usize), Model<SpritePipeline>>,
|
||||
}
|
||||
|
||||
impl Terrain {
|
||||
@ -152,14 +201,125 @@ impl Terrain {
|
||||
mesh_recv: recv,
|
||||
mesh_todo: HashMap::default(),
|
||||
sprite_models: vec![
|
||||
(BlockKind::Wheat, make_model("voxygen.voxel.sprite.wheat")),
|
||||
// Cacti
|
||||
(
|
||||
BlockKind::LongGrass,
|
||||
make_model("voxygen.voxel.sprite.grass-0"),
|
||||
(BlockKind::LargeCactus, 0),
|
||||
make_model("voxygen.voxel.sprite.cacti.large_cactus"),
|
||||
),
|
||||
(
|
||||
BlockKind::Flowers,
|
||||
make_model("voxygen.voxel.sprite.flowers"),
|
||||
(BlockKind::BarrelCactus, 0),
|
||||
make_model("voxygen.voxel.sprite.cacti.barrel_cactus"),
|
||||
),
|
||||
// Fruit
|
||||
(
|
||||
(BlockKind::Apple, 0),
|
||||
make_model("voxygen.voxel.sprite.fruit.apple"),
|
||||
),
|
||||
// Flowers
|
||||
(
|
||||
(BlockKind::BlueFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_blue_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::BlueFlower, 1),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_blue_2"),
|
||||
),
|
||||
(
|
||||
(BlockKind::PinkFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_pink_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::PinkFlower, 1),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_pink_2"),
|
||||
),
|
||||
(
|
||||
(BlockKind::PinkFlower, 2),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_pink_3"),
|
||||
),
|
||||
(
|
||||
(BlockKind::PurpleFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_purple_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::RedFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_red_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::WhiteFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_white_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::YellowFlower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.flower_purple_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::Sunflower, 0),
|
||||
make_model("voxygen.voxel.sprite.flowers.sunflower_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::Sunflower, 1),
|
||||
make_model("voxygen.voxel.sprite.flowers.sunflower_2"),
|
||||
),
|
||||
// Grass
|
||||
(
|
||||
(BlockKind::LongGrass, 0),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_long_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::LongGrass, 1),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_long_2"),
|
||||
),
|
||||
(
|
||||
(BlockKind::LongGrass, 2),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_long_3"),
|
||||
),
|
||||
(
|
||||
(BlockKind::LongGrass, 3),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_long_4"),
|
||||
),
|
||||
(
|
||||
(BlockKind::LongGrass, 4),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_long_5"),
|
||||
),
|
||||
(
|
||||
(BlockKind::MediumGrass, 0),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_med_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::MediumGrass, 1),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_med_2"),
|
||||
),
|
||||
(
|
||||
(BlockKind::MediumGrass, 2),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_med_3"),
|
||||
),
|
||||
(
|
||||
(BlockKind::MediumGrass, 3),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_med_4"),
|
||||
),
|
||||
(
|
||||
(BlockKind::MediumGrass, 4),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_med_5"),
|
||||
),
|
||||
(
|
||||
(BlockKind::ShortGrass, 0),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_short_1"),
|
||||
),
|
||||
(
|
||||
(BlockKind::ShortGrass, 1),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_short_2"),
|
||||
),
|
||||
(
|
||||
(BlockKind::ShortGrass, 2),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_short_3"),
|
||||
),
|
||||
(
|
||||
(BlockKind::ShortGrass, 3),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_short_3"),
|
||||
),
|
||||
(
|
||||
(BlockKind::ShortGrass, 4),
|
||||
make_model("voxygen.voxel.sprite.grass.grass_short_5"),
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
|
@ -149,6 +149,7 @@ impl<'a> BlockGen<'a> {
|
||||
cave_xy,
|
||||
cave_alt,
|
||||
marble,
|
||||
marble_small,
|
||||
rock,
|
||||
//cliffs,
|
||||
cliff_hill,
|
||||
@ -257,16 +258,31 @@ impl<'a> BlockGen<'a> {
|
||||
))
|
||||
} else if (wposf.z as f32) < height + 0.9
|
||||
&& (wposf.z as f32 > water_height + 3.0)
|
||||
&& (chaos * 4096.0).fract() < 0.15
|
||||
&& marble > 0.6
|
||||
&& marble_small > 0.7
|
||||
&& (marble * 3173.7).fract() < 0.5
|
||||
{
|
||||
let flowers = [
|
||||
BlockKind::BlueFlower,
|
||||
BlockKind::PinkFlower,
|
||||
BlockKind::PurpleFlower,
|
||||
BlockKind::RedFlower,
|
||||
BlockKind::WhiteFlower,
|
||||
BlockKind::YellowFlower,
|
||||
BlockKind::Sunflower,
|
||||
];
|
||||
|
||||
let grasses = [
|
||||
BlockKind::LongGrass,
|
||||
BlockKind::MediumGrass,
|
||||
BlockKind::ShortGrass,
|
||||
];
|
||||
|
||||
Some(Block::new(
|
||||
if (height * 121.0).fract() < 0.15 {
|
||||
BlockKind::Wheat
|
||||
} else if (height * 121.0).fract() < 0.2 {
|
||||
BlockKind::Flowers
|
||||
if (height * 1271.0).fract() < 0.3 {
|
||||
flowers[(height * 7319.0) as usize % flowers.len()]
|
||||
} else {
|
||||
BlockKind::LongGrass
|
||||
grasses[(height * 7319.0) as usize % grasses.len()]
|
||||
},
|
||||
Rgb::broadcast(0),
|
||||
))
|
||||
@ -520,11 +536,7 @@ fn block_from_structure(
|
||||
)
|
||||
.map(|e| e as u8),
|
||||
)),
|
||||
StructureBlock::Fruit => Some(Block::new(
|
||||
BlockKind::Normal,
|
||||
Lerp::lerp(Rgb::new(237.0, 0.0, 0.0), Rgb::new(200.0, 237.0, 0.0), lerp)
|
||||
.map(|e| e as u8),
|
||||
)),
|
||||
StructureBlock::Fruit => Some(Block::new(BlockKind::Apple, Rgb::new(194, 30, 37))),
|
||||
StructureBlock::Hollow => Some(Block::empty()),
|
||||
StructureBlock::Normal(color) => {
|
||||
Some(Block::new(default_kind, color)).filter(|block| !block.is_empty())
|
||||
|
@ -366,11 +366,11 @@ lazy_static! {
|
||||
pub static ref FRUIT_TREES: Vec<Arc<Structure>> = vec![
|
||||
// fruit trees
|
||||
st_asset("world.tree.fruit.1", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.2", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.3", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.4", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.5", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.6", (5, 5, 7)),
|
||||
st_asset("world.tree.fruit.2", (6, 6, 7)),
|
||||
st_asset("world.tree.fruit.3", (6, 7, 7)),
|
||||
st_asset("world.tree.fruit.4", (3, 3, 7)),
|
||||
st_asset("world.tree.fruit.5", (6, 8, 7)),
|
||||
st_asset("world.tree.fruit.6", (7, 7, 7)),
|
||||
];
|
||||
|
||||
/*
|
||||
|
@ -360,6 +360,7 @@ impl<'a> Sampler for ColumnGen<'a> {
|
||||
cave_xy,
|
||||
cave_alt,
|
||||
marble,
|
||||
marble_small,
|
||||
rock,
|
||||
is_cliffs,
|
||||
near_cliffs,
|
||||
@ -386,6 +387,7 @@ pub struct ColumnSample<'a> {
|
||||
pub cave_xy: f32,
|
||||
pub cave_alt: f32,
|
||||
pub marble: f32,
|
||||
pub marble_small: f32,
|
||||
pub rock: f32,
|
||||
pub is_cliffs: bool,
|
||||
pub near_cliffs: bool,
|
||||
|
Loading…
x
Reference in New Issue
Block a user