Compare commits
2 commits
450c92ec55
...
769dd30fdd
Author | SHA1 | Date | |
---|---|---|---|
Mars | 769dd30fdd | ||
avery | 9b468e5c8a |
16
src/main.cpp
16
src/main.cpp
|
@ -244,24 +244,24 @@ class VulkanApp {
|
||||||
|
|
||||||
struct Camera {
|
struct Camera {
|
||||||
glm::dvec3 position;
|
glm::dvec3 position;
|
||||||
glm::dvec3 front;
|
|
||||||
glm::dvec3 up;
|
glm::dvec3 up;
|
||||||
f64 speed {};
|
glm::dvec3 look_at;
|
||||||
|
f64 speed {1.0};
|
||||||
|
|
||||||
Camera() : position(2.0, 2.0, 2.0), front(0.0, 0.0, 0.0), up(0.0, 0.0, 1.0) {}
|
Camera() : position(2.0, 2.0, 2.0), up(0.0, 0.0, 1.0), look_at(0.0) {}
|
||||||
|
|
||||||
[[nodiscard]] fn getViewMatrix() const -> glm::mat4 { return glm::lookAt(position, front, up); }
|
[[nodiscard]] fn getViewMatrix() const -> glm::mat4 { return glm::lookAt(position, look_at, up); }
|
||||||
|
|
||||||
fn moveForward(f64 deltaTime) -> void { position += speed * front * deltaTime; }
|
fn moveForward(f64 deltaTime) -> void { position += (look_at - position) * speed * deltaTime; }
|
||||||
|
|
||||||
fn moveBackward(f64 deltaTime) -> void { position -= speed * front * deltaTime; }
|
fn moveBackward(f64 deltaTime) -> void { position -= (look_at - position) * speed * deltaTime; }
|
||||||
|
|
||||||
fn moveLeft(f64 deltaTime) -> void {
|
fn moveLeft(f64 deltaTime) -> void {
|
||||||
position -= glm::normalize(glm::cross(front, up)) * speed * deltaTime;
|
position -= glm::normalize(glm::cross((look_at - position), up)) * speed * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn moveRight(f64 deltaTime) -> void {
|
fn moveRight(f64 deltaTime) -> void {
|
||||||
position += glm::normalize(glm::cross(front, up)) * speed * deltaTime;
|
position += glm::normalize(glm::cross((look_at - position), up)) * speed * deltaTime;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ShaderCompiler {
|
||||||
throw runtime_error("Shader compilation failed for: " + shaderName);
|
throw runtime_error("Shader compilation failed for: " + shaderName);
|
||||||
|
|
||||||
// Cache the compiled SPIR-V binary
|
// Cache the compiled SPIR-V binary
|
||||||
saveCompiledShader(spirvCode, cacheFile);
|
saveCompiledShader(spirvCode, cacheFile.string());
|
||||||
return spirvCode;
|
return spirvCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace stb {
|
||||||
*
|
*
|
||||||
* @param path The filesystem path to the image file to load.
|
* @param path The filesystem path to the image file to load.
|
||||||
*/
|
*/
|
||||||
UniqueImage(const std::filesystem::path& path) { load(path.c_str()); }
|
UniqueImage(const std::filesystem::path& path) { load(path.string().c_str()); }
|
||||||
|
|
||||||
// Deleted copy constructor to prevent copying.
|
// Deleted copy constructor to prevent copying.
|
||||||
UniqueImage(const UniqueImage&) = delete;
|
UniqueImage(const UniqueImage&) = delete;
|
||||||
|
|
Loading…
Reference in a new issue