mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 16:57:57 +03:00
Simplify
This commit is contained in:
parent
a5bbbbdb5c
commit
d2912b4f40
2 changed files with 6 additions and 5 deletions
|
@ -15,15 +15,16 @@ using TEN::Renderer::g_Renderer;
|
||||||
|
|
||||||
namespace TEN::Hud
|
namespace TEN::Hud
|
||||||
{
|
{
|
||||||
Vector2 CrosshairData::Get2DPositionOffset(short segmentOrient2D) const
|
Vector2 CrosshairData::Get2DPositionOffset(short orientOffset2D) const
|
||||||
{
|
{
|
||||||
constexpr auto ANGLE_OFFSET = ANGLE(-45.0f);
|
constexpr auto ANGLE_OFFSET = ANGLE(-45.0f);
|
||||||
|
|
||||||
float offsetDist = (Size / 2) * RadiusScalar;
|
float offsetDist = (Size / 2) * RadiusScalar;
|
||||||
auto posOffset2D = Vector2(offsetDist, 0.0f);
|
auto relPosOffset2D = Vector2(offsetDist, 0.0f);
|
||||||
auto rotMatrix = Matrix::CreateRotationZ(TO_RAD(Orientation2D + segmentOrient2D + ANGLE_OFFSET));
|
auto rotMatrix = Matrix::CreateRotationZ(TO_RAD(Orientation2D + orientOffset2D + ANGLE_OFFSET));
|
||||||
|
|
||||||
return GetAspectCorrect2DPosition(Vector2::Transform(posOffset2D, rotMatrix));
|
auto posOffset2D = Vector2::Transform(relPosOffset2D, rotMatrix);
|
||||||
|
return GetAspectCorrect2DPosition(posOffset2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CrosshairData::IsOffscreen() const
|
bool CrosshairData::IsOffscreen() const
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace TEN::Hud
|
||||||
|
|
||||||
std::array<SegmentData, SEGMENT_COUNT> Segments = {};
|
std::array<SegmentData, SEGMENT_COUNT> Segments = {};
|
||||||
|
|
||||||
Vector2 Get2DPositionOffset(short segmentOrient2D) const;
|
Vector2 Get2DPositionOffset(short orientOffset2D) const;
|
||||||
bool IsOffscreen() const;
|
bool IsOffscreen() const;
|
||||||
void Update(const Vector3& cameraPos, bool doPulse, bool isActive);
|
void Update(const Vector3& cameraPos, bool doPulse, bool isActive);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue