Compare commits
2 commits
7724808d14
...
9b1703fa50
Author | SHA1 | Date | |
---|---|---|---|
9b1703fa50 | |||
2e268510a7 |
3 changed files with 10 additions and 12 deletions
|
@ -18,7 +18,7 @@ fn main() -> Result<()> {
|
||||||
world_builder.resources.insert(GameState::default());
|
world_builder.resources.insert(GameState::default());
|
||||||
|
|
||||||
// let dir = Path::new("C:/Users/M.Huebner/Downloads/Space Skybox Generator/Export");
|
// let dir = Path::new("C:/Users/M.Huebner/Downloads/Space Skybox Generator/Export");
|
||||||
let dir = Path::new("/home/michaelh/Sync/skybox");
|
let dir = Path::new("/home/michaelh/Sync/skybox_labeled");
|
||||||
SkyBox::new(
|
SkyBox::new(
|
||||||
&mut world_builder,
|
&mut world_builder,
|
||||||
[
|
[
|
||||||
|
@ -47,8 +47,7 @@ fn main() -> Result<()> {
|
||||||
enum GameState {
|
enum GameState {
|
||||||
#[default]
|
#[default]
|
||||||
Startup,
|
Startup,
|
||||||
Loading,
|
|
||||||
Menu,
|
|
||||||
Game(Game),
|
Game(Game),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +57,6 @@ impl GameState {
|
||||||
|
|
||||||
match me {
|
match me {
|
||||||
GameState::Startup => *me = GameState::Game(Game { start: world.now() }),
|
GameState::Startup => *me = GameState::Game(Game { start: world.now() }),
|
||||||
GameState::Loading => (),
|
|
||||||
GameState::Menu => (),
|
|
||||||
GameState::Game(game) => game.update(world)?,
|
GameState::Game(game) => game.update(world)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +68,6 @@ impl EventConsumer for GameState {
|
||||||
fn event(&mut self, world: &mut World, event: EngineEvent<'_>) -> Result<()> {
|
fn event(&mut self, world: &mut World, event: EngineEvent<'_>) -> Result<()> {
|
||||||
match self {
|
match self {
|
||||||
GameState::Startup => (),
|
GameState::Startup => (),
|
||||||
GameState::Loading => (),
|
|
||||||
GameState::Menu => (),
|
|
||||||
GameState::Game(game) => game.event(world, event)?,
|
GameState::Game(game) => game.event(world, event)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,10 +85,10 @@ impl Game {
|
||||||
let view = world.resources.get_mut::<Scene>().view_mut();
|
let view = world.resources.get_mut::<Scene>().view_mut();
|
||||||
let camera = view.camera_mut();
|
let camera = view.camera_mut();
|
||||||
|
|
||||||
|
let diff = now.as_secs_f32() - self.start.as_secs_f32();
|
||||||
camera.set_eye_dir(
|
camera.set_eye_dir(
|
||||||
Matrix3::from_angle_z(Deg((now.as_secs_f32() - self.start.as_secs_f32())
|
Matrix3::from_angle_z(Deg(diff * 36.0))
|
||||||
* 36.0
|
* Matrix3::from_angle_x(Deg(diff.sin() * 45.0))
|
||||||
* 2.0))
|
|
||||||
* Vector3::unit_y(),
|
* Vector3::unit_y(),
|
||||||
);
|
);
|
||||||
view.update_buffer()?;
|
view.update_buffer()?;
|
||||||
|
@ -101,7 +96,7 @@ impl Game {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn event(&mut self, world: &mut World, event: EngineEvent<'_>) -> Result<()> {
|
fn event(&mut self, _world: &mut World, _event: EngineEvent<'_>) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ fn find_shader_files(path: impl AsRef<Path>) -> Vec<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile_shader(shader_files: &[String]) {
|
fn compile_shader(shader_files: &[String]) {
|
||||||
|
println!("cargo:rerun-if-changed=shader/skybox.vert");
|
||||||
|
println!("cargo:rerun-if-changed=shader/skybox.frag");
|
||||||
|
|
||||||
Command::new("glslangValidator")
|
Command::new("glslangValidator")
|
||||||
.arg("--help")
|
.arg("--help")
|
||||||
.output()
|
.output()
|
||||||
|
|
|
@ -19,7 +19,7 @@ void main()
|
||||||
out_uvw = in_position;
|
out_uvw = in_position;
|
||||||
|
|
||||||
// Convert cubemap coordinates into Vulkan coordinate space
|
// Convert cubemap coordinates into Vulkan coordinate space
|
||||||
out_uvw.xy *= -1.0;
|
// out_uvw.xy *= -1.0;
|
||||||
|
|
||||||
// Remove translation from view matrix
|
// Remove translation from view matrix
|
||||||
mat4 view_mat = mat4(mat3(globals.view));
|
mat4 view_mat = mat4(mat3(globals.view));
|
||||||
|
|
Loading…
Reference in a new issue