Changeset 5b02676 in opengl-game for new-game.cpp
- Timestamp:
- Oct 4, 2019, 8:10:09 PM (6 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 83b5b4b
- Parents:
- ee75487
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
new-game.cpp
ree75487 r5b02676 166 166 void mouse_button_callback(GLFWwindow* window, int button, int action, int mods); 167 167 void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods); 168 /*** START OF REFACTORED CODE ***/ 168 169 void window_size_callback(GLFWwindow* window, int width, int height); 170 /*** END OF REFACTORED CODE ***/ 169 171 170 172 void APIENTRY debugGlCallback( … … 486 488 map<ObjectType, ShaderModelGroup> modelGroups; 487 489 490 /*** START OF REFACTORED CODE ***/ 488 491 modelGroups[TYPE_SHIP] = createModelGroup( 489 492 loadShaderProgram("gl-shaders/ship.vert", "gl-shaders/ship.frag")); … … 498 501 defineModelGroupAttrib(modelGroups[TYPE_SHIP], "ubo_index", ATTRIB_OBJECT_VARYING, 499 502 1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset)); 503 /*** END OF REFACTORED CODE ***/ 500 504 501 505 defineModelGroupUniform(modelGroups[TYPE_SHIP], "view", ATTRIB_UNIFORM, … … 506 510 initModelGroupAttribs(modelGroups[TYPE_SHIP]); 507 511 512 /*** START OF REFACTORED CODE ***/ 508 513 modelGroups[TYPE_ASTEROID] = createModelGroup( 509 514 loadShaderProgram("gl-shaders/asteroid.vert", "gl-shaders/asteroid.frag")); … … 518 523 defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "ubo_index", ATTRIB_OBJECT_VARYING, 519 524 1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset)); 525 /*** END OF REFACTORED CODE ***/ 520 526 521 527 defineModelGroupUniform(modelGroups[TYPE_ASTEROID], "view", ATTRIB_UNIFORM, … … 526 532 initModelGroupAttribs(modelGroups[TYPE_ASTEROID]); 527 533 534 /*** START OF REFACTORED CODE ***/ 528 535 modelGroups[TYPE_LASER] = createModelGroup( 529 536 loadShaderProgram("gl-shaders/laser.vert", "gl-shaders/laser.frag")); … … 536 543 defineModelGroupAttrib(modelGroups[TYPE_LASER], "ubo_index", ATTRIB_OBJECT_VARYING, 537 544 1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset)); 545 /*** END OF REFACTORED CODE ***/ 538 546 539 547 defineModelGroupUniform(modelGroups[TYPE_LASER], "view", ATTRIB_UNIFORM, … … 546 554 initModelGroupAttribs(modelGroups[TYPE_LASER]); 547 555 556 /*** START OF REFACTORED CODE ***/ 548 557 modelGroups[TYPE_EXPLOSION] = createModelGroup( 549 558 loadShaderProgram("gl-shaders/explosion.vert", "gl-shaders/explosion.frag")); … … 556 565 defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "ubo_index", ATTRIB_OBJECT_VARYING, 557 566 1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset)); 567 /*** END OF REFACTORED CODE ***/ 558 568 559 569 defineModelGroupUniform(modelGroups[TYPE_EXPLOSION], "cur_time", ATTRIB_UNIFORM, … … 1060 1070 } 1061 1071 1072 /*** START OF REFACTORED CODE ***/ 1062 1073 void window_size_callback(GLFWwindow* window, int width, int height) { 1063 1074 cout << "Window resized to (" << width << ", " << height << ")" << endl; … … 1073 1084 //glfwSetWindowAttrib(window, GLFW_DECORATED, GLFW_FALSE); 1074 1085 } 1086 /*** END OF REFACTORED CODE ***/ 1075 1087 1076 1088 void APIENTRY debugGlCallback( … … 1945 1957 1946 1958 void initModelGroupAttribs(ShaderModelGroup& modelGroup) { 1959 /*** START OF REFACTORED CODE ***/ 1947 1960 glBindVertexArray(modelGroup.vao); 1948 1961 1949 1962 map<string, AttribInfo>::iterator it; 1950 1963 for (it = modelGroup.attribs.begin(); it != modelGroup.attribs.end(); it++) { 1964 /*** END OF REFACTORED CODE ***/ 1951 1965 if (it->second.attribType == ATTRIB_UNIFORM) { 1952 1966 it->second.buffer = glGetUniformLocation(modelGroup.shaderProgram, it->first.c_str()); 1967 /*** START OF REFACTORED CODE ***/ 1953 1968 } else { 1954 1969 glEnableVertexAttribArray(it->second.index); … … 1969 1984 } 1970 1985 } 1986 /*** START OF REFACTORED CODE ***/ 1971 1987 } 1972 1988
Note:
See TracChangeset
for help on using the changeset viewer.