Permalink
Browse files

Massive file reorganization to make it easier to drop kazmath into a …

…project
  • Loading branch information...
1 parent 59e3af9 commit e25d39df2f289a3d06fc3e2318cf61bdedf23b71 @Kazade committed Feb 26, 2012
Showing with 107 additions and 1,973 deletions.
  1. +4 −0 .gitignore
  2. +26 −26 CMakeLists.txt
  3. +0 −51 include/kazmath/GL/mat4stack.h
  4. +0 −68 include/kazmath/vec4.h
  5. +0 −2 {src → kazmath}/CMakeLists.txt
  6. +1 −1 {src → kazmath}/GL/mat4stack.c
  7. 0 {src/kazmath-0.1-win32-bin/include → kazmath}/GL/mat4stack.h
  8. +2 −2 {src → kazmath}/GL/matrix.c
  9. 0 {include → }/kazmath/GL/matrix.h
  10. +1 −1 {src → kazmath}/aabb.c
  11. 0 {include → }/kazmath/aabb.h
  12. 0 {include → }/kazmath/kazmath.h
  13. +6 −6 {src → kazmath}/mat3.c
  14. 0 {include → }/kazmath/mat3.h
  15. +25 −25 {src → kazmath}/mat4.c
  16. 0 {include → }/kazmath/mat4.h
  17. +3 −3 {src → kazmath}/plane.c
  18. 0 {include → }/kazmath/plane.h
  19. +4 −4 {src → kazmath}/quaternion.c
  20. 0 {include → }/kazmath/quaternion.h
  21. +1 −1 {src → kazmath}/ray2.c
  22. 0 {include → }/kazmath/ray2.h
  23. +1 −1 {src → kazmath}/utility.c
  24. 0 {include → }/kazmath/utility.h
  25. +3 −3 {src → kazmath}/vec2.c
  26. 0 {include → }/kazmath/vec2.h
  27. +7 −7 {src → kazmath}/vec3.c
  28. 0 {include → }/kazmath/vec3.h
  29. +3 −3 {src → kazmath}/vec4.c
  30. 0 {src/kazmath-0.1-win32-bin/include → kazmath}/vec4.h
  31. +0 −738 src/ChangeLog
  32. +0 −293 src/Doxyfile
  33. +0 −33 src/kazmath-0.1-win32-bin/README
  34. +0 −55 src/kazmath-0.1-win32-bin/include/GL/matrix.h
  35. +0 −47 src/kazmath-0.1-win32-bin/include/aabb.h
  36. +0 −38 src/kazmath-0.1-win32-bin/include/kazmath.h
  37. +0 −66 src/kazmath-0.1-win32-bin/include/mat3.h
  38. +0 −82 src/kazmath-0.1-win32-bin/include/mat4.h
  39. +0 −61 src/kazmath-0.1-win32-bin/include/plane.h
  40. +0 −142 src/kazmath-0.1-win32-bin/include/quaternion.h
  41. +0 −62 src/kazmath-0.1-win32-bin/include/utility.h
  42. +0 −64 src/kazmath-0.1-win32-bin/include/vec2.h
  43. +0 −68 src/kazmath-0.1-win32-bin/include/vec3.h
  44. BIN src/kazmath-0.1-win32-bin/lib/kazmath.lib
  45. +1 −1 tests/test_aabb.cpp
  46. +14 −14 tests/test_mat3.cpp
  47. +1 −1 tests/test_mat4.cpp
  48. +1 −1 tests/test_ray2.cpp
  49. +3 −3 tests/test_vec2.cpp
View
@@ -0,0 +1,4 @@
+*~
+*.orig
+*.o
+build
View
@@ -7,38 +7,38 @@ ENABLE_TESTING()
SET(CMAKE_C_FLAGS "-std=c99")
SET(KAZMATH_HEADERS
- ${CMAKE_SOURCE_DIR}/include/kazmath/vec2.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/vec3.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/vec4.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/mat4.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/mat3.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/ray2.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/plane.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/utility.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/quaternion.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/aabb.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/kazmath.h
+ ${CMAKE_SOURCE_DIR}/kazmath/vec2.h
+ ${CMAKE_SOURCE_DIR}/kazmath/vec3.h
+ ${CMAKE_SOURCE_DIR}/kazmath/vec4.h
+ ${CMAKE_SOURCE_DIR}/kazmath/mat4.h
+ ${CMAKE_SOURCE_DIR}/kazmath/mat3.h
+ ${CMAKE_SOURCE_DIR}/kazmath/ray2.h
+ ${CMAKE_SOURCE_DIR}/kazmath/plane.h
+ ${CMAKE_SOURCE_DIR}/kazmath/utility.h
+ ${CMAKE_SOURCE_DIR}/kazmath/quaternion.h
+ ${CMAKE_SOURCE_DIR}/kazmath/aabb.h
+ ${CMAKE_SOURCE_DIR}/kazmath/kazmath.h
)
SET(GL_UTILS_HEADERS
- ${CMAKE_SOURCE_DIR}/include/kazmath/GL/mat4stack.h
- ${CMAKE_SOURCE_DIR}/include/kazmath/GL/matrix.h
+ ${CMAKE_SOURCE_DIR}/kazmath/GL/mat4stack.h
+ ${CMAKE_SOURCE_DIR}/kazmath/GL/matrix.h
)
SET(KAZMATH_SOURCES
- ${CMAKE_SOURCE_DIR}/src/mat4.c
- ${CMAKE_SOURCE_DIR}/src/mat3.c
- ${CMAKE_SOURCE_DIR}/src/plane.c
- ${CMAKE_SOURCE_DIR}/src/vec4.c
- ${CMAKE_SOURCE_DIR}/src/quaternion.c
- ${CMAKE_SOURCE_DIR}/src/vec2.c
- ${CMAKE_SOURCE_DIR}/src/vec3.c
- ${CMAKE_SOURCE_DIR}/src/utility.c
- ${CMAKE_SOURCE_DIR}/src/aabb.c
- ${CMAKE_SOURCE_DIR}/src/ray2.c
- ${CMAKE_SOURCE_DIR}/src/GL/mat4stack.c
- ${CMAKE_SOURCE_DIR}/src/GL/matrix.c
+ ${CMAKE_SOURCE_DIR}/kazmath/mat4.c
+ ${CMAKE_SOURCE_DIR}/kazmath/mat3.c
+ ${CMAKE_SOURCE_DIR}/kazmath/plane.c
+ ${CMAKE_SOURCE_DIR}/kazmath/vec4.c
+ ${CMAKE_SOURCE_DIR}/kazmath/quaternion.c
+ ${CMAKE_SOURCE_DIR}/kazmath/vec2.c
+ ${CMAKE_SOURCE_DIR}/kazmath/vec3.c
+ ${CMAKE_SOURCE_DIR}/kazmath/utility.c
+ ${CMAKE_SOURCE_DIR}/kazmath/aabb.c
+ ${CMAKE_SOURCE_DIR}/kazmath/ray2.c
+ ${CMAKE_SOURCE_DIR}/kazmath/GL/mat4stack.c
+ ${CMAKE_SOURCE_DIR}/kazmath/GL/matrix.c
)
-ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(kazmath)
ADD_SUBDIRECTORY(tests)
@@ -1,51 +0,0 @@
-/*
-Copyright (c) 2008, Luke Benstead.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef C_STACK_H_INCLUDED
-#define C_STACK_H_INCLUDED
-
-#include "../mat4.h"
-
-typedef struct km_mat4_stack {
- int capacity; //The total item capacity
- int item_count; //The number of items
- kmMat4* top;
- kmMat4* stack;
-} km_mat4_stack;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void km_mat4_stack_initialize(km_mat4_stack* stack);
-void km_mat4_stack_push(km_mat4_stack* stack, const kmMat4* item);
-void km_mat4_stack_pop(km_mat4_stack* stack, kmMat4* pOut);
-void km_mat4_stack_release(km_mat4_stack* stack);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // C_STACK_H_INCLUDED
@@ -1,68 +0,0 @@
-/*
-Copyright (c) 2008, Luke Benstead.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef VEC4_H_INCLUDED
-#define VEC4_H_INCLUDED
-
-#include "utility.h"
-
-struct kmMat4;
-
-#pragma pack(push) /* push current alignment to stack */
-#pragma pack(1) /* set alignment to 1 byte boundary */
-
-typedef struct kmVec4 {
- kmScalar x;
- kmScalar y;
- kmScalar z;
- kmScalar w;
-} kmVec4;
-
-#pragma pack(pop)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-kmVec4* kmVec4Fill(kmVec4* pOut, kmScalar x, kmScalar y, kmScalar z, kmScalar w);
-kmVec4* kmVec4Add(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
-kmScalar kmVec4Dot(const kmVec4* pV1, const kmVec4* pV2);
-kmScalar kmVec4Length(const kmVec4* pIn);
-kmScalar kmVec4LengthSq(const kmVec4* pIn);
-kmVec4* kmVec4Lerp(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2, kmScalar t);
-kmVec4* kmVec4Normalize(kmVec4* pOut, const kmVec4* pIn);
-kmVec4* kmVec4Scale(kmVec4* pOut, const kmVec4* pIn, const kmScalar s); ///< Scales a vector to length s
-kmVec4* kmVec4Subtract(kmVec4* pOut, const kmVec4* pV1, const kmVec4* pV2);
-kmVec4* kmVec4Transform(kmVec4* pOut, const kmVec4* pV, const struct kmMat4* pM);
-kmVec4* kmVec4TransformArray(kmVec4* pOut, unsigned int outStride,
- const kmVec4* pV, unsigned int vStride, const struct kmMat4* pM, unsigned int count);
-int kmVec4AreEqual(const kmVec4* p1, const kmVec4* p2);
-kmVec4* kmVec4Assign(kmVec4* pOut, const kmVec4* pIn);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // VEC4_H_INCLUDED
@@ -2,8 +2,6 @@
#ADD_LIBRARY(Kazmath STATIC ${KAZMATH_SRCS})
#INSTALL(TARGETS Kazmath ARCHIVE DESTINATION lib)
-INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include )
-
ADD_LIBRARY(kazmath STATIC ${KAZMATH_SOURCES})
INSTALL(TARGETS kazmath ARCHIVE DESTINATION lib)
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INITIAL_SIZE 30
#define INCREMENT 50
-#include "kazmath/GL/mat4stack.h"
+#include "mat4stack.h"
void km_mat4_stack_initialize(km_mat4_stack* stack) {
stack->stack = (kmMat4*) malloc(sizeof(kmMat4) * INITIAL_SIZE); //allocate the memory
@@ -26,8 +26,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <assert.h>
-#include "kazmath/GL/matrix.h"
-#include "kazmath/GL/mat4stack.h"
+#include "matrix.h"
+#include "mat4stack.h"
km_mat4_stack modelview_matrix_stack;
km_mat4_stack projection_matrix_stack;
File renamed without changes.
@@ -23,7 +23,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "kazmath/aabb.h"
+#include "aabb.h"
/**
* Returns KM_TRUE if point is in the specified AABB, returns
File renamed without changes.
File renamed without changes.
@@ -27,10 +27,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory.h>
#include <assert.h>
-#include "kazmath/utility.h"
-#include "kazmath/vec3.h"
-#include "kazmath/mat3.h"
-#include "kazmath/quaternion.h"
+#include "utility.h"
+#include "vec3.h"
+#include "mat3.h"
+#include "quaternion.h"
kmMat3* const kmMat3Fill(kmMat3* pOut, const kmScalar* pMat)
{
@@ -233,8 +233,8 @@ kmMat3* const kmMat3Translation(kmMat3* pOut, const kmScalar x, const kmScalar y
return pOut;
}
-
-
+
+
kmMat3* const kmMat3RotationQuaternion(kmMat3* pOut, const kmQuaternion* pIn)
{
if (!pIn || !pOut) {
File renamed without changes.
@@ -30,12 +30,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <stdlib.h>
-#include "kazmath/utility.h"
-#include "kazmath/vec3.h"
-#include "kazmath/mat4.h"
-#include "kazmath/mat3.h"
-#include "kazmath/quaternion.h"
-#include "kazmath/plane.h"
+#include "utility.h"
+#include "vec3.h"
+#include "mat4.h"
+#include "mat3.h"
+#include "quaternion.h"
+#include "plane.h"
/**
* Fills a kmMat4 structure with the values from a 16
@@ -664,27 +664,27 @@ kmMat4* const kmMat4LookAt(kmMat4* pOut, const kmVec3* pEye,
kmMat4Multiply(pOut, pOut, &translate);
return pOut;
-}
+}
/**
* Extract a 3x3 rotation matrix from the input 4x4 transformation.
* Stores the result in pOut, returns pOut
- */
-kmMat3* const kmMat4ExtractRotation(kmMat3* pOut, const kmMat4* pIn)
-{
- pOut->mat[0] = pIn->mat[0];
- pOut->mat[1] = pIn->mat[1];
- pOut->mat[2] = pIn->mat[2];
-
- pOut->mat[3] = pIn->mat[4];
- pOut->mat[4] = pIn->mat[5];
- pOut->mat[5] = pIn->mat[6];
-
- pOut->mat[6] = pIn->mat[8];
- pOut->mat[7] = pIn->mat[9];
- pOut->mat[8] = pIn->mat[10];
-
- return pOut;
+ */
+kmMat3* const kmMat4ExtractRotation(kmMat3* pOut, const kmMat4* pIn)
+{
+ pOut->mat[0] = pIn->mat[0];
+ pOut->mat[1] = pIn->mat[1];
+ pOut->mat[2] = pIn->mat[2];
+
+ pOut->mat[3] = pIn->mat[4];
+ pOut->mat[4] = pIn->mat[5];
+ pOut->mat[5] = pIn->mat[6];
+
+ pOut->mat[6] = pIn->mat[8];
+ pOut->mat[7] = pIn->mat[9];
+ pOut->mat[8] = pIn->mat[10];
+
+ return pOut;
}
/**
@@ -694,8 +694,8 @@ kmMat3* const kmMat4ExtractRotation(kmMat3* pOut, const kmMat4* pIn)
kmVec3* const kmMat4RotationToAxisAngle(kmVec3* pAxis, kmScalar* radians, const kmMat4* pIn)
{
/*Surely not this easy?*/
- kmQuaternion temp;
- kmMat3 rotation;
+ kmQuaternion temp;
+ kmMat3 rotation;
kmMat4ExtractRotation(&rotation, pIn);
kmQuaternionRotationMatrix(&temp, &rotation);
kmQuaternionToAxisAngle(&temp, pAxis, radians);
File renamed without changes.
@@ -26,9 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <stdlib.h>
-#include "kazmath/vec3.h"
-#include "kazmath/vec4.h"
-#include "kazmath/plane.h"
+#include "vec3.h"
+#include "vec4.h"
+#include "plane.h"
const kmScalar kmPlaneDot(const kmPlane* pP, const kmVec4* pV)
{
File renamed without changes.
@@ -27,10 +27,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <memory.h>
-#include "kazmath/utility.h"
-#include "kazmath/mat3.h"
-#include "kazmath/vec3.h"
-#include "kazmath/quaternion.h"
+#include "utility.h"
+#include "mat3.h"
+#include "vec3.h"
+#include "quaternion.h"
///< Returns pOut, sets pOut to the conjugate of pIn
kmQuaternion* const kmQuaternionConjugate(kmQuaternion* pOut, const kmQuaternion* pIn)
File renamed without changes.
@@ -1,6 +1,6 @@
#include <assert.h>
#include <stdio.h>
-#include "kazmath/ray2.h"
+#include "ray2.h"
void kmRay2Fill(kmRay2* ray, kmScalar px, kmScalar py, kmScalar vx, kmScalar vy) {
ray->start.x = px;
File renamed without changes.
@@ -23,7 +23,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "kazmath/utility.h"
+#include "utility.h"
/**
* Returns the square of s (e.g. s*s)
File renamed without changes.
@@ -26,9 +26,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include <stdlib.h>
-#include "kazmath/mat3.h"
-#include "kazmath/vec2.h"
-#include "kazmath/utility.h"
+#include "mat3.h"
+#include "vec2.h"
+#include "utility.h"
kmVec2* kmVec2Fill(kmVec2* pOut, kmScalar x, kmScalar y)
{
File renamed without changes.
Oops, something went wrong.

0 comments on commit e25d39d

Please sign in to comment.