Changeset 5b02676 in opengl-game for new-game.cpp


Ignore:
Timestamp:
Oct 4, 2019, 8:10:09 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
83b5b4b
Parents:
ee75487
Message:

Make vulkangame and openglgame compile on OSX with the new GraphicsPipeline classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    ree75487 r5b02676  
    166166void mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
    167167void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
     168/*** START OF REFACTORED CODE ***/
    168169void window_size_callback(GLFWwindow* window, int width, int height);
     170/*** END OF REFACTORED CODE ***/
    169171
    170172void APIENTRY debugGlCallback(
     
    486488   map<ObjectType, ShaderModelGroup> modelGroups;
    487489
     490/*** START OF REFACTORED CODE ***/
    488491   modelGroups[TYPE_SHIP] = createModelGroup(
    489492      loadShaderProgram("gl-shaders/ship.vert", "gl-shaders/ship.frag"));
     
    498501   defineModelGroupAttrib(modelGroups[TYPE_SHIP], "ubo_index", ATTRIB_OBJECT_VARYING,
    499502      1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
     503/*** END OF REFACTORED CODE ***/
    500504
    501505   defineModelGroupUniform(modelGroups[TYPE_SHIP], "view", ATTRIB_UNIFORM,
     
    506510   initModelGroupAttribs(modelGroups[TYPE_SHIP]);
    507511
     512/*** START OF REFACTORED CODE ***/
    508513   modelGroups[TYPE_ASTEROID] = createModelGroup(
    509514      loadShaderProgram("gl-shaders/asteroid.vert", "gl-shaders/asteroid.frag"));
     
    518523   defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "ubo_index", ATTRIB_OBJECT_VARYING,
    519524      1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
     525/*** END OF REFACTORED CODE ***/
    520526
    521527   defineModelGroupUniform(modelGroups[TYPE_ASTEROID], "view", ATTRIB_UNIFORM,
     
    526532   initModelGroupAttribs(modelGroups[TYPE_ASTEROID]);
    527533
     534/*** START OF REFACTORED CODE ***/
    528535   modelGroups[TYPE_LASER] = createModelGroup(
    529536      loadShaderProgram("gl-shaders/laser.vert", "gl-shaders/laser.frag"));
     
    536543   defineModelGroupAttrib(modelGroups[TYPE_LASER], "ubo_index", ATTRIB_OBJECT_VARYING,
    537544      1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
     545/*** END OF REFACTORED CODE ***/
    538546
    539547   defineModelGroupUniform(modelGroups[TYPE_LASER], "view", ATTRIB_UNIFORM,
     
    546554   initModelGroupAttribs(modelGroups[TYPE_LASER]);
    547555
     556/*** START OF REFACTORED CODE ***/
    548557   modelGroups[TYPE_EXPLOSION] = createModelGroup(
    549558      loadShaderProgram("gl-shaders/explosion.vert", "gl-shaders/explosion.frag"));
     
    556565   defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "ubo_index", ATTRIB_OBJECT_VARYING,
    557566      1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
     567/*** END OF REFACTORED CODE ***/
    558568
    559569   defineModelGroupUniform(modelGroups[TYPE_EXPLOSION], "cur_time", ATTRIB_UNIFORM,
     
    10601070}
    10611071
     1072/*** START OF REFACTORED CODE ***/
    10621073void window_size_callback(GLFWwindow* window, int width, int height) {
    10631074   cout << "Window resized to (" << width << ", " << height << ")" << endl;
     
    10731084   //glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE);
    10741085}
     1086/*** END OF REFACTORED CODE ***/
    10751087
    10761088void APIENTRY debugGlCallback(
     
    19451957
    19461958void initModelGroupAttribs(ShaderModelGroup& modelGroup) {
     1959/*** START OF REFACTORED CODE ***/
    19471960   glBindVertexArray(modelGroup.vao);
    19481961
    19491962   map<string, AttribInfo>::iterator it;
    19501963   for (it = modelGroup.attribs.begin(); it != modelGroup.attribs.end(); it++) {
     1964/*** END OF REFACTORED CODE ***/
    19511965      if (it->second.attribType == ATTRIB_UNIFORM) {
    19521966         it->second.buffer = glGetUniformLocation(modelGroup.shaderProgram, it->first.c_str());
     1967/*** START OF REFACTORED CODE ***/
    19531968      } else {
    19541969         glEnableVertexAttribArray(it->second.index);
     
    19691984      }
    19701985   }
     1986/*** START OF REFACTORED CODE ***/
    19711987}
    19721988
Note: See TracChangeset for help on using the changeset viewer.