2 Commits d67a5b7152 ... 528dd1f1f0

Author SHA1 Message Date
  Niels Nesse 528dd1f1f0 Add mat4 lerp 9 years ago
  Niels Nesse b2641443c8 Fix Linux build 9 years ago
3 changed files with 13 additions and 2 deletions
  1. 1 2
      Makefile.am
  2. 10 0
      src/math/math3d.c
  3. 2 0
      src/math/math3d.h

+ 1 - 2
Makefile.am

@@ -12,8 +12,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/text
 lib_LTLIBRARIES = libglplatform.la
 libglplatform_la_LIBADD=$(FREETYPE2_LIBS)
 libglplatform_la_CFLAGS=-std=c99 $(FREETYPE2_CFLAGS)
-libglplatform_la_SOURCES = src/glbindings/glplatform-glcore.c \
-			   src/glbindings/glplatform-wgl.c
+libglplatform_la_SOURCES = src/glbindings/glplatform-glcore.c
 
 if WINDOWS
 libglplatform_la_SOURCES += src/glplatform-win32.c \

+ 10 - 0
src/math/math3d.c

@@ -77,6 +77,16 @@ void math3d_vec3_cross(struct math3d_vec3 *a, struct math3d_vec3 *b, struct math
 	c->v[2] = a->v[0] * b->v[1] - a->v[1] * b->v[0];
 }
 
+void math3d_mat4_lerp(const struct math3d_mat4 *a, const struct math3d_mat4 *b, float d, struct math3d_mat4 *c)
+{
+	int i,j;
+	for (i = 0; i < 4; i++) {
+		for (j = 0; j < 4; j++) {
+			c->v[i][j] = a->v[i][j] * (1-d) + b->v[i][j] * d;
+		}
+	}
+}
+
 void math3d_vec3_lerp(const struct math3d_vec3 *v1, const struct math3d_vec3 *v2, float d, struct math3d_vec3 *v3)
 {
 	int i;

+ 2 - 0
src/math/math3d.h

@@ -116,6 +116,8 @@ void math3d_vec3_lerp(const struct math3d_vec3 *v1, const struct math3d_vec3 *v2
 //
 void math3d_vec3_normalize(struct math3d_vec3 *v);
 
+void math3d_mat4_lerp(const struct math3d_mat4 *a, const struct math3d_mat4 *b, float d, struct math3d_mat4 *c);
+
 //
 // math3d_spherical_lerp(v1, v2, d, v3)
 //