###############################################################################
+Project: "spaceball_static"=.\spaceball\spaceball_static.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Global:
Package=<5>
#include <GL/freeglut.h>\r
#include "vmath.h"\r
\r
+#ifndef M_PI\r
+#define M_PI 3.14159265358979323846264338327950\r
+#endif\r
+\r
void draw_cube(void);\r
\r
/* callbacks */\r
glMatrixMode(GL_MODELVIEW);\r
glLoadIdentity();\r
glTranslatef(pos.x, pos.y, pos.z);\r
+#if defined(WIN32)\r
+ /* This is STRICTLY a place-holder until we get this working properly for windows.\r
+ * I do not pretend that this is equivalent to the non-Windows equivalent. I just\r
+ * want the thing to build without errors.\r
+ */\r
+ glMultMatrixf((float*)xform);\r
+#else\r
glMultTransposeMatrixf((float*)xform);\r
+#endif\r
\r
draw_cube();\r
\r
void reshape(int x, int y)\r
{\r
float aspect = (float)x / (float)y;\r
- float halfy = tan(FOV / 2.0);\r
+ float halfy = (float)tan(FOV / 2.0);\r
float halfx = halfy * aspect;\r
\r
glViewport(0, 0, x, y);\r
\r
void sbmot(int x, int y, int z)\r
{\r
- pos.x += x * 0.001;\r
- pos.y += y * 0.001;\r
- pos.z -= z * 0.001;\r
+ pos.x += x * 0.001f;\r
+ pos.y += y * 0.001f;\r
+ pos.z -= z * 0.001f;\r
glutPostRedisplay();\r
}\r
\r
void sbrot(int x, int y, int z)\r
{\r
- float axis_len = sqrt(x * x + y * y + z * z);\r
- rot = quat_rotate(rot, axis_len * 0.001, -x / axis_len, -y / axis_len, z / axis_len);\r
+ float axis_len = (float)sqrt(x * x + y * y + z * z);\r
+ rot = quat_rotate(rot, axis_len * 0.001f, -x / axis_len, -y / axis_len, z / axis_len);\r
glutPostRedisplay();\r
}\r
\r
# PROP Intermediate_Dir "Release"\r
# PROP Target_Dir ""\r
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
# ADD RSC /l 0x409 /d "NDEBUG"\r
BSC32=bscmake.exe\r
# ADD BASE BSC32 /nologo\r
# ADD BSC32 /nologo\r
LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../Release"\r
\r
!ELSEIF "$(CFG)" == "spaceball - Win32 Debug"\r
\r
# PROP Use_Debug_Libraries 1\r
# PROP Output_Dir "Debug"\r
# PROP Intermediate_Dir "Debug"\r
+# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
# ADD RSC /l 0x409 /d "_DEBUG"\r
BSC32=bscmake.exe\r
# ADD BASE BSC32 /nologo\r
# ADD BSC32 /nologo\r
LINK32=link.exe\r
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../Debug"\r
\r
!ENDIF \r
\r
# Begin Group "Source Files"\r
\r
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=.\spaceball.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.c\r
+# End Source File\r
# End Group\r
# Begin Group "Header Files"\r
\r
# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.inl\r
+# End Source File\r
# End Group\r
# Begin Group "Resource Files"\r
\r
--- /dev/null
+# Microsoft Developer Studio Project File - Name="spaceball_static" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=spaceball_static - Win32 Debug\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "spaceball_static.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "spaceball_static.mak" CFG="spaceball_static - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "spaceball_static - Win32 Release" (based on "Win32 (x86) Console Application")\r
+!MESSAGE "spaceball_static - Win32 Debug" (based on "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF "$(CFG)" == "spaceball_static - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "spaceball_static___Win32_Release"\r
+# PROP BASE Intermediate_Dir "spaceball_static___Win32_Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "ReleaseStatic"\r
+# PROP Intermediate_Dir "ReleaseStatic"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "FREEGLUT_STATIC" /YX /FD /c\r
+# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
+# ADD RSC /l 0x409 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"../../../ReleaseStatic"\r
+\r
+!ELSEIF "$(CFG)" == "spaceball_static - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "spaceball_static___Win32_Debug"\r
+# PROP BASE Intermediate_Dir "spaceball_static___Win32_Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "DebugStatic"\r
+# PROP Intermediate_Dir "DebugStatic"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "FREEGLUT_STATIC" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
+# ADD RSC /l 0x409 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"../../../DebugStatic"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "spaceball_static - Win32 Release"\r
+# Name "spaceball_static - Win32 Debug"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=.\spaceball.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\vmath.inl\r
+# End Source File\r
+# End Group\r
+# Begin Group "Resource Files"\r
+\r
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"\r
+# End Group\r
+# End Target\r
+# End Project\r
quat_t quat_rotate(quat_t q, float angle, float x, float y, float z)\r
{\r
quat_t rq;\r
- float half_angle = angle * 0.5;\r
- float sin_half = sin(half_angle);\r
+ float half_angle = angle * 0.5f;\r
+ float sin_half = (float)sin(half_angle);\r
\r
- rq.w = cos(half_angle);\r
+ rq.w = (float)cos(half_angle);\r
rq.x = x * sin_half;\r
rq.y = y * sin_half;\r
rq.z = z * sin_half;\r
#ifndef VMATH_H_\r
#define VMATH_H_\r
\r
+#if defined(WIN32)\r
+#define INLINE\r
+#else\r
+#define INLINE inline\r
+#endif\r
+\r
+\r
typedef struct { float x, y, z; } vec3_t;\r
typedef struct { float x, y, z, w; } vec4_t;\r
\r
typedef float mat4_t[4][4];\r
\r
/* vector functions */\r
-static inline vec3_t v3_cons(float x, float y, float z);\r
-static inline float v3_dot(vec3_t v1, vec3_t v2);\r
+static INLINE vec3_t v3_cons(float x, float y, float z);\r
+static INLINE float v3_dot(vec3_t v1, vec3_t v2);\r
\r
/* quaternion functions */\r
-static inline quat_t quat_cons(float s, float x, float y, float z);\r
-static inline vec3_t quat_vec(quat_t q);\r
-static inline quat_t quat_mul(quat_t q1, quat_t q2);\r
-static inline void quat_to_mat(mat4_t res, quat_t q);\r
+static INLINE quat_t quat_cons(float s, float x, float y, float z);\r
+static INLINE vec3_t quat_vec(quat_t q);\r
+static INLINE quat_t quat_mul(quat_t q1, quat_t q2);\r
+static INLINE void quat_to_mat(mat4_t res, quat_t q);\r
quat_t quat_rotate(quat_t q, float angle, float x, float y, float z);\r
\r
/* matrix functions */\r
-static inline void m4_cons(mat4_t m,\r
+static INLINE void m4_cons(mat4_t m,\r
float m11, float m12, float m13, float m14,\r
float m21, float m22, float m23, float m24,\r
float m31, float m32, float m33, float m34,\r
/* vector functions */\r
-static inline vec3_t v3_cons(float x, float y, float z)\r
+static INLINE vec3_t v3_cons(float x, float y, float z)\r
{\r
vec3_t res;\r
res.x = x;\r
return res;\r
}\r
\r
-static inline vec3_t quat_vec(quat_t q)\r
+static INLINE vec3_t quat_vec(quat_t q)\r
{\r
vec3_t v;\r
v.x = q.x;\r
return v;\r
}\r
\r
-static inline float v3_dot(vec3_t v1, vec3_t v2)\r
+static INLINE float v3_dot(vec3_t v1, vec3_t v2)\r
{\r
return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z;\r
}\r
\r
/* quaternion functions */\r
-static inline quat_t quat_cons(float s, float x, float y, float z)\r
+static INLINE quat_t quat_cons(float s, float x, float y, float z)\r
{\r
quat_t q;\r
q.x = x;\r
return q;\r
}\r
\r
-static inline quat_t quat_mul(quat_t q1, quat_t q2)\r
+static INLINE quat_t quat_mul(quat_t q1, quat_t q2)\r
{\r
quat_t res;\r
vec3_t v1 = quat_vec(q1);\r
return res;\r
}\r
\r
-static inline void quat_to_mat(mat4_t res, quat_t q)\r
+static INLINE void quat_to_mat(mat4_t res, quat_t q)\r
{\r
- m4_cons(res, 1.0 - 2.0 * q.y*q.y - 2.0 * q.z*q.z, 2.0 * q.x * q.y + 2.0 * q.w * q.z, 2.0 * q.z * q.x - 2.0 * q.w * q.y, 0,\r
- 2.0 * q.x * q.y - 2.0 * q.w * q.z, 1.0 - 2.0 * q.x*q.x - 2.0 * q.z*q.z, 2.0 * q.y * q.z + 2.0 * q.w * q.x, 0,\r
- 2.0 * q.z * q.x + 2.0 * q.w * q.y, 2.0 * q.y * q.z - 2.0 * q.w * q.x, 1.0 - 2.0 * q.x*q.x - 2.0 * q.y*q.y, 0,\r
+ m4_cons(res, 1.0f - 2.0f * q.y*q.y - 2.0f * q.z*q.z, 2.0f * q.x * q.y + 2.0f * q.w * q.z, 2.0f * q.z * q.x - 2.0f * q.w * q.y, 0,\r
+ 2.0f * q.x * q.y - 2.0f * q.w * q.z, 1.0f - 2.0f * q.x*q.x - 2.0f * q.z*q.z, 2.0f * q.y * q.z + 2.0f * q.w * q.x, 0,\r
+ 2.0f * q.z * q.x + 2.0f * q.w * q.y, 2.0f * q.y * q.z - 2.0f * q.w * q.x, 1.0f - 2.0f * q.x*q.x - 2.0f * q.y*q.y, 0,\r
0, 0, 0, 1);\r
}\r
\r
/* matrix functions */\r
-static inline void m4_cons(mat4_t m,\r
+static INLINE void m4_cons(mat4_t m,\r
float m11, float m12, float m13, float m14,\r
float m21, float m22, float m23, float m24,\r
float m31, float m32, float m33, float m34,\r