Fixed wonky WASD movement

This commit is contained in:
2024-07-12 16:58:21 +02:00
parent b3772ae0ac
commit 328a85feb1
2 changed files with 48 additions and 30 deletions
+7 -5
View File
@@ -19,20 +19,21 @@ public:
bool shouldClose();
void swapBuffers();
void processInput();
void cursorPosCallback(double xpos, double ypos);
static void cursorPosCallback(GLFWwindow* window, double xpos, double ypos);
static void mouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
private:
GLFWwindow* window;
void drawSphere(const glm::vec3& position, float radius);
void createSphereMesh(float radius, int sectors, int stacks);
void drawDebugTriangle(); // Debug function to draw a triangle
void drawDebugTriangle();
GLuint sphereVAO, sphereVBO, sphereEBO;
int sphereVertexCount, sphereIndexCount;
void drawGrid(const Simulator& simulator);
float calculateGravityFieldStrength(const glm::vec3& point, const std::vector<CelestialBody>& bodies);
void drawGravityField(const Simulator& simulator);
void drawTrajectories(const std::vector<CelestialBody>& bodies);
glm::vec3 cameraPos;
@@ -42,9 +43,10 @@ private:
float mouseSensitivity;
float yaw;
float pitch;
bool firstMouse;
double lastX, lastY;
bool mousePressed;
double lastMouseX, lastMouseY;
void updateCameraVectors();
void handleMouseMove(double xpos, double ypos);
};
#endif //GRAVITY_RENDERER_H