Changeset 73a10ca in opengl-game


Ignore:
Timestamp:
Apr 19, 2020, 3:41:08 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
52a02e6, 845a2cb
Parents:
7297892
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (04/19/20 15:30:19)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (04/19/20 15:41:08)
Message:

Update OpenGLRef to more accurately reflect which code has been ported over to VulkanGame

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    r7297892 r73a10ca  
    162162};
    163163
     164/*** START OF REFACTORED CODE ***/
    164165void glfw_error_callback(int error, const char* description);
    165166
    166167void mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
    167168void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
    168 /*** START OF REFACTORED CODE ***/
    169169void window_size_callback(GLFWwindow* window, int width, int height);
    170 /*** END OF REFACTORED CODE ***/
    171170
    172171void APIENTRY debugGlCallback(
     
    179178   const void* userParam
    180179);
     180/*** END OF REFACTORED CODE ***/
    181181
    182182bool faceClicked(array<vec3, 3> points, SceneObject* obj, vec4 world_ray, vec4 cam, vec4& click_point);
     
    187187unsigned char* loadImage(string file_name, int* x, int* y);
    188188
     189/*** START OF REFACTORED CODE ***/
    189190void initObject(SceneObject* obj);
    190191void addObjectToScene(SceneObject* obj,
     
    192193                  map<ObjectType, ShaderModelGroup>& modelGroups,
    193194                  GLuint ubo);
     195/*** END OF REFACTORED CODE ***/
    194196void removeObjectFromScene(SceneObject& obj, GLuint ubo);
    195197
     
    198200void addModelToGroup(ShaderModelGroup& modelGroup, SceneObject& model);
    199201
     202/*** START OF REFACTORED CODE ***/
    200203void defineModelGroupAttrib(ShaderModelGroup& modelGroup, string name, AttribType attribType, GLint size, GLenum type, size_t fieldOffset);
    201204void defineModelGroupUniform(ShaderModelGroup& modelGroup, string name, AttribType attribType, GLint size, UniformType type, GLfloat* data);
     
    203206void bindUniformData(AttribInfo& attrib);
    204207void bindUniformData(AttribInfo& attrib, GLfloat* data);
     208/*** END OF REFACTORED CODE ***/
    205209
    206210size_t GLsizeof(GLenum);
     
    210214void calculateObjectBoundingBox(SceneObject* obj);
    211215
     216/*** START OF REFACTORED CODE ***/
    212217void populateBuffers(vector<SceneObject*>& objects,
    213218                  map<GLuint, BufferInfo>& shaderBufferInfo,
     
    226231Asteroid* createAsteroid(vec3 pos);
    227232Laser* createLaser(vec3 start, vec3 end, vec3 color, GLfloat width);
     233/*** END OF REFACTORED CODE ***/
    228234ParticleEffect* createExplosion(mat4 model_mat);
    229235
     236/*** START OF REFACTORED CODE ***/
    230237void translateLaser(Laser* laser, const vec3& translation, GLuint ubo);
    231238void updateLaserTarget(Laser* laser, vector<SceneObject*>& objects, ShaderModelGroup& laserSmg, GLuint asteroid_sp);
    232239bool getLaserAndAsteroidIntersection(vec3& start, vec3& end, SceneObject& asteroid, vec3& intersection);
     240/*** END OF REFACTORED CODE ***/
    233241
    234242void renderMainMenu();
     
    253261bool key_down[NUM_KEYS];
    254262
     263/*** START OF REFACTORED CODE ***/
    255264int windowWidth = 640;
    256265int windowHeight = 480;
     
    262271
    263272vector<SceneObject*> objects;
     273vector<EffectOverTime*> effects;
     274/*** END OF REFACTORED CODE ***/
    264275queue<Event> events;
    265 vector<EffectOverTime*> effects;
    266276
    267277SceneObject* clickedObject = NULL;
    268278SceneObject* selectedObject = NULL;
    269279
     280/*** START OF REFACTORED CODE ***/
    270281float NEAR_CLIP = 0.1f;
    271282float FAR_CLIP = 100.0f;
     
    274285bool isRunning = true;
    275286
    276 ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
    277 
    278287Laser* leftLaser = NULL;
    279288EffectOverTime* leftLaserEffect = NULL;
     
    281290Laser* rightLaser = NULL;
    282291EffectOverTime* rightLaserEffect = NULL;
     292/*** END OF REFACTORED CODE ***/
    283293
    284294map<string, vector<UIValue>> valueLists;
    285295
     296/*** START OF REFACTORED CODE ***/
    286297/*
    287298* TODO: Asteroid and ship movement currently depend on framerate, fix this in a generic/reusable way
     
    289300*/
    290301
    291 /*** START OF REFACTORED CODE ***/
    292302// Helps to test logging during crashes
    293303void badFunc() {
     
    570580   initModelGroupAttribs(modelGroups[TYPE_EXPLOSION]);
    571581
     582/*** START OF REFACTORED CODE ***/
    572583   cam_pos = vec3(0.0f, 0.0f, 2.0f);
    573584   float cam_yaw = 0.0f * 2.0f * 3.14159f / 360.0f;
     
    655666
    656667   GLuint laser_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_LASER].shaderProgram, "models");
     668/*** END OF REFACTORED CODE ***/
    657669
    658670   GLuint explosion_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_EXPLOSION].shaderProgram, "models");
    659671
    660672
     673/*** START OF REFACTORED CODE ***/
    661674   glUseProgram(modelGroups[TYPE_SHIP].shaderProgram);
    662675   bindUniformData(modelGroups[TYPE_SHIP].attribs["view"]);
     
    685698   glUniformBlockBinding(modelGroups[TYPE_LASER].shaderProgram, laser_sp_models_ub_index, ub_binding_point);
    686699   glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
     700/*** END OF REFACTORED CODE ***/
    687701
    688702
     
    769783      if (curState == STATE_GAME) {
    770784
     785/*** START OF REFACTORED CODE ***/
    771786         elapsed_seconds_spawn += elapsedTime;
    772787         if (elapsed_seconds_spawn > 0.5f) {
     
    776791            elapsed_seconds_spawn -= 0.5f;
    777792         }
     793/*** END OF REFACTORED CODE ***/
    778794
    779795         /*
     
    786802         */
    787803
     804/*** START OF REFACTORED CODE ***/
    788805         /*
    789806         if (key_state[GLFW_KEY_SPACE] == GLFW_PRESS) {
     
    861878
    862879                     removeObjectFromScene(*objects[i], ubo);
     880/*** END OF REFACTORED CODE ***/
    863881                     score++;
    864882
     
    871889                  }
    872890               }
     891/*** START OF REFACTORED CODE ***/
    873892            }
    874893         }
     
    958977         cam_moved = false;
    959978      }
     979/*** END OF REFACTORED CODE ***/
    960980
    961981      glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
     
    14261446}
    14271447
     1448/*** START OF REFACTORED CODE ***/
    14281449SceneObject* createShip() {
    14291450   SceneObject* ship = new SceneObject();
     
    18961917   return obj;
    18971918}
     1919/*** END OF REFACTORED CODE ***/
    18981920
    18991921ShaderModelGroup createModelGroup(GLuint shaderProgram) {
     
    19201942}
    19211943
     1944/*** START OF REFACTORED CODE ***/
    19221945void defineModelGroupAttrib(ShaderModelGroup& modelGroup, string name, AttribType attribType,
    19231946                  GLint size, GLenum type, size_t fieldOffset) {
     
    19381961}
    19391962
    1940 /*** START OF REFACTORED CODE ***/
    19411963void defineModelGroupUniform(ShaderModelGroup& modelGroup, string name, AttribType attribType,
    19421964                  GLint size, UniformType type, GLfloat* data) {
     
    19771999   }
    19782000}
    1979 /*** END OF REFACTORED CODE ***/
    19802001
    19812002void bindUniformData(AttribInfo& attrib) {
     
    20102031   }
    20112032}
     2033/*** END OF REFACTORED CODE ***/
    20122034
    20132035/* The purpose of this function is to replace the use of sizeof() when calling
     
    23932415      ImGui::Text("Hello, world!");                           // Display some text (you can use a format string too)
    23942416      ImGui::SliderFloat("float", &f, 0.0f, 1.0f);            // Edit 1 float using a slider from 0.0f to 1.0f   
    2395       ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
    23962417
    23972418      ImGui::Checkbox("Demo Window", &show_demo_window);      // Edit bools storing our windows open/close state
     
    25282549}
    25292550
     2551/*** START OF REFACTORED CODE ***/
    25302552Asteroid* createAsteroid(vec3 pos) {
    25312553   Asteroid* obj = new Asteroid();
     
    26492671   return obj;
    26502672}
     2673/*** END OF REFACTORED CODE ***/
    26512674
    26522675// TODO: Maybe pass in startTime instead of calling glfwGetTime() here
Note: See TracChangeset for help on using the changeset viewer.