height map generator

This commit is contained in:
2024-03-24 21:36:26 -04:00
commit e9757a5371
13 changed files with 4650 additions and 0 deletions

11
game/main/Cargo.toml Normal file
View File

@@ -0,0 +1,11 @@
[package]
name = "phos"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.13.0"
bevy-inspector-egui = "0.23.4"
noise = "0.8.2"

28
game/main/src/main.rs Normal file
View File

@@ -0,0 +1,28 @@
use bevy::{pbr::wireframe::WireframePlugin, prelude::*};
use bevy_inspector_egui::quick::WorldInspectorPlugin;
mod phos;
use phos::PhosGamePlugin;
fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Phos".into(),
name: Some("phos".into()),
resolution: (1920.0, 1080.0).into(),
resizable: false,
enabled_buttons: bevy::window::EnabledButtons {
maximize: false,
..Default::default()
},
..default()
}),
..default()
}),
WireframePlugin,
WorldInspectorPlugin::new(),
PhosGamePlugin,
))
.run();
}

32
game/main/src/phos.rs Normal file
View File

@@ -0,0 +1,32 @@
use bevy::{pbr::CascadeShadowConfig, prelude::*};
pub struct PhosGamePlugin;
impl Plugin for PhosGamePlugin {
fn build(&self, app: &mut App) {
app.add_systems(Startup, init_game);
}
}
fn init_game(mut commands: Commands) {
commands.spawn((
Camera3dBundle {
transform: Transform::from_xyz(0., 50., 0.)
.looking_at(Vec3::new(50., 0., 50.), Vec3::Y),
..default()
},
));
commands.spawn(DirectionalLightBundle {
directional_light: DirectionalLight {
shadows_enabled: false,
..default()
},
cascade_shadow_config: CascadeShadowConfig {
bounds: vec![20., 40., 80., 1000., 5000., 19000., 20000.],
..default()
},
transform: Transform::from_xyz(0.0, 16.0, 5.).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
}