Browse Source

Moved math, Matrix, Quaternion, Vector3d into lib

Thomas Buck 11 years ago
parent
commit
e02c32dc3c

include/utils/Matrix.h → include/math/Matrix.h View File

1
 /*!
1
 /*!
2
- * \file include/utils/Matrix.h
2
+ * \file include/math/Matrix.h
3
  * \brief 3D Matrix
3
  * \brief 3D Matrix
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
6
  */
6
  */
7
 
7
 
8
-#ifndef _UTILS_MATRIX_H_
9
-#define _UTILS_MATRIX_H_
8
+#ifndef _MATH_MATRIX_H_
9
+#define _MATH_MATRIX_H_
10
 
10
 
11
-#include "utils/math.h"
12
-#include "utils/Quaternion.h"
13
-#include "utils/Vector3d.h"
11
+#include "math/math.h"
12
+#include "math/Quaternion.h"
13
+#include "math/Vector3d.h"
14
 
14
 
15
 
15
 
16
 /*!
16
 /*!

include/utils/Quaternion.h → include/math/Quaternion.h View File

1
 /*!
1
 /*!
2
- * \file include/utils/Quaternion.h
2
+ * \file include/math/Quaternion.h
3
  * \brief Quaternion
3
  * \brief Quaternion
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
6
  */
6
  */
7
 
7
 
8
-#ifndef _UTILS_QUATERNION_H_
9
-#define _UTILS_QUATERNION_H_
8
+#ifndef _MATH_QUATERNION_H_
9
+#define _MATH_QUATERNION_H_
10
 
10
 
11
-#include "utils/math.h"
11
+#include "math/math.h"
12
 
12
 
13
 /*!
13
 /*!
14
  * \brief Quaternion
14
  * \brief Quaternion

include/utils/Vector3d.h → include/math/Vector3d.h View File

1
 /*!
1
 /*!
2
- * \file include/utils/Vector3d.h
2
+ * \file include/math/Vector3d.h
3
  * \brief 3D Math vector
3
  * \brief 3D Math vector
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
6
  */
6
  */
7
 
7
 
8
-#ifndef _UTILS_VECTOR3D_H_
9
-#define _UTILS_VECTOR3D_H_
8
+#ifndef _MATH_VECTOR3D_H_
9
+#define _MATH_VECTOR3D_H_
10
 
10
 
11
-#include "utils/math.h"
11
+#include "math/math.h"
12
 
12
 
13
 /*!
13
 /*!
14
  * \brief 3D Math Vector
14
  * \brief 3D Math Vector

include/utils/math.h → include/math/math.h View File

1
 /*!
1
 /*!
2
  *
2
  *
3
- * \file include/utils/math.h
3
+ * \file include/math/math.h
4
  * \brief Vector and Matrix math
4
  * \brief Vector and Matrix math
5
  *
5
  *
6
  * \author Mongoose
6
  * \author Mongoose
8
 
8
 
9
 #include <math.h>
9
 #include <math.h>
10
 
10
 
11
-#ifndef _UTILS_MATH_H
12
-#define _UTILS_MATH_H
11
+#ifndef _MATH_MATH_H
12
+#define _MATH_MATH_H
13
 
13
 
14
 #define HEL_PI           ((float)M_PI) //!< pi
14
 #define HEL_PI           ((float)M_PI) //!< pi
15
 #define HEL_2_PI         (HEL_PI * 2.0f) //!< pi*2
15
 #define HEL_2_PI         (HEL_PI * 2.0f) //!< pi*2

+ 5
- 3
src/CMakeLists.txt View File

65
 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
65
 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
66
 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
66
 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
67
 
67
 
68
-# Add utils directory
69
-add_subdirectory (utils)
68
+# Add subdirectories
69
+add_subdirectory ("math")
70
+add_subdirectory ("utils")
70
 
71
 
71
 # Add Executable
72
 # Add Executable
72
 add_executable (OpenRaider MACOSX_BUNDLE ${SRCS})
73
 add_executable (OpenRaider MACOSX_BUNDLE ${SRCS})
148
 set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
149
 set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
149
 
150
 
150
 # Add utils Library
151
 # Add utils Library
151
-set (LIBS ${LIBS} utilities)
152
+set (LIBS ${LIBS} OpenRaider_math)
153
+set (LIBS ${LIBS} OpenRaider_utils)
152
 
154
 
153
 # Link to all found libs
155
 # Link to all found libs
154
 target_link_libraries (OpenRaider ${LIBS})
156
 target_link_libraries (OpenRaider ${LIBS})

+ 1
- 1
src/Sound.cpp View File

24
 #include <unistd.h>
24
 #include <unistd.h>
25
 #include <assert.h>
25
 #include <assert.h>
26
 
26
 
27
-#include "utils/math.h"
27
+#include "math/math.h"
28
 #include "Sound.h"
28
 #include "Sound.h"
29
 
29
 
30
 Sound::Sound() {
30
 Sound::Sound() {

+ 11
- 0
src/math/CMakeLists.txt View File

1
+# Source files
2
+set (MATH_SRCS ${MATH_SRCS} "math.cpp")
3
+set (MATH_SRCS ${MATH_SRCS} "Matrix.cpp")
4
+set (MATH_SRCS ${MATH_SRCS} "Quaternion.cpp")
5
+set (MATH_SRCS ${MATH_SRCS} "Vector3d.cpp")
6
+
7
+# Include directory
8
+include_directories ("${PROJECT_SOURCE_DIR}/include")
9
+
10
+# Add library
11
+add_library (OpenRaider_math ${MATH_SRCS})

src/utils/Matrix.cpp → src/math/Matrix.cpp View File

1
 /*!
1
 /*!
2
- * \file src/utils/Matrix.cpp
2
+ * \file src/math/Matrix.cpp
3
  * \brief 3D Matrix
3
  * \brief 3D Matrix
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
8
 #include <stdio.h>
8
 #include <stdio.h>
9
 #include <math.h>
9
 #include <math.h>
10
 
10
 
11
-#include "utils/Matrix.h"
11
+#include "math/Matrix.h"
12
 
12
 
13
 Matrix::Matrix() {
13
 Matrix::Matrix() {
14
     setIdentity();
14
     setIdentity();

src/utils/Quaternion.cpp → src/math/Quaternion.cpp View File

1
 /*!
1
 /*!
2
- * \file src/utils/Quaternion.cpp
2
+ * \file src/math/Quaternion.cpp
3
  * \brief Quaternion
3
  * \brief Quaternion
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
7
 
7
 
8
 #include <math.h>
8
 #include <math.h>
9
 
9
 
10
-#include "utils/Quaternion.h"
10
+#include "math/Quaternion.h"
11
 
11
 
12
 Quaternion::Quaternion() {
12
 Quaternion::Quaternion() {
13
     mW = 0;
13
     mW = 0;

src/utils/Vector3d.cpp → src/math/Vector3d.cpp View File

1
 /*!
1
 /*!
2
- * \file src/utils/Vector3d.cpp
2
+ * \file src/math/Vector3d.cpp
3
  * \brief 3D Math vector
3
  * \brief 3D Math vector
4
  *
4
  *
5
  * \author Mongoose
5
  * \author Mongoose
7
 
7
 
8
 #include <math.h>
8
 #include <math.h>
9
 
9
 
10
-#include "utils/Vector3d.h"
10
+#include "math/Vector3d.h"
11
 
11
 
12
 Vector3d::Vector3d() {
12
 Vector3d::Vector3d() {
13
     mVec[0] = mVec[1] = mVec[2] = 0.0f;
13
     mVec[0] = mVec[1] = mVec[2] = 0.0f;

src/utils/math.cpp → src/math/math.cpp View File

1
 /*!
1
 /*!
2
  *
2
  *
3
- * \file src/utils/math.cpp
3
+ * \file src/math/math.cpp
4
  * \brief Vector and Matrix math
4
  * \brief Vector and Matrix math
5
  *
5
  *
6
  * \author Mongoose
6
  * \author Mongoose
11
 #include <float.h>
11
 #include <float.h>
12
 #include <assert.h>
12
 #include <assert.h>
13
 
13
 
14
-#include "utils/Vector3d.h"
15
-#include "utils/Matrix.h"
16
-#include "utils/math.h"
14
+#include "math/Vector3d.h"
15
+#include "math/Matrix.h"
16
+#include "math/math.h"
17
 
17
 
18
 bool equalEpsilon(vec_t a, vec_t b) {
18
 bool equalEpsilon(vec_t a, vec_t b) {
19
     vec_t epsilon = FLT_EPSILON;
19
     vec_t epsilon = FLT_EPSILON;

+ 1
- 5
src/utils/CMakeLists.txt View File

1
 # Source files
1
 # Source files
2
-set (UTIL_SRCS ${UTIL_SRCS} "math.cpp")
3
-set (UTIL_SRCS ${UTIL_SRCS} "Matrix.cpp")
4
-set (UTIL_SRCS ${UTIL_SRCS} "Quaternion.cpp")
5
 set (UTIL_SRCS ${UTIL_SRCS} "strings.cpp")
2
 set (UTIL_SRCS ${UTIL_SRCS} "strings.cpp")
6
 set (UTIL_SRCS ${UTIL_SRCS} "tga.cpp")
3
 set (UTIL_SRCS ${UTIL_SRCS} "tga.cpp")
7
 set (UTIL_SRCS ${UTIL_SRCS} "time.cpp")
4
 set (UTIL_SRCS ${UTIL_SRCS} "time.cpp")
8
-set (UTIL_SRCS ${UTIL_SRCS} "Vector3d.cpp")
9
 
5
 
10
 # Include directory
6
 # Include directory
11
 include_directories ("${PROJECT_SOURCE_DIR}/include")
7
 include_directories ("${PROJECT_SOURCE_DIR}/include")
12
 
8
 
13
 # Add library
9
 # Add library
14
-add_library (utilities ${UTIL_SRCS})
10
+add_library (OpenRaider_utils ${UTIL_SRCS})

Loading…
Cancel
Save