summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2010-10-15 01:53:08 -0500
committerKamil Kaminski <kamilkss@gmail.com>2010-10-15 01:53:08 -0500
commit26d4028354a0cc953f2f37fc9b5129fbb042ff31 (patch)
tree85b6ad2f8ffc49f61205c018a88271a5bb8d77ce
parentbd79a6e0a38785f723f749608468b32e66e0f73b (diff)
downloadGLPyramid-26d4028354a0cc953f2f37fc9b5129fbb042ff31.tar.gz
GLPyramid-26d4028354a0cc953f2f37fc9b5129fbb042ff31.tar.bz2
GLPyramid-26d4028354a0cc953f2f37fc9b5129fbb042ff31.zip
math3d: misc
-rw-r--r--sdl/GL_todo.txt3
-rw-r--r--sdl/glframe.c2
-rw-r--r--sdl/math3d.c25
3 files changed, 15 insertions, 15 deletions
diff --git a/sdl/GL_todo.txt b/sdl/GL_todo.txt
index 2543f5e..fc7e49f 100644
--- a/sdl/GL_todo.txt
+++ b/sdl/GL_todo.txt
@@ -14,3 +14,6 @@ todo:
- draw inhabitants, that would accept a texture id
- fps counter in seperate file, could draw to SDL surface
+pyramid:
+- could do with 2 textures and practice generating and binding textures
+
diff --git a/sdl/glframe.c b/sdl/glframe.c
index a86a393..b8b45d9 100644
--- a/sdl/glframe.c
+++ b/sdl/glframe.c
@@ -2,7 +2,7 @@
*
* Camera
*
- * note: we could make these functions to be inlined, but they would need
+ * notes: we could make these functions to be inlined, but they would need
* to be moved into a header
*
*/
diff --git a/sdl/math3d.c b/sdl/math3d.c
index 10167a5..998641b 100644
--- a/sdl/math3d.c
+++ b/sdl/math3d.c
@@ -1,13 +1,9 @@
-/* revision 6 */
+/* revision 7 */
/* @2010 Kamil Kaminski
*
* math3d.c
*
- * this code is not yet endian aware, and it won't be, screw powerpc
- * the style of the syntax is original k&r except there's \n
- * after the opening { and extra space after if statement,
- * and for/while loops
*/
#include "math3d.h"
@@ -142,7 +138,7 @@ void m3dRotationMatrix44f(M3DMatrix44f m, float angle, float x, float y, float z
#undef M
}
-/* create a projection to "squish" an object into the plane.
+/* create a projection to "squish" an object into the plane.
* use m3dGetPlaneEquationf(planeEq, point1, point2, point3); to get a plane equation
*/
void m3dMakePlanarShadowMatrixf(M3DMatrix44f proj, const M3DVector4f planeEq,
@@ -181,13 +177,14 @@ void m3dMakePlanarShadowMatrixf(M3DMatrix44f proj, const M3DVector4f planeEq,
/* shadow matrix ready */
}
-#define A(row,col) a[(col<<2)+row]
-#define B(row,col) b[(col<<2)+row]
-#define P(row,col) product[(col<<2)+row]
-
+/* hmm not sure if defines could reside outside of a function as they did */
void m3dMatrixMultiply44f(M3DMatrix44f product, const M3DMatrix44f a,
const M3DMatrix44f b)
{
+ #define A(row,col) a[(col<<2)+row]
+ #define B(row,col) b[(col<<2)+row]
+ #define P(row,col) product[(col<<2)+row]
+
int i;
for (i = 0; i < 4; i++)
{
@@ -197,9 +194,9 @@ void m3dMatrixMultiply44f(M3DMatrix44f product, const M3DMatrix44f a,
P(i, 2) = ai0 * B(0, 2) + ai1 * B(1, 2) + ai2 * B(2, 2) + ai3 * B(3, 2);
P(i, 3) = ai0 * B(0, 3) + ai1 * B(1, 3) + ai2 * B(2, 3) + ai3 * B(3, 3);
}
+
+ #undef A
+ #undef B
+ #undef P
}
-#undef A
-#undef B
-#undef P
-