소스 검색

MatMath only one way of rad deg conversion

Thomas Buck 11 년 전
부모
커밋
780646bad7
5개의 변경된 파일11개의 추가작업 그리고 53개의 파일을 삭제
  1. 4
    0
      ChangeLog
  2. 0
    22
      include/MatMath.h
  3. 5
    5
      src/Camera.cpp
  4. 0
    24
      src/MatMath.cpp
  5. 2
    2
      src/OpenRaider.cpp

+ 4
- 0
ChangeLog 파일 보기

@@ -5,6 +5,10 @@
5 5
 
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8
+	[ 20140111 ]
9
+	* Only one way of conversion between Deg and Rad in MatMath
10
+	* Use the same style of include guards in all headers
11
+
8 12
 	[ 20140110 ]
9 13
 	* Removed endian.(h/cpp) as it shouldn't be needed. See:
10 14
 	  http://commandcenter.blogspot.de/2012/04/byte-order-fallacy.html

+ 0
- 22
include/MatMath.h 파일 보기

@@ -104,28 +104,6 @@ void helMidpoint3v(vec3_t a, vec3_t b, vec3_t mid);
104 104
  ------------------------------------------------------*/
105 105
 
106 106
 
107
-vec_t helDegToRad(vec_t degrees);
108
-/*------------------------------------------------------
109
- * Pre  : Given angle in degrees
110
- * Post : Returns angle in radians
111
- *
112
- *-- History ------------------------------------------
113
- *
114
- * 1999.06.14:
115
- * Mongoose - Created, from mtk3d
116
- ------------------------------------------------------*/
117
-
118
-vec_t helRadToDeg(vec_t rad);
119
-/*------------------------------------------------------
120
- * Pre  : Given angle in radians
121
- * Post : Returns angle in degrees
122
- *
123
- *-- History ------------------------------------------
124
- *
125
- * 1999.06.14:
126
- * Mongoose - Created, from mtk3d
127
- ------------------------------------------------------*/
128
-
129 107
 vec_t helRandomNum(vec_t from, vec_t to);
130 108
 
131 109
 #endif

+ 5
- 5
src/Camera.cpp 파일 보기

@@ -55,8 +55,8 @@ Camera::Camera()
55 55
 	mFlags = 0;
56 56
 	mViewDistance = 14.0;
57 57
 	mTranslateDelta = 256.0;
58
-	mRotateDelta = helDegToRad(15.0);
59
- 	mRotateDelta2 = helDegToRad(5.0);
58
+	mRotateDelta = HEL_DEG_TO_RAD(15.0);
59
+ 	mRotateDelta2 = HEL_DEG_TO_RAD(5.0);
60 60
 	mFlags &= Camera_FlyMode;
61 61
 	reset();
62 62
 }
@@ -103,7 +103,7 @@ void Camera::getTarget(vec3_t target)
103 103
 
104 104
 float Camera::getYaw()
105 105
 {
106
-	return helRadToDeg(mTheta);
106
+	return HEL_RAD_TO_DEG(mTheta);
107 107
 }
108 108
 
109 109
 
@@ -231,13 +231,13 @@ void Camera::reset()
231 231
 
232 232
 void Camera::setSensitivityY(float angle)
233 233
 {
234
-	mRotateDelta2 = helDegToRad(angle);
234
+	mRotateDelta2 = HEL_DEG_TO_RAD(angle);
235 235
 }
236 236
 
237 237
 
238 238
 void Camera::setSensitivityX(float angle)
239 239
 {
240
-	mRotateDelta = helDegToRad(angle);
240
+	mRotateDelta = HEL_DEG_TO_RAD(angle);
241 241
 }
242 242
 
243 243
 

+ 0
- 24
src/MatMath.cpp 파일 보기

@@ -7,8 +7,6 @@
7 7
 #include <Vector3d.h>
8 8
 #include <Matrix.h>
9 9
 
10
-#define COMPUTE
11
-
12 10
 bool tmpHelSphereIntersectLine(Vector3d pos, Vector3d lastPos,
13 11
 										 Vector3d center, vec_t radius)
14 12
 {
@@ -290,25 +288,3 @@ vec_t helRandomNum(vec_t from, vec_t to)
290 288
 	return from + (to*rand()/(RAND_MAX+1.0));
291 289
 }
292 290
 
293
-
294
-vec_t helDegToRad(vec_t degrees)
295
-{
296
-#ifdef COMPUTE
297
-	return ((degrees / 180.0) * HEL_PI);
298
-#else
299
-	// degrees * (180.0 / PI);
300
-	return (degrees * HEL_180_OVER_PI);
301
-#endif
302
-}
303
-
304
-
305
-vec_t helRadToDeg(vec_t rad)
306
-{
307
-#ifdef COMPUTE
308
-	return ((rad / HEL_PI) * 180.0);
309
-#else
310
-	// rad * (PI / 180.0);
311
-	return (rad * HEL_PI_OVER_180);
312
-#endif
313
-}
314
-

+ 2
- 2
src/OpenRaider.cpp 파일 보기

@@ -3296,8 +3296,8 @@ void OpenRaider::consoleCommand(char *cmd)
3296 3296
 				print(true, "Room %2i  Pos %.0f %.0f %.0f  Yaw %.0f  Pitch %.0f",
3297 3297
 						LARA->room,
3298 3298
 						LARA->pos[0], LARA->pos[1], LARA->pos[2],
3299
-						helRadToDeg(LARA->angles[1]),
3300
-						helRadToDeg(LARA->angles[2]));
3299
+						HEL_RAD_TO_DEG(LARA->angles[1]),
3300
+						HEL_RAD_TO_DEG(LARA->angles[2]));
3301 3301
 			}
3302 3302
 		}
3303 3303
 		else if (rc_command("room", cmd))

Loading…
취소
저장