remove unit conversions from the internal vect3d wrappers
This commit is contained in:
@@ -39,7 +39,6 @@
|
|||||||
#include "Runtime/Launch/Resources/Version.h"
|
#include "Runtime/Launch/Resources/Version.h"
|
||||||
|
|
||||||
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
|
#include "SGBuildHacks/SGInclude_Core_Vect3D.h"
|
||||||
#include "SGUtils/SGUnits.h"
|
|
||||||
|
|
||||||
struct FSGVect3DImpl::FImpl
|
struct FSGVect3DImpl::FImpl
|
||||||
{
|
{
|
||||||
@@ -102,12 +101,7 @@ FSGVect3DImpl::FSGVect3DImpl(const float X, const float Y, const float Z)
|
|||||||
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
Pimpl(TUniquePtr<FImpl, FImplDeleter>(new FImpl{this}))
|
||||||
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
#endif /* ENGINE_MAJOR_VERSION == 5 || ( ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION > 22 ) */
|
||||||
{
|
{
|
||||||
/// NOTE
|
Pimpl->Vect3D = FVect3DType(X, Y, Z);
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
Pimpl->Vect3D = FVect3DType(FSGUnits::CentimetersToMillimeters(X),
|
|
||||||
FSGUnits::CentimetersToMillimeters(Y),
|
|
||||||
FSGUnits::CentimetersToMillimeters(Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FSGVect3DImpl::FSGVect3DImpl(const FVect3DType& Vect3D)
|
FSGVect3DImpl::FSGVect3DImpl(const FVect3DType& Vect3D)
|
||||||
@@ -139,14 +133,7 @@ FSGVect3DImpl::FSGVect3DImpl(const FVector& Vector)
|
|||||||
/// Right Y
|
/// Right Y
|
||||||
/// Up Z
|
/// Up Z
|
||||||
|
|
||||||
/// NOTE
|
FVect3DType Vect3D(Vector.X, -Vector.Y, Vector.Z);
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
|
|
||||||
FVect3DType Vect3D(FSGUnits::CentimetersToMillimeters(Vector.X),
|
|
||||||
FSGUnits::CentimetersToMillimeters(-Vector.Y),
|
|
||||||
FSGUnits::CentimetersToMillimeters(Vector.Z));
|
|
||||||
|
|
||||||
Pimpl->Vect3D = MoveTemp(Vect3D);
|
Pimpl->Vect3D = MoveTemp(Vect3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,14 +178,7 @@ FVector FSGVect3DImpl::ToFVector() const
|
|||||||
/// Right Y
|
/// Right Y
|
||||||
/// Up Z
|
/// Up Z
|
||||||
|
|
||||||
/// NOTE
|
FVector Vector(Pimpl->Vect3D.GetX(), -Pimpl->Vect3D.GetY(), Pimpl->Vect3D.GetZ());
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
|
|
||||||
FVector Vector(FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.GetX()),
|
|
||||||
FSGUnits::MillimetersToCentimeters(-Pimpl->Vect3D.GetY()),
|
|
||||||
FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.GetZ()));
|
|
||||||
|
|
||||||
return MoveTemp(Vector);
|
return MoveTemp(Vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,58 +199,37 @@ FSGVect3DImpl FSGVect3DImpl::operator*(const float& ScaleFactor) const
|
|||||||
|
|
||||||
float FSGVect3DImpl::GetX() const
|
float FSGVect3DImpl::GetX() const
|
||||||
{
|
{
|
||||||
/// NOTE
|
return Pimpl->Vect3D.GetX();
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
return FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.GetX());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSGVect3DImpl::SetX(const float X)
|
void FSGVect3DImpl::SetX(const float X)
|
||||||
{
|
{
|
||||||
/// NOTE
|
Pimpl->Vect3D.SetX(X);
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
Pimpl->Vect3D.SetX(FSGUnits::CentimetersToMillimeters(X));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float FSGVect3DImpl::GetY() const
|
float FSGVect3DImpl::GetY() const
|
||||||
{
|
{
|
||||||
/// NOTE
|
return Pimpl->Vect3D.GetY();
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
return FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.GetY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSGVect3DImpl::SetY(const float Y)
|
void FSGVect3DImpl::SetY(const float Y)
|
||||||
{
|
{
|
||||||
/// NOTE
|
Pimpl->Vect3D.SetY(Y);
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
Pimpl->Vect3D.SetY(FSGUnits::CentimetersToMillimeters(Y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float FSGVect3DImpl::GetZ() const
|
float FSGVect3DImpl::GetZ() const
|
||||||
{
|
{
|
||||||
/// NOTE
|
return Pimpl->Vect3D.GetZ();
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
return FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.GetZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSGVect3DImpl::SetZ(const float Z)
|
void FSGVect3DImpl::SetZ(const float Z)
|
||||||
{
|
{
|
||||||
/// NOTE
|
Pimpl->Vect3D.SetZ(Z);
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
Pimpl->Vect3D.SetZ(FSGUnits::CentimetersToMillimeters(Z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float FSGVect3DImpl::Magnitude() const
|
float FSGVect3DImpl::Magnitude() const
|
||||||
{
|
{
|
||||||
/// NOTE
|
return Pimpl->Vect3D.Magnitude();
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
return FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.Magnitude());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSGVect3DImpl::Normalize()
|
void FSGVect3DImpl::Normalize()
|
||||||
@@ -285,10 +244,7 @@ void FSGVect3DImpl::Scale(const float Factor)
|
|||||||
|
|
||||||
float FSGVect3DImpl::DistTo(const FSGVect3DImpl& Vect3DImpl) const
|
float FSGVect3DImpl::DistTo(const FSGVect3DImpl& Vect3DImpl) const
|
||||||
{
|
{
|
||||||
/// NOTE
|
return Pimpl->Vect3D.DistTo(Vect3DImpl.ToVect3D());
|
||||||
/// Unreal Engine uses the Metric System and centimeters as its default unit for measuring distance/length;
|
|
||||||
/// while SenseGlove uses millimeters.
|
|
||||||
return FSGUnits::MillimetersToCentimeters(Pimpl->Vect3D.DistTo(Vect3DImpl.ToVect3D()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FSGVect3DImpl::Equals(const FSGVect3DImpl& Vect3DImpl) const
|
bool FSGVect3DImpl::Equals(const FSGVect3DImpl& Vect3DImpl) const
|
||||||
|
|||||||
Reference in New Issue
Block a user