actually find the parser bug (not handling lines that end in \r\n). formatting changes. comment out functions b/c clang can't be bothered to generate generic function defs if the function that uses it isn't actually part of the main program
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -8,11 +8,12 @@
|
||||
#include "util.hpp"
|
||||
#include "shaders.hpp"
|
||||
#include "body.hpp"
|
||||
#include "tcp_server.hpp"
|
||||
|
||||
static GLFWwindow* window;
|
||||
static float width, height;
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
|
||||
void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
|
||||
width = w;
|
||||
height = h;
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -21,7 +22,6 @@ void framebuffer_size_callback(GLFWwindow* window, int w, int h) {
|
||||
void process_input() {
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, true);
|
||||
|
||||
}
|
||||
|
||||
static bool mouse_pressed = false;
|
||||
@@ -50,7 +50,7 @@ static void cursor_position_callback(GLFWwindow* window, double xpos, double ypo
|
||||
}
|
||||
|
||||
if (scroll_pressed) {
|
||||
focal_point += strafe_x * (dx/300) + strafe_y * (dy/300);
|
||||
focal_point += strafe_x * (dx / 300) + strafe_y * (dy / 300);
|
||||
}
|
||||
|
||||
double len = glm::length(camera_loc);
|
||||
@@ -75,12 +75,11 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
||||
glfwGetCursorPos(window, &prev_cursor_x, &prev_cursor_y);
|
||||
}
|
||||
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
|
||||
glm::vec4 k = camera_t[2];
|
||||
float d = yoffset;
|
||||
|
||||
camera_loc += k * (d/10 * glm::max(glm::length(camera_loc), 1.0f));
|
||||
camera_loc += k * (d / 10 * max(glm::length(camera_loc), 1.0f));
|
||||
|
||||
camera_t = glm::lookAt(camera_loc, focal_point, up);
|
||||
}
|
||||
@@ -107,8 +106,12 @@ bool glfw_setup() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
//tcpserver server;
|
||||
//if (!create_server(&server, "127.0.0.1", 5000, 1)) {
|
||||
// //return -1;
|
||||
//}
|
||||
|
||||
if (!glfw_setup())
|
||||
return -1;
|
||||
|
||||
@@ -126,7 +129,7 @@ int main() {
|
||||
if (!load_shader(&shader, vertex_filepath, fragment_filepath))
|
||||
return -1;
|
||||
|
||||
//glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
// glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT); // Write to back buffer
|
||||
|
||||
@@ -147,9 +150,9 @@ int main() {
|
||||
b2.pose = glm::translate(b.pose, glm::vec3(2, 0, 0));
|
||||
b2.color = glm::vec4(0, 0.5, 0, 1);
|
||||
|
||||
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
//set_uniform(shader, "color", glm::vec4 { sin(time), sin(time + glm::radians(45.0f)), sin(time + glm::radians(90.0f)), 1.0 } / 2.0f);
|
||||
//time = glfwGetTime();
|
||||
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
// set_uniform(shader, "color", glm::vec4 { sin(time), sin(time + glm::radians(45.0f)), sin(time +
|
||||
// glm::radians(90.0f)), 1.0 } / 2.0f); time = glfwGetTime();
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
Reference in New Issue
Block a user