Kaynağa Gözat

Introduce oglt_math.h file

rexim 4 yıl önce
ebeveyn
işleme
04d912342f
2 değiştirilmiş dosya ile 11 ekleme ve 4 silme
  1. 2 4
      main.c
  2. 9 0
      oglt_math.h

+ 2 - 4
main.c

@@ -7,6 +7,8 @@
 #include <errno.h>
 #include <errno.h>
 #include <math.h>
 #include <math.h>
 
 
+#include "oglt_math.h"
+
 #define GLEW_STATIC
 #define GLEW_STATIC
 #include <GL/glew.h>
 #include <GL/glew.h>
 
 
@@ -17,10 +19,6 @@
 #define SCREEN_HEIGHT 768
 #define SCREEN_HEIGHT 768
 #define MANUAL_TIME_STEP 0.1
 #define MANUAL_TIME_STEP 0.1
 
 
-float lerp(float a, float b, float t)
-{
-    return a + (b - a) * t;
-}
 
 
 char *slurp_file(const char *file_path)
 char *slurp_file(const char *file_path)
 {
 {

+ 9 - 0
oglt_math.h

@@ -0,0 +1,9 @@
+#ifndef OGLT_MATH_H_
+#define OGLT_MATH_H_
+
+static inline float lerp(float a, float b, float t)
+{
+    return a + (b - a) * t;
+}
+
+#endif // OGLT_MATH_H_