From 19dc999e4f2b233945f4c61e0fcbd87b68e4d71f Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Sat, 29 Oct 2022 02:19:36 +0800 Subject: [PATCH] Added full implementation of Renderable script interface --- SHADE_Managed/src/Components/Renderable.cxx | 42 ++++++++++++++++++--- SHADE_Managed/src/Components/Renderable.hxx | 30 ++++++++++++--- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/SHADE_Managed/src/Components/Renderable.cxx b/SHADE_Managed/src/Components/Renderable.cxx index 08a43506..d1bbb4c8 100644 --- a/SHADE_Managed/src/Components/Renderable.cxx +++ b/SHADE_Managed/src/Components/Renderable.cxx @@ -16,13 +16,10 @@ of DigiPen Institute of Technology is prohibited. // Primary Header #include "Renderable.hxx" #include "Assets/NativeAsset.hxx" +#include "Utility/Convert.hxx" namespace SHADE { - /*---------------------------------------------------------------------------------*/ - /* Properties */ - /*---------------------------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ /* Constructors */ /*---------------------------------------------------------------------------------*/ @@ -31,7 +28,40 @@ namespace SHADE {} /*---------------------------------------------------------------------------------*/ - /* Usage Functions */ + /* Properties */ /*---------------------------------------------------------------------------------*/ - + SHADE::Mesh^ Renderable::Mesh::get() + { + return gcnew SHADE::Mesh(GetNativeComponent()->Mesh); + } + void Renderable::Mesh::set(SHADE::Mesh^ value) + { + if (value == nullptr) + { + GetNativeComponent()->Mesh = Handle(); + } + else + { + GetNativeComponent()->Mesh = Handle(Convert::ToNative(value->NativeObjectHandle)); + } + } + SHADE::Material^ Renderable::Material::get() + { + return gcnew SHADE::Material(GetNativeComponent()->GetMaterial()); + } + void Renderable::Material::set(SHADE::Material^ value) + { + if (value == nullptr) + { + GetNativeComponent()->SetMaterial(Handle()); + } + else + { + GetNativeComponent()->SetMaterial(Handle(Convert::ToNative(value->NativeObjectHandle))); + } + } + System::Byte Renderable::LightLayer::get() + { + return GetNativeComponent()->GetLightLayer(); + } } diff --git a/SHADE_Managed/src/Components/Renderable.hxx b/SHADE_Managed/src/Components/Renderable.hxx index c21ebdd6..e8f11ef6 100644 --- a/SHADE_Managed/src/Components/Renderable.hxx +++ b/SHADE_Managed/src/Components/Renderable.hxx @@ -20,6 +20,8 @@ of DigiPen Institute of Technology is prohibited. #include "Math/Quaternion.hxx" // External Dependencies #include "Graphics/MiddleEnd/Interface/SHRenderable.h" +#include "Assets/Mesh.hxx" +#include "Assets/Material.hxx" namespace SHADE { @@ -43,11 +45,29 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ /* Properties */ /*-----------------------------------------------------------------------------*/ - - /*-----------------------------------------------------------------------------*/ - /* Usage Functions */ - /*-----------------------------------------------------------------------------*/ - + /// + /// Mesh used to render this Renderable. + /// + property SHADE::Mesh^ Mesh + { + SHADE::Mesh^ get(); + void set(SHADE::Mesh^ value); + } + /// + /// Material used to render this Renderable. + /// + property SHADE::Material^ Material + { + SHADE::Material^ get(); + void set(SHADE::Material^ value); + } + /// + /// Material used to render this Renderable. + /// + property System::Byte LightLayer + { + System::Byte get(); + } }; }