2022-09-23 19:57:29 +08:00
|
|
|
/************************************************************************************//*!
|
|
|
|
\file Transform.cxx
|
|
|
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
|
|
|
\par email: kahwei.tng\@digipen.edu
|
|
|
|
\date Sep 23, 2022
|
|
|
|
\brief Contains the definition of the functions of the managed Transform class.
|
|
|
|
|
|
|
|
Note: This file is written in C++17/CLI.
|
|
|
|
|
|
|
|
Copyright (C) 2022 DigiPen Institute of Technology.
|
|
|
|
Reproduction or disclosure of this file or its contents without the prior written consent
|
|
|
|
of DigiPen Institute of Technology is prohibited.
|
|
|
|
*//*************************************************************************************/
|
|
|
|
// Precompiled Headers
|
|
|
|
#include "SHpch.h"
|
|
|
|
// Primary Header
|
|
|
|
#include "Transform.hxx"
|
|
|
|
|
|
|
|
namespace SHADE
|
|
|
|
{
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Properties */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Vector3 Transform::LocalPosition::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetLocalPosition());
|
|
|
|
}
|
|
|
|
void Transform::LocalPosition::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetLocalPosition(Convert::ToNative(val));
|
|
|
|
}
|
2022-10-24 20:07:59 +08:00
|
|
|
Quaternion Transform::LocalRotation::get()
|
2022-09-23 19:57:29 +08:00
|
|
|
{
|
2022-10-24 20:07:59 +08:00
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetLocalOrientation());
|
2022-09-23 19:57:29 +08:00
|
|
|
}
|
2022-10-24 20:07:59 +08:00
|
|
|
void Transform::LocalRotation::set(Quaternion val)
|
2022-09-23 19:57:29 +08:00
|
|
|
{
|
2022-10-24 20:07:59 +08:00
|
|
|
GetNativeComponent()->SetLocalOrientation(Convert::ToNative(val));
|
2022-09-23 19:57:29 +08:00
|
|
|
}
|
2022-10-24 22:41:36 +08:00
|
|
|
Vector3 Transform::LocalEulerAngles::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetLocalRotation());
|
|
|
|
}
|
|
|
|
void Transform::LocalEulerAngles::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetLocalRotation(Convert::ToNative(val));
|
|
|
|
}
|
2022-09-23 19:57:29 +08:00
|
|
|
Vector3 Transform::LocalScale::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetLocalScale());
|
|
|
|
|
|
|
|
}
|
|
|
|
void Transform::LocalScale::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetLocalScale(Convert::ToNative(val));
|
|
|
|
}
|
|
|
|
Vector3 Transform::GlobalPosition::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetWorldPosition());
|
|
|
|
}
|
|
|
|
void Transform::GlobalPosition::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetWorldPosition(Convert::ToNative(val));
|
|
|
|
}
|
2022-10-24 20:07:59 +08:00
|
|
|
Quaternion Transform::GlobalRotation::get()
|
2022-09-23 19:57:29 +08:00
|
|
|
{
|
2022-10-24 20:07:59 +08:00
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetLocalOrientation());
|
2022-09-23 19:57:29 +08:00
|
|
|
}
|
2022-10-24 20:07:59 +08:00
|
|
|
void Transform::GlobalRotation::set(Quaternion val)
|
2022-09-23 19:57:29 +08:00
|
|
|
{
|
2022-10-24 20:07:59 +08:00
|
|
|
GetNativeComponent()->SetWorldOrientation(Convert::ToNative(val));
|
2022-09-23 19:57:29 +08:00
|
|
|
}
|
2022-10-24 22:41:36 +08:00
|
|
|
Vector3 Transform::GlobalEulerAngles::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetWorldRotation());
|
|
|
|
}
|
|
|
|
void Transform::GlobalEulerAngles::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetWorldRotation(Convert::ToNative(val));
|
|
|
|
}
|
2022-09-23 19:57:29 +08:00
|
|
|
Vector3 Transform::GlobalScale::get()
|
|
|
|
{
|
|
|
|
return Convert::ToCLI(GetNativeComponent()->GetWorldScale());
|
|
|
|
|
|
|
|
}
|
|
|
|
void Transform::GlobalScale::set(Vector3 val)
|
|
|
|
{
|
|
|
|
GetNativeComponent()->SetWorldScale(Convert::ToNative(val));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Constructors */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Transform::Transform(Entity entity)
|
|
|
|
: Component(entity)
|
|
|
|
{}
|
|
|
|
}
|