Skip to content

Commit ce9da76

Browse files
committed
removed useless stuff
1 parent 2488388 commit ce9da76

File tree

12 files changed

+13
-89
lines changed

12 files changed

+13
-89
lines changed

.gitmodules

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "extlibs/googletest"]
22
path = extlibs/googletest
3-
url = https://github.com/google/googletest.git
4-
[submodule "extlibs/glm"]
5-
path = extlibs/glm
6-
url = https://github.com/g-truc/glm.git
3+
url = https://github.com/google/googletest.git

extlibs/glm

-1
This file was deleted.

include/omath/engines/OpenGL/Constants.hpp

-14
This file was deleted.

include/omath/engines/OpenGL/Formulas.hpp

-4
This file was deleted.

include/omath/engines/OpenGL/OpenGL.hpp

-45
This file was deleted.

include/omath/engines/Source/Formulas.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#pragma once
55
#include "Constants.h"
66

7-
87
namespace omath::source
98
{
109
[[nodiscard]]

include/omath/engines/Unity/Unity.hpp

-12
This file was deleted.

include/omath/prediction/Target.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace omath::prediction
1313
public:
1414

1515
[[nodiscard]]
16-
constexpr Vector3 PredictPosition(float time, float gravity) const
16+
constexpr Vector3 PredictPosition(const float time, const float gravity) const
1717
{
1818
auto predicted = m_origin + m_velocity * time;
1919

source/prediction/Engine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace omath::prediction
5858
return std::nullopt;
5959

6060
root = std::sqrt(root);
61-
const float angle = std::atan((std::pow(projectile.m_launchSpeed, 2.f) - root) / (bulletGravity * distance2d));
61+
const float angle = std::atan((launchSpeedSqr - root) / (bulletGravity * distance2d));
6262

6363
return angles::RadiansToDegrees(angle);
6464
}

source/prediction/Projectile.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ namespace omath::prediction
1010
{
1111
Vector3 Projectile::PredictPosition(const float pitch, const float yaw, const float time, const float gravity) const
1212
{
13-
auto currentPos = m_origin + omath::source::ForwardVector({source::PitchAngle::FromDegrees(-pitch), source::YawAngle::FromDegrees(yaw), source::RollAngle::FromDegrees(0)}) * m_launchSpeed * time;
14-
currentPos.z -= (gravity * m_gravityScale) * std::pow(time, 2.f) * 0.5f;
13+
auto currentPos = m_origin + source::ForwardVector({source::PitchAngle::FromDegrees(-pitch),
14+
source::YawAngle::FromDegrees(yaw),
15+
source::RollAngle::FromDegrees(0)}) *
16+
m_launchSpeed * time;
17+
currentPos.z -= (gravity * m_gravityScale) * (time * time) * 0.5f;
1518

1619
return currentPos;
1720
}
18-
}
21+
} // namespace omath::prediction

tests/engines/UnitTestSourceEngine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
TEST(UnitTestSourceEngine, ForwardVector)
1111
{
12-
const auto forward = omath::source::ForwardVector({{}, {}, {}});
12+
const auto forward = omath::source::ForwardVector({});
1313

1414
EXPECT_EQ(forward, omath::source::kAbsForward);
1515
}

tests/general/UnitTestPrediction.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
TEST(UnitTestPrediction, PredictionTest)
55
{
6-
const omath::prediction::Target target{.m_origin = {100, 0, 90}, .m_velocity = {0, 0, 0}, .m_isAirborne = false};
7-
const omath::prediction::Projectile proj = {.m_origin = {3,2,1}, .m_launchSpeed = 5000, .m_gravityScale= 0.4};
6+
constexpr omath::prediction::Target target{
7+
.m_origin = {100, 0, 90}, .m_velocity = {0, 0, 0}, .m_isAirborne = false};
8+
constexpr omath::prediction::Projectile proj = {.m_origin = {3,2,1}, .m_launchSpeed = 5000, .m_gravityScale= 0.4};
89
const auto viewPoint = omath::prediction::Engine(400, 1.f / 1000.f, 50, 5.f).MaybeCalculateAimPoint(proj, target);
910

1011
const auto [pitch, yaw, _] = proj.m_origin.ViewAngleTo(viewPoint.value()).AsTuple();

0 commit comments

Comments
 (0)