Changeset 201e2f8 in opengl-game
- Timestamp:
- Aug 18, 2017, 1:53:46 AM (7 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 8e232ce
- Parents:
- 7ee66ea
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
r7ee66ea r201e2f8 110 110 }; 111 111 112 GLfloat model_mat[] = { 113 1.0f, 0.0f, 0.0f, 0.0f, // column 1 114 0.0f, 1.0f, 0.0f, 0.0f, // column 2 115 0.0f, 0.0f, 1.0f, 0.0f, // column 3 116 0.5f, 0.0f, 0.0f, 1.0f, // column 4 117 }; 112 mat4 T_model = translate(mat4(), vec3(0.5f, 0.0f, 0.0f)); 113 mat4 R_model = rotate(mat4(), 4.0f, vec3(0.0f, 1.0f, 0.0f)); 114 mat4 model_mat = T_model*R_model; 118 115 119 116 GLuint points_vbo = 0; … … 151 148 152 149 float cam_speed = 1.0f; 153 float cam_yaw_speed = 30.0f*ONE_DEG_IN_RAD;150 float cam_yaw_speed = 60.0f*ONE_DEG_IN_RAD; 154 151 155 152 float cam_pos[] = {0.0f, 0.0f, 2.0f}; … … 183 180 184 181 glUseProgram(shader_program); 185 glUniformMatrix4fv(model_mat_loc, 1, GL_FALSE, model_mat);182 glUniformMatrix4fv(model_mat_loc, 1, GL_FALSE, value_ptr(model_mat)); 186 183 glUniformMatrix4fv(view_mat_loc, 1, GL_FALSE, value_ptr(view_mat)); 187 184 glUniformMatrix4fv(proj_mat_loc, 1, GL_FALSE, proj_mat); … … 220 217 float dist = cam_speed * elapsed_seconds; 221 218 if (glfwGetKey(window, GLFW_KEY_A)) { 222 cam_pos[0] -= cos(cam_yaw *ONE_DEG_IN_RAD)*dist;223 cam_pos[2] += sin(cam_yaw *ONE_DEG_IN_RAD)*dist;219 cam_pos[0] -= cos(cam_yaw)*dist; 220 cam_pos[2] += sin(cam_yaw)*dist; 224 221 cam_moved = true; 225 222 }
Note:
See TracChangeset
for help on using the changeset viewer.