Changeset ebaa95c in opengl-game


Ignore:
Timestamp:
Jul 2, 2018, 3:08:00 AM (6 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
5c02ddd
Parents:
95595de
Message:

Fix the logic for checking when asteroids leave the viewable scene area.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    r95595de rebaa95c  
    10361036               transformObject(objects[i], translate(mat4(1.0f), vec3(0.0f, 0.0f, 0.04f)), ubo);
    10371037
    1038                // TODO: Should really compare against the near clipping plane, but also account for
    1039                // the camera's translation and rotation
    1040                if (objects[i].bounding_center.z - objects[i].bounding_radius > 3.0f) {
     1038               vec3 obj_center = vec3(view_mat * vec4(objects[i].bounding_center, 1.0f));
     1039
     1040               if ((obj_center.z - objects[i].bounding_radius) > -NEAR_CLIP) {
    10411041                  removeObjectFromScene(objects[i], ubo);
    10421042               }
Note: See TracChangeset for help on using the changeset viewer.