]> git.lizzy.rs Git - shadowclad.git/commitdiff
Reorder, move and rename things
authoroutfrost <kotlet.bahn@gmail.com>
Thu, 24 Jan 2019 02:37:37 +0000 (03:37 +0100)
committeroutfrost <kotlet.bahn@gmail.com>
Thu, 24 Jan 2019 02:37:37 +0000 (03:37 +0100)
* Reorder header includes alphabetically
* Move initRender() to render.c
* Rename glut_janitor to ui

14 files changed:
debugutil.c
debugutil.h
glut_janitor.c [deleted file]
glut_janitor.h [deleted file]
level.c
level.h
main.c
performance.c
performance.h
render.c
render.h
tga.c
ui.c [new file with mode: 0644]
ui.h [new file with mode: 0644]

index ca6dba16acd8f4c20e94b4ac93f80c3d09ee4b26..80f5caadb194cf321fa036651e18f6deed06a6b3 100644 (file)
@@ -1,7 +1,7 @@
 #include <GL/gl.h>
-#include <string.h>
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "assimp_types.h"
 
index bc5d346443ec66717d632181b667f92784227edd..4d66e3d2282a8733891c58bb114d45c976b00097 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "assimp_types.h"
 
-char* getGlInfoString();
+char* getGlInfoString(void);
 void dumpScene(FILE* stream, const AiScene* scene);
 void dumpNode(FILE* stream, const AiNode* node);
 
diff --git a/glut_janitor.c b/glut_janitor.c
deleted file mode 100644 (file)
index db71091..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <GL/gl.h>
-
-void initRender() {
-       // Set the clear colour to black
-       glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
-       
-       GLfloat light0_ambient[] = {0.1f, 0.1f, 0.1f, 1.0f};
-       GLfloat light0_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
-       GLfloat light0_specular[] = {1.0f, 1.0f, 1.0f, 1.0f};
-       GLfloat light0_position[] = {5.0f, 10.0f, 10.0f, 1.0f};
-       
-       glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
-       glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
-       glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
-       glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
-       
-       glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0f);
-       glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05f);
-       glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.001f);
-}
-
-void resizeStage(GLsizei width, GLsizei height) {
-       if (height == 0)
-               height = 1;
-       
-       // Set device viewport dimensions
-       glViewport(0, 0, width, height);
-       // Switch to projection matrix
-       glMatrixMode(GL_PROJECTION);
-       // Reset the projection matrix
-       glLoadIdentity();
-       
-       GLfloat aspectRatio = (GLfloat) width / (GLfloat) height;
-       
-       glOrtho(-8.0, 8.0, -8.0/aspectRatio, 8.0/aspectRatio, 128.0, -128.0);
-       
-       glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
-       glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
-       
-       glMatrixMode(GL_MODELVIEW);
-}
diff --git a/glut_janitor.h b/glut_janitor.h
deleted file mode 100644 (file)
index 42080c1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef GLUT_JANITOR_H_
-#define GLUT_JANITOR_H_
-
-#include <GL/gl.h>
-
-void initRender();
-void resizeStage(GLsizei width, GLsizei height);
-
-#endif
diff --git a/level.c b/level.c
index 5e1cd6fbf5d73432e4cf834d48cdc0397fe1c5cd..1388a928bbd49178beee0287d4f7500b33ee5aca 100644 (file)
--- a/level.c
+++ b/level.c
@@ -1,6 +1,5 @@
 #include <GL/gl.h>
 #include <assimp/cimport.h>
-
 #include <stdio.h> // TODO remove
 
 #include "level.h"
diff --git a/level.h b/level.h
index b36c2bb88738b3550593d2126c518b5118279762..387df43a9b4bf2f9ec4d46e169a48fb2cfec5d6f 100644 (file)
--- a/level.h
+++ b/level.h
@@ -11,7 +11,7 @@ typedef uint32_t Block;
 
 const AiScene* levelScene;
 
-void initLevel();
+void initLevel(void);
 void setImage(TgaImage* image);
 const AiScene* importScene(const char* path);
 
diff --git a/main.c b/main.c
index 28b3c4db384f07468c7a8b3e5f41d9c6aa9296df..cf8dcdf17d3eac7aedc3ae84cdacf4ae1e1d29ce 100644 (file)
--- a/main.c
+++ b/main.c
@@ -3,10 +3,10 @@
 #include <stdio.h>
 
 #include "debugutil.h"
-#include "glut_janitor.h"
-#include "render.h"
 #include "level.h"
 #include "performance.h"
+#include "render.h"
+#include "ui.h"
 
 int main(int argc, char** argv) {
        glutInit(&argc, argv);
index cb3709fb18fba75bf1f0db99fd5e524e4a4f840a..2a1d13a8ff7ae999bef464db4afb28ed877e268a 100644 (file)
@@ -1,6 +1,6 @@
-#include <time.h>
-#include <stdio.h> // TODO remove
 #include <stdbool.h>
+#include <stdio.h> // TODO remove
+#include <time.h>
 
 typedef struct timespec Timepoint;
 
index b4ded6bcac416065590302d155542ae577e490ca..70724d120037745cf3960e296b87550ed647c7c8 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PERFORMANCE_H_
 #define PERFORMANCE_H_
 
-void initPerformanceMetering();
-void frameRendered();
+void initPerformanceMetering(void);
+void frameRendered(void);
 
 #endif
index 63578dffac98cf652021373e5f18d8d0aa498927..18f0827f128630217c712b0f1e928e80d59fe2d4 100644 (file)
--- a/render.c
+++ b/render.c
@@ -1,12 +1,30 @@
 #include <GL/glut.h>
 
 #include "level.h"
-#include "typedefs.h"
 #include "performance.h"
 #include "render.h"
+#include "typedefs.h"
 
 const float AXIS_RADIUS = 5.0f;
 
+void initRender() {
+       glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+       
+       GLfloat light0_ambient[] = {0.1f, 0.1f, 0.1f, 1.0f};
+       GLfloat light0_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
+       GLfloat light0_specular[] = {1.0f, 1.0f, 1.0f, 1.0f};
+       GLfloat light0_position[] = {5.0f, 10.0f, 10.0f, 1.0f};
+       
+       glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
+       glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
+       glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
+       glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
+       
+       glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0f);
+       glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05f);
+       glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.001f);
+}
+
 void renderScene() {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glLoadIdentity();
index c65e4912dc8be5d8ce91fedbb2fba741af307a1b..a0be88fb5fb58c35604ef7cebc6e93089344d366 100644 (file)
--- a/render.h
+++ b/render.h
@@ -3,8 +3,9 @@
 
 #include "assimp_types.h"
 
-void renderScene();
-void drawAxes();
+void initRender(void);
+void renderScene(void);
+void drawAxes(void);
 void drawSceneRecursive(const AiScene* scene, const AiNode* node);
 
 #endif
diff --git a/tga.c b/tga.c
index 7ca9ef602b0aaa84388ebefe512b943a0eed2f0f..7e13d905e9dc9d33247ee193ccadfc7b68b86d20 100644 (file)
--- a/tga.c
+++ b/tga.c
@@ -1,5 +1,5 @@
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "tga.h"
 
diff --git a/ui.c b/ui.c
new file mode 100644 (file)
index 0000000..5010a81
--- /dev/null
+++ b/ui.c
@@ -0,0 +1,22 @@
+#include <GL/gl.h>
+
+void resizeStage(GLsizei width, GLsizei height) {
+       if (height == 0)
+               height = 1;
+       
+       // Set device viewport dimensions
+       glViewport(0, 0, width, height);
+       // Switch to projection matrix
+       glMatrixMode(GL_PROJECTION);
+       // Reset the projection matrix
+       glLoadIdentity();
+       
+       GLfloat aspectRatio = (GLfloat) width / (GLfloat) height;
+       
+       glOrtho(-8.0, 8.0, -8.0/aspectRatio, 8.0/aspectRatio, 128.0, -128.0);
+       
+       glRotatef(45.0f, 1.0f, 0.0f, 0.0f);
+       glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
+       
+       glMatrixMode(GL_MODELVIEW);
+}
diff --git a/ui.h b/ui.h
new file mode 100644 (file)
index 0000000..5d3117a
--- /dev/null
+++ b/ui.h
@@ -0,0 +1,8 @@
+#ifndef GLUT_JANITOR_H_
+#define GLUT_JANITOR_H_
+
+#include <GL/gl.h>
+
+void resizeStage(GLsizei width, GLsizei height);
+
+#endif