Modified Managed Transform Interface to use Quaternions

This commit is contained in:
Diren D Bharwani 2022-10-24 20:07:59 +08:00
parent c34faade86
commit 24c591ec27
2 changed files with 18 additions and 19 deletions

View File

@ -29,13 +29,13 @@ namespace SHADE
{
GetNativeComponent()->SetLocalPosition(Convert::ToNative(val));
}
Vector3 Transform::LocalRotation::get()
Quaternion Transform::LocalRotation::get()
{
return Convert::ToCLI(GetNativeComponent()->GetLocalRotation());
return Convert::ToCLI(GetNativeComponent()->GetLocalOrientation());
}
void Transform::LocalRotation::set(Vector3 val)
void Transform::LocalRotation::set(Quaternion val)
{
GetNativeComponent()->SetLocalRotation(Convert::ToNative(val));
GetNativeComponent()->SetLocalOrientation(Convert::ToNative(val));
}
Vector3 Transform::LocalScale::get()
{
@ -54,13 +54,13 @@ namespace SHADE
{
GetNativeComponent()->SetWorldPosition(Convert::ToNative(val));
}
Vector3 Transform::GlobalRotation::get()
Quaternion Transform::GlobalRotation::get()
{
return Convert::ToCLI(GetNativeComponent()->GetWorldRotation());
return Convert::ToCLI(GetNativeComponent()->GetLocalOrientation());
}
void Transform::GlobalRotation::set(Vector3 val)
void Transform::GlobalRotation::set(Quaternion val)
{
GetNativeComponent()->SetWorldRotation(Convert::ToNative(val));
GetNativeComponent()->SetWorldOrientation(Convert::ToNative(val));
}
Vector3 Transform::GlobalScale::get()
{

View File

@ -17,14 +17,14 @@ of DigiPen Institute of Technology is prohibited.
// Project Includes
#include "Components/Component.hxx"
#include "Math/Vector3.hxx"
#include "Utility/Convert.hxx"
#include "Math/Quaternion.hxx"
// External Dependencies
#include "Math/Transform/SHTransformComponent.h"
namespace SHADE
{
/// <summary>
/// CLR version of the the SHADE Engine's TransformComponent.
/// CLR version of the SHADE Engine's TransformComponent.
/// </summary>
public ref class Transform : public Component<SHTransformComponent>
{
@ -52,12 +52,12 @@ namespace SHADE
void set(Vector3 val);
}
/// <summary>
/// Local Z-axis rotation angle stored by this Transform in Radians.
/// Local rotation quaternion stored by this Transform.
/// </summary>
property Vector3 LocalRotation
property Quaternion LocalRotation
{
Vector3 get();
void set(Vector3 val);
Quaternion get();
void set(Quaternion val);
}
/// <summary>
/// Local scale stored by this Transform.
@ -76,16 +76,15 @@ namespace SHADE
void set(Vector3 val);
}
/// <summary>
/// Global Z-axis rotation angle stored by this Transform in Radians.
/// Global rotation quaternion stored by this Transform.
/// </summary>
property Vector3 GlobalRotation
property Quaternion GlobalRotation
{
Vector3 get();
void set(Vector3 val);
Quaternion get();
void set(Quaternion val);
}
/// <summary>
/// Global scale stored by this Transform.
/// Note that this operation is expensive.
/// </summary>
property Vector3 GlobalScale
{