Changeset 8d5e67b in opengl-game for new-game.cpp


Ignore:
Timestamp:
Jun 15, 2018, 1:25:34 AM (6 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
c9af90a
Parents:
cf2d1e5
Message:

Modify the scene to have the asteroids come out of the top edge of the screen toward the player's ship.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    rcf2d1e5 r8d5e67b  
    748748   obj.selected_colors = { 0.0f };
    749749
    750    T_model = translate(mat4(), vec3(0.0f, -1.2f, 0.0f));
     750   T_model = translate(mat4(), vec3(0.0f, -1.2f, 1.8f));
    751751   R_model = rotate(mat4(), 20.0f * (float)ONE_DEG_IN_RAD, vec3(1.0f, 0.0f, 0.0f));
    752752   R_model = mat4();
    753    obj.model_base = T_model * R_model * scale(mat4(), vec3(0.3f, 0.3f, 0.3f));
     753   obj.model_base = T_model * R_model * scale(mat4(), vec3(0.1f, 0.1f, 0.1f));
    754754
    755755   addObjectToScene(obj);
    756756
    757    spawnAsteroid(vec3(0.0f, -1.2f, -11.5f), color_sp);
    758    spawnAsteroid(vec3(1.0f, -1.2f, -11.5f), color_sp);
    759    spawnAsteroid(vec3(-0.5f, -0.7f, -10.8f), color_sp);
     757   spawnAsteroid(vec3(0.0f, -1.2f, -21.5f), color_sp);
     758   spawnAsteroid(vec3(1.0f, -1.2f, -21.5f), color_sp);
     759   spawnAsteroid(vec3(-0.5f, -1.2f, -20.8f), color_sp);
    760760
    761761   vector<SceneObject>::iterator obj_it;
     
    827827   //cam_pos = vec3(-2.1f, -1.5f, -1.5f); // Good position for checking ship faces
    828828   float cam_yaw = 0.0f * 2.0f * 3.14159f / 360.0f;
    829    float cam_pitch = 0.0f * 2.0f * 3.14159f / 360.0f;
     829   float cam_pitch = -50.0f * 2.0f * 3.14159f / 360.0f;
    830830
    831831   mat4 T = translate(mat4(), vec3(-cam_pos.x, -cam_pos.y, -cam_pos.z));
    832    mat4 R = mat4();
     832   mat4 yaw_mat = rotate(mat4(), -cam_yaw, vec3(0.0f, 1.0f, 0.0f));
     833   mat4 pitch_mat = rotate(mat4(), -cam_pitch, vec3(1.0f, 0.0f, 0.0f));
     834   mat4 R = pitch_mat * yaw_mat;
    833835   view_mat = R*T;
    834836
     
    964966
    965967         if (key_pressed[GLFW_KEY_DOWN]) {
    966             transformObject(objects[1], translate(mat4(), vec3(0.0f, 0.0f, 0.17f)), ubo);
     968            transformObject(objects[1], translate(mat4(), vec3(0.0f, 0.0f, 0.03f)), ubo);
    967969            transformObject(objects[2], translate(mat4(), vec3(0.0f, 0.0f, 0.06f)), ubo);
    968             transformObject(objects[3], translate(mat4(), vec3(0.0f, 0.0f, 0.11f)), ubo);
     970            transformObject(objects[3], translate(mat4(), vec3(0.0f, 0.0f, 0.04f)), ubo);
    969971         }
    970972      }
     
    16611663   mat4 T = translate(mat4(), pos);
    16621664   mat4 R = rotate(mat4(), 60.0f * (float)ONE_DEG_IN_RAD, vec3(1.0f, 1.0f, -1.0f));
    1663    obj.model_base = T * R * scale(mat4(), vec3(0.2f, 0.2f, 0.2f));
     1665   obj.model_base = T * R * scale(mat4(), vec3(0.1f, 0.1f, 0.1f));
    16641666
    16651667   addObjectToScene(obj);
Note: See TracChangeset for help on using the changeset viewer.