Changeset a23fc08 in opengl-game


Ignore:
Timestamp:
May 24, 2019, 8:52:32 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
6abfd07
Parents:
98f06d9
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (05/24/19 20:22:31)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (05/24/19 20:52:32)
Message:

Move several functions from new-game.cpp to utils.cpp

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • TODO.txt

    r98f06d9 ra23fc08  
    66 -Update the IMGUI code in a generic way to support this as well
    77-Check the book's "Printing Parameters from the GL Context" to output a bunch of OpenGL context params
    8 -Move some common functions into a Utils class
    98
    109DONE
     
    1716 - What I really need to do is completely refactor the logger class to return an ofstream to the logger file
    1817   and use streaming to send output to it. The log file can be closed in the destructor.
     18-Move some common functions into a Utils class
    1919
    2020NEW TODO
  • makefile

    r98f06d9 ra23fc08  
    1515# as this well prevent regenerating .o files for unchanged .cpp files
    1616
    17 newgame: new-game.cpp logger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp CrashLogger.cpp $(IMGUI_FILES)
     17newgame: new-game.cpp logger.cpp utils.cpp CrashLogger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp $(IMGUI_FILES)
    1818        $(CC) $^ $(DEP) $(CFLAGS) -o $@
    1919
  • new-game.cpp

    r98f06d9 ra23fc08  
    198198unsigned char* loadImage(string file_name, int* x, int* y);
    199199
    200 void printVec3(string label, const vec3& v);
    201 void printVec4(string label, const vec4& v);
    202 void printMat4(string label, const mat4& m);
    203 
    204200void initObject(SceneObject* obj);
    205201void addObjectToScene(SceneObject* obj,
     
    255251void initGuiValueLists(map<string, vector<UIValue>> valueLists);
    256252void renderGuiValueList(vector<UIValue>& values);
    257 
    258 float getRandomNum(float low, float high);
    259253
    260254#define NUM_KEYS (512)
     
    13481342}
    13491343
    1350 void printVec3(string label, const vec3& v) {
    1351    cout << label << " -> (" << v.x << "," << v.y << "," << v.z << ")" << endl;
    1352 }
    1353 
    1354 void printVec4(string label, const vec4& v) {
    1355    cout << label << " -> (" << v.x << "," << v.y << "," << v.z << "," << v.w << ")" << endl;
    1356 }
    1357 
    1358 void printMat4(string label, const mat4& m) {
    1359    cout << label << ": " << endl;
    1360    cout << "[ " << m[0][0] << " " << m[1][0] << " " << m[2][0] << " " << m[3][0] <<  " ]" << endl;
    1361    cout << "[ " << m[0][1] << " " << m[1][1] << " " << m[2][1] << " " << m[3][1] <<  " ]" << endl;
    1362    cout << "[ " << m[0][2] << " " << m[1][2] << " " << m[2][2] << " " << m[3][2] <<  " ]" << endl;
    1363    cout << "[ " << m[0][3] << " " << m[1][3] << " " << m[2][3] << " " << m[3][3] <<  " ]" << endl;
    1364 }
    1365 
    13661344// TODO: Pass a reference, not a pointer
    13671345void initObject(SceneObject* obj) {
     
    27362714   return obj;
    27372715}
    2738 
    2739 float getRandomNum(float low, float high) {
    2740    return low + ((float)rand() / RAND_MAX) * (high-low);
    2741 }
  • utils.h

    r98f06d9 ra23fc08  
     1#ifndef __UTILS_H__
     2#define __UTILS_H__
     3
     4#include <string>
     5
     6#include <glm/mat4x4.hpp>
     7
     8using namespace std;
     9using namespace glm;
     10
     11float getRandomNum(float low, float high);
     12
     13void printVec3(string label, const vec3& v);
     14void printVec4(string label, const vec4& v);
     15void printMat4(string label, const mat4& m);
     16
    117// Code for offset_of function from https://gist.github.com/graphitemaster/494f21190bb2c63c5516
    218
     
    1632   return offset_of_impl<T1, T2>::offset(member);
    1733}
     34
     35#endif
Note: See TracChangeset for help on using the changeset viewer.