Added full implementation of Renderable script interface

This commit is contained in:
Kah Wei 2022-10-29 02:19:36 +08:00
parent 9617ed3838
commit 19dc999e4f
2 changed files with 61 additions and 11 deletions

View File

@ -16,13 +16,10 @@ of DigiPen Institute of Technology is prohibited.
// Primary Header // Primary Header
#include "Renderable.hxx" #include "Renderable.hxx"
#include "Assets/NativeAsset.hxx" #include "Assets/NativeAsset.hxx"
#include "Utility/Convert.hxx"
namespace SHADE namespace SHADE
{ {
/*---------------------------------------------------------------------------------*/
/* Properties */
/*---------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Constructors */ /* 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<SHMesh>();
}
else
{
GetNativeComponent()->Mesh = Handle<SHMesh>(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<SHMaterialInstance>());
}
else
{
GetNativeComponent()->SetMaterial(Handle<SHMaterialInstance>(Convert::ToNative(value->NativeObjectHandle)));
}
}
System::Byte Renderable::LightLayer::get()
{
return GetNativeComponent()->GetLightLayer();
}
} }

View File

@ -20,6 +20,8 @@ of DigiPen Institute of Technology is prohibited.
#include "Math/Quaternion.hxx" #include "Math/Quaternion.hxx"
// External Dependencies // External Dependencies
#include "Graphics/MiddleEnd/Interface/SHRenderable.h" #include "Graphics/MiddleEnd/Interface/SHRenderable.h"
#include "Assets/Mesh.hxx"
#include "Assets/Material.hxx"
namespace SHADE namespace SHADE
{ {
@ -43,11 +45,29 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Properties */ /* Properties */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/// <summary>
/*-----------------------------------------------------------------------------*/ /// Mesh used to render this Renderable.
/* Usage Functions */ /// </summary>
/*-----------------------------------------------------------------------------*/ property SHADE::Mesh^ Mesh
{
SHADE::Mesh^ get();
void set(SHADE::Mesh^ value);
}
/// <summary>
/// Material used to render this Renderable.
/// </summary>
property SHADE::Material^ Material
{
SHADE::Material^ get();
void set(SHADE::Material^ value);
}
/// <summary>
/// Material used to render this Renderable.
/// </summary>
property System::Byte LightLayer
{
System::Byte get();
}
}; };
} }