Changeset a5b5e95 in opengl-game
- Timestamp:
- Mar 7, 2018, 2:13:27 AM (7 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 64a70f4
- Parents:
- 0424bd8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
r0424bd8 ra5b5e95 160 160 161 161 //x = -.1f; 162 x = -.25f;162 //x = -.25f; 163 163 //x = -.5f; 164 164 165 y = .1f;165 //y = .1f; 166 166 167 167 cout << "x: " << x << ", y: " << y << endl; … … 181 181 182 182 //vec4 ray_clip = vec4(0.0f, 0.0f, NEAR_CLIP, 1.0f); // this should have a z equal to the near clipping plane 183 vec4 ray_clip = vec4(x, y, 0.0f, 1.0f); // this should have a z equal to the near clipping plane183 vec4 ray_clip = vec4(x, y, NEAR_CLIP, 1.0f); // this should have a z equal to the near clipping plane 184 184 vec4 ray_eye = ray_clip; 185 185 vec3 ray_world = (inverse(view_mat) * ray_eye).xyz(); … … 189 189 * Normalizing the world ray caused issues, although it should make sense with the projection 190 190 * matrix, since the z coordinate has meaning there. 191 *192 * Now, I need to figure out the correct intersection test in 2D space193 * Also, need to check that the global triangle points are correct194 191 */ 195 192 196 193 printVector("Initial world ray:", ray_world); 197 194 198 // Theoretically, I should be able to change the z of the camera to whatever I want. 199 // Figure out why I can't. 200 // Remember that ray_world has to be a ray along the click line, not any point along it 201 // vec3 cam_pos_temp = ray_world; 202 // ray_world = vec3(0.0f, 0.0f, 1.0f); 203 204 vec3 cam_pos_temp = vec3(ray_world.xy(), 0.0f); 195 vec4 cam_pos_origin = vec4(x, y, 0.0f, 1.0f); 196 vec3 cam_pos_temp = (inverse(view_mat) * cam_pos_origin).xyz(); 197 205 198 ray_world = ray_world-cam_pos_temp; 206 207 // upper right corner is 1, 1 in opengl208 199 209 200 cout << "Ray clip -> (" << ray_clip.x << "," << ray_clip.y << "," << ray_clip.z << ")" << endl << endl;; … … 484 475 485 476 //cam_pos = vec3(0.0f, 0.0f, 2.0f); 486 cam_pos = vec3(0. 0f, 0.0f, 0.0f);477 cam_pos = vec3(0.3f, 0.0f, 0.3f); 487 478 float cam_yaw = 45.0f * 2.0f * 3.14159f / 360.0f; 488 479
Note:
See TracChangeset
for help on using the changeset viewer.