Added C# Assets System and Serialization of Script Enabled State #247
|
@ -0,0 +1,59 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHResourceManagerInterface.cpp
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Nov 22, 2022
|
||||
\brief Contains the definition of the functions of the
|
||||
SHResourceManagerInterface static class.
|
||||
|
||||
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 Header
|
||||
#include "SHpch.h"
|
||||
// Primary Include
|
||||
#include "SHResourceManagerInterface.h"
|
||||
// Project Includes
|
||||
#include "SHResourceManager.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
Handle<SHMesh> SHResourceManagerInterface::LoadOrGetMesh(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHMesh>(assetId);
|
||||
}
|
||||
Handle<SHTexture> SHResourceManagerInterface::LoadOrGetTexture(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHTexture>(assetId);
|
||||
}
|
||||
Handle<SHVkShaderModule> SHResourceManagerInterface::LoadOrGetShaderModule(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHVkShaderModule>(assetId);
|
||||
}
|
||||
Handle<SHMaterialSpec> SHResourceManagerInterface::LoadOrGetMaterialSpec(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHMaterialSpec>(assetId);
|
||||
}
|
||||
Handle<SHMaterial> SHResourceManagerInterface::LoadOrGetMaterial(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHMaterial>(assetId);
|
||||
}
|
||||
Handle<SHFont> SHResourceManagerInterface::LoadOrGetFont(AssetID assetId)
|
||||
{
|
||||
return SHResourceManager::LoadOrGet<SHFont>(assetId);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Query Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
std::optional<AssetID> SHResourceManagerInterface::GetAssetID(Handle<void> handle)
|
||||
{
|
||||
return SHResourceManager::GetAssetID(handle);
|
||||
}
|
||||
|
||||
std::optional<std::string> SHResourceManagerInterface::GetAssetName(Handle<void> handle)
|
||||
{
|
||||
return SHResourceManager::GetAssetName(handle);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHResourceManagerInterface.h
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Nov 22, 2022
|
||||
\brief Contains the definition of the SHResourceManagerInterface static class.
|
||||
|
||||
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.
|
||||
*//*************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
// STL Includes
|
||||
#include <optional>
|
||||
// Project Includes
|
||||
#include "SH_API.h"
|
||||
#include "Resource/SHHandle.h"
|
||||
#include "Assets/SHAssetMacros.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Forward Declarations */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
class SHMesh;
|
||||
class SHTexture;
|
||||
class SHVkShaderModule;
|
||||
struct SHMaterialSpec;
|
||||
class SHMaterial;
|
||||
class SHFont;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Static class providing access to non-templated functions of SHResourceManager for
|
||||
/// SHADE_Managed.
|
||||
/// </summary>
|
||||
class SH_API SHResourceManagerInterface
|
||||
{
|
||||
public:
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Loading Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHMesh>().
|
||||
/// </summary>
|
||||
/// <param name="assetId">Asset ID of the resource to load.</param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHMesh> LoadOrGetMesh(AssetID assetId);
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHTexture>().
|
||||
/// </summary>
|
||||
/// <param name="assetId"></param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHTexture> LoadOrGetTexture(AssetID assetId);
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHVkShaderModule>().
|
||||
/// </summary>
|
||||
/// <param name="assetId">Asset ID of the resource to load.</param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHVkShaderModule> LoadOrGetShaderModule(AssetID assetId);
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHMaterialSpec>().
|
||||
/// </summary>
|
||||
/// <param name="assetId">Asset ID of the resource to load.</param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHMaterialSpec> LoadOrGetMaterialSpec (AssetID assetId);
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHMaterial>().
|
||||
/// </summary>
|
||||
/// <param name="assetId">Asset ID of the resource to load.</param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHMaterial> LoadOrGetMaterial(AssetID assetId);
|
||||
/// <summary>
|
||||
/// Wrapper for SHResourceManager::LoadOrGet<SHFont>().
|
||||
/// </summary>
|
||||
/// <param name="assetId">Asset ID of the resource to load.</param>
|
||||
/// <returns>Handle to the resource to retrieve.</returns>
|
||||
static Handle<SHFont> LoadOrGetFont(AssetID assetId);
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Query Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Retrieves the AssetID associated with a specified Handle.
|
||||
/// Compared to the templated version, this function is slower as it requires
|
||||
/// searching through the storage of all resource types.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to get the AssetID of.</param>
|
||||
/// <return>
|
||||
/// AssetID for the specified Handle. If the Handle is invalid, there will be no
|
||||
/// value.
|
||||
/// </return>
|
||||
static std::optional<AssetID> GetAssetID(Handle<void> handle);
|
||||
/// <summary>
|
||||
/// Retrieves the name associated with the AssetID that is associated with the
|
||||
/// specified Handle.
|
||||
/// Compared to the templated version, this function is slower as it requires
|
||||
/// searching through the storage of all resource types.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to get the name of.</param>
|
||||
/// <return>
|
||||
/// Name for the specified Handle. If the Handle is invalid, there will be no
|
||||
/// value.
|
||||
/// </return>
|
||||
static std::optional<std::string> GetAssetName(Handle<void> handle);
|
||||
};
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHResourceManagerWrapper.cpp
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Nov 22, 2022
|
||||
\brief Contains the definition of the functions of the SHResourceManagerWraper
|
||||
static class.
|
||||
|
||||
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 Header
|
||||
#include "SHpch.h"
|
||||
// Primary Include
|
||||
#include "SHResourceManagerWrapper.h"
|
||||
// Project Includes
|
||||
#include "SHResourceManager.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Query Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
std::optional<AssetID> SHResourceManagerWrapper::GetAssetID(Handle<void> handle)
|
||||
{
|
||||
return SHResourceManager::GetAssetID(handle);
|
||||
}
|
||||
|
||||
std::optional<std::string> SHResourceManagerWrapper::GetAssetName(Handle<void> handle)
|
||||
{
|
||||
return SHResourceManager::GetAssetName(handle);
|
||||
}
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/************************************************************************************//*!
|
||||
\file SHResourceManagerWrapper.h
|
||||
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||
\par email: kahwei.tng\@digipen.edu
|
||||
\date Nov 22, 2022
|
||||
\brief Contains the definition of the SHResourceManagerWrapper static class.
|
||||
|
||||
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.
|
||||
*//*************************************************************************************/
|
||||
#pragma once
|
||||
|
||||
// STL Includes
|
||||
#include <optional>
|
||||
// Project Includes
|
||||
#include "SH_API.h"
|
||||
#include "Resource/SHHandle.h"
|
||||
#include "Assets/SHAssetMacros.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/// <summary>
|
||||
/// Static class providing access to non-templated functions of SHResourceManager for
|
||||
/// SHADE_Managed.
|
||||
/// </summary>
|
||||
class SH_API SHResourceManagerWrapper
|
||||
{
|
||||
public:
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Query Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Retrieves the AssetID associated with a specified Handle.
|
||||
/// Compared to the templated version, this function is slower as it requires
|
||||
/// searching through the storage of all resource types.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to get the AssetID of.</param>
|
||||
/// <return>
|
||||
/// AssetID for the specified Handle. If the Handle is invalid, there will be no
|
||||
/// value.
|
||||
/// </return>
|
||||
static std::optional<AssetID> GetAssetID(Handle<void> handle);
|
||||
/// <summary>
|
||||
/// Retrieves the name associated with the AssetID that is associated with the
|
||||
/// specified Handle.
|
||||
/// Compared to the templated version, this function is slower as it requires
|
||||
/// searching through the storage of all resource types.
|
||||
/// </summary>
|
||||
/// <param name="handle">Handle to get the name of.</param>
|
||||
/// <return>
|
||||
/// Name for the specified Handle. If the Handle is invalid, there will be no
|
||||
/// value.
|
||||
/// </return>
|
||||
static std::optional<std::string> GetAssetName(Handle<void> handle);
|
||||
};
|
||||
}
|
|
@ -14,7 +14,9 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Precompiled Headers
|
||||
#include "SHpch.h"
|
||||
// Primary Header
|
||||
#include "Font.hxx"
|
||||
#include "FontAsset.hxx"
|
||||
// External Dependencies
|
||||
#include "Resource/SHResourceManagerInterface.h"
|
||||
// Project Headers
|
||||
#include "Utility/Convert.hxx"
|
||||
|
||||
|
@ -23,20 +25,16 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Properties */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Handle<SHFont> Font::NativeObject::get()
|
||||
Handle<SHFont> FontAsset::NativeObject::get()
|
||||
try
|
||||
{
|
||||
return Handle<SHFont>(Convert::ToNative(asset.NativeObjectHandle));
|
||||
return SHResourceManagerInterface::LoadOrGetFont(asset.NativeAssetID);
|
||||
}
|
||||
catch (const BadHandleCastException&)
|
||||
{
|
||||
return Handle<SHFont>();
|
||||
}
|
||||
GenericHandle Font::NativeObjectHandle::get()
|
||||
{
|
||||
return asset.NativeObjectHandle;
|
||||
}
|
||||
AssetID Font::NativeAssetID::get()
|
||||
AssetID FontAsset::NativeAssetID::get()
|
||||
{
|
||||
return asset.NativeAssetID;
|
||||
}
|
||||
|
@ -44,14 +42,14 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructors/Destructor */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Font::Font(Handle<SHFont> font)
|
||||
: asset { Handle<void>(font) }
|
||||
FontAsset::FontAsset(AssetID fontId)
|
||||
: asset { fontId }
|
||||
{}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Font::operator bool(Font asset)
|
||||
FontAsset::operator bool(FontAsset asset)
|
||||
{
|
||||
return asset;
|
||||
}
|
||||
|
@ -59,13 +57,13 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Conversion Operators */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Font::operator Asset(Font nativeAsset)
|
||||
FontAsset::operator Asset(FontAsset nativeAsset)
|
||||
{
|
||||
return nativeAsset.asset;
|
||||
}
|
||||
|
||||
Font::operator Font(Asset asset)
|
||||
FontAsset::operator FontAsset(Asset asset)
|
||||
{
|
||||
return Font(Handle<SHFont>(Convert::ToNative(asset.NativeObjectHandle)));
|
||||
return FontAsset(asset.NativeAssetID);
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ namespace SHADE
|
|||
/// Managed counterpart of the native Font object that can be fed to TextRenderables
|
||||
/// for rendering.
|
||||
/// </summary>
|
||||
public value struct Font
|
||||
public value struct FontAsset
|
||||
{
|
||||
internal:
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
@ -40,13 +40,6 @@ namespace SHADE
|
|||
Handle<SHFont> get();
|
||||
}
|
||||
/// <summary>
|
||||
/// Generic handle for the native object
|
||||
/// </summary>
|
||||
property GenericHandle NativeObjectHandle
|
||||
{
|
||||
GenericHandle get();
|
||||
}
|
||||
/// <summary>
|
||||
/// The raw asset ID of the asset.
|
||||
/// </summary>
|
||||
property AssetID NativeAssetID
|
||||
|
@ -60,8 +53,8 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Constructor for the Font.
|
||||
/// </summary>
|
||||
/// <param name="font">Handle to the font object.</param>
|
||||
Font(Handle<SHFont> font);
|
||||
/// <param name="fontId">AssetID to the font asset.</param>
|
||||
FontAsset(AssetID fontId);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
|
@ -71,7 +64,7 @@ namespace SHADE
|
|||
/// </summary>
|
||||
/// <param name="gameObj">Asset to check.</param>
|
||||
/// <returns>True if the Asset is valid.</returns>
|
||||
static operator bool(Font asset);
|
||||
static operator bool(FontAsset asset);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Conversion Operators */
|
||||
|
@ -80,12 +73,12 @@ namespace SHADE
|
|||
/// Conversion operator to enable casting from a Font to an Asset.
|
||||
/// </summary>
|
||||
/// <param name="vec">Vector3 to convert from.</param>
|
||||
static explicit operator Asset(Font nativeAsset);
|
||||
static explicit operator Asset(FontAsset nativeAsset);
|
||||
/// <summary>
|
||||
/// Conversion operator to enable casting from a Asset to a Font.
|
||||
/// </summary>
|
||||
/// <param name="vec">Vector2 to convert from.</param>
|
||||
static explicit operator Font(Asset vec);
|
||||
/// <param name="asset"></param>
|
||||
static explicit operator FontAsset(Asset asset);
|
||||
|
||||
protected:
|
||||
/*-----------------------------------------------------------------------------*/
|
|
@ -14,7 +14,9 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Precompiled Headers
|
||||
#include "SHpch.h"
|
||||
// Primary Header
|
||||
#include "Mesh.hxx"
|
||||
#include "MeshAsset.hxx"
|
||||
// External Dependencies
|
||||
#include "Resource/SHResourceManagerInterface.h"
|
||||
// Project Headers
|
||||
#include "Utility/Convert.hxx"
|
||||
|
||||
|
@ -23,20 +25,16 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Properties */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Handle<SHMesh> Mesh::NativeObject::get()
|
||||
Handle<SHMesh> MeshAsset::NativeObject::get()
|
||||
try
|
||||
{
|
||||
return Handle<SHMesh>(Convert::ToNative(asset.NativeObjectHandle));
|
||||
return SHResourceManagerInterface::LoadOrGetMesh(asset.NativeAssetID);
|
||||
}
|
||||
catch (const BadHandleCastException&)
|
||||
{
|
||||
return Handle<SHMesh>();
|
||||
}
|
||||
GenericHandle Mesh::NativeObjectHandle::get()
|
||||
{
|
||||
return asset.NativeObjectHandle;
|
||||
}
|
||||
AssetID Mesh::NativeAssetID::get()
|
||||
AssetID MeshAsset::NativeAssetID::get()
|
||||
{
|
||||
return asset.NativeAssetID;
|
||||
}
|
||||
|
@ -44,14 +42,14 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructors/Destructor */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Mesh::Mesh(Handle<SHMesh> Mesh)
|
||||
: asset{ Handle<void>(Mesh) }
|
||||
MeshAsset::MeshAsset(AssetID meshId)
|
||||
: asset{ meshId }
|
||||
{}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Mesh::operator bool(Mesh asset)
|
||||
MeshAsset::operator bool(MeshAsset asset)
|
||||
{
|
||||
return asset;
|
||||
}
|
||||
|
@ -59,13 +57,13 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Conversion Operators */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Mesh::operator Asset(Mesh nativeAsset)
|
||||
MeshAsset::operator Asset(MeshAsset nativeAsset)
|
||||
{
|
||||
return nativeAsset.asset;
|
||||
}
|
||||
|
||||
Mesh::operator Mesh(Asset asset)
|
||||
MeshAsset::operator MeshAsset(Asset asset)
|
||||
{
|
||||
return Mesh(Handle<SHMesh>(Convert::ToNative(asset.NativeObjectHandle)));
|
||||
return MeshAsset(asset.NativeAssetID);
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ namespace SHADE
|
|||
/// Managed counterpart of the native Mesh object containing vertex data that can
|
||||
/// be fed to Renderables for rendering.
|
||||
/// </summary>
|
||||
public value struct Mesh
|
||||
public value struct MeshAsset
|
||||
{
|
||||
internal:
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
@ -40,13 +40,6 @@ namespace SHADE
|
|||
Handle<SHMesh> get();
|
||||
}
|
||||
/// <summary>
|
||||
/// Generic handle for the native object
|
||||
/// </summary>
|
||||
property GenericHandle NativeObjectHandle
|
||||
{
|
||||
GenericHandle get();
|
||||
}
|
||||
/// <summary>
|
||||
/// The raw asset ID of the asset.
|
||||
/// </summary>
|
||||
property AssetID NativeAssetID
|
||||
|
@ -60,8 +53,8 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Constructor for the Mesh.
|
||||
/// </summary>
|
||||
/// <param name="Mesh">Handle to the Mesh object.</param>
|
||||
Mesh(Handle<SHMesh> Mesh);
|
||||
/// <param name="meshId">AssetID to the Mesh asset.</param>
|
||||
MeshAsset(AssetID meshId);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
|
@ -71,7 +64,7 @@ namespace SHADE
|
|||
/// </summary>
|
||||
/// <param name="gameObj">Asset to check.</param>
|
||||
/// <returns>True if the Asset is valid.</returns>
|
||||
static operator bool(Mesh asset);
|
||||
static operator bool(MeshAsset asset);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Conversion Operators */
|
||||
|
@ -80,12 +73,12 @@ namespace SHADE
|
|||
/// Conversion operator to enable casting from a Mesh to an Asset.
|
||||
/// </summary>
|
||||
/// <param name="vec">Vector3 to convert from.</param>
|
||||
static explicit operator Asset(Mesh nativeAsset);
|
||||
static explicit operator Asset(MeshAsset nativeAsset);
|
||||
/// <summary>
|
||||
/// Conversion operator to enable casting from a Asset to a Mesh.
|
||||
/// </summary>
|
||||
/// <param name="vec">Vector2 to convert from.</param>
|
||||
static explicit operator Mesh(Asset vec);
|
||||
/// <param name="asset"></param>
|
||||
static explicit operator MeshAsset(Asset asset);
|
||||
|
||||
protected:
|
||||
/*-----------------------------------------------------------------------------*/
|
|
@ -18,27 +18,22 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Project Includes
|
||||
#include "Engine/GenericHandle.hxx"
|
||||
#include "Utility/Convert.hxx"
|
||||
#include "Resource/SHResourceManagerWrapper.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Properties */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
GenericHandle Asset::NativeObjectHandle::get()
|
||||
{
|
||||
return nativeObjHandle;
|
||||
}
|
||||
AssetID Asset::NativeAssetID::get()
|
||||
{
|
||||
return SHResourceManagerWrapper::GetAssetID(Convert::ToNative(nativeObjHandle)).value_or(INVALID_ASSET_ID);
|
||||
return assetId;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Constructors */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Asset::Asset(Handle<void> nativeHandle)
|
||||
: nativeObjHandle { Convert::ToCLI(Handle<void>(nativeHandle)) }
|
||||
Asset::Asset(AssetID id)
|
||||
: assetId { id }
|
||||
{}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -46,6 +41,6 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
Asset::operator bool(Asset asset)
|
||||
{
|
||||
return asset.nativeObjHandle && asset.NativeAssetID != INVALID_ASSET_ID;
|
||||
return asset.NativeAssetID != INVALID_ASSET_ID;
|
||||
}
|
||||
}
|
|
@ -31,13 +31,6 @@ namespace SHADE
|
|||
/* Properties */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Generic handle for the native object
|
||||
/// </summary>
|
||||
property GenericHandle NativeObjectHandle
|
||||
{
|
||||
GenericHandle get();
|
||||
}
|
||||
/// <summary>
|
||||
/// The raw asset ID of the asset.
|
||||
/// </summary>
|
||||
property AssetID NativeAssetID
|
||||
|
@ -51,8 +44,8 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Constructor for the asset.
|
||||
/// </summary>
|
||||
/// <param name="ptr">Native asset object handle.</param>
|
||||
Asset(Handle<void> nativeHandle);
|
||||
/// <param name="id">Native asset ID to construct this asset from.</param>
|
||||
explicit Asset(AssetID id);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
|
@ -68,6 +61,6 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------*/
|
||||
/* Data Members */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
GenericHandle nativeObjHandle;
|
||||
AssetID assetId;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Properties */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
SHADE::Mesh^ Renderable::Mesh::get()
|
||||
SHADE::MeshAsset^ Renderable::Mesh::get()
|
||||
{
|
||||
return gcnew SHADE::Mesh(GetNativeComponent()->GetMesh());
|
||||
return gcnew SHADE::MeshAsset(GetNativeComponent()->GetMesh());
|
||||
}
|
||||
void Renderable::Mesh::set(SHADE::Mesh^ value)
|
||||
void Renderable::Mesh::set(SHADE::MeshAsset^ value)
|
||||
{
|
||||
if (value == nullptr)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ 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/MeshAsset.hxx"
|
||||
#include "Assets/Material.hxx"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -48,10 +48,10 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Mesh used to render this Renderable.
|
||||
/// </summary>
|
||||
property SHADE::Mesh^ Mesh
|
||||
property SHADE::MeshAsset^ Mesh
|
||||
{
|
||||
SHADE::Mesh^ get();
|
||||
void set(SHADE::Mesh^ value);
|
||||
SHADE::MeshAsset^ get();
|
||||
void set(SHADE::MeshAsset^ value);
|
||||
}
|
||||
/// <summary>
|
||||
/// Material used to render this Renderable.
|
||||
|
|
|
@ -39,11 +39,11 @@ namespace SHADE
|
|||
{
|
||||
GetNativeComponent()->SetText(Convert::ToNative(value));
|
||||
}
|
||||
SHADE::Font^ TextRenderable::Font::get()
|
||||
SHADE::FontAsset^ TextRenderable::Font::get()
|
||||
{
|
||||
return gcnew SHADE::Font(GetNativeComponent()->GetFont());
|
||||
return gcnew SHADE::FontAsset(GetNativeComponent()->GetFont());
|
||||
}
|
||||
void TextRenderable::Font::set(SHADE::Font^ value)
|
||||
void TextRenderable::Font::set(SHADE::FontAsset^ value)
|
||||
{
|
||||
if (value == nullptr)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Components/Component.hxx"
|
||||
#include "Math/Vector3.hxx"
|
||||
#include "Math/Quaternion.hxx"
|
||||
#include "Assets/Font.hxx"
|
||||
#include "Assets/FontAsset.hxx"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -55,10 +55,10 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Font to use to render using this TextRenderable.
|
||||
/// </summary>
|
||||
property SHADE::Font^ Font
|
||||
property SHADE::FontAsset^ Font
|
||||
{
|
||||
SHADE::Font^ get();
|
||||
void set(SHADE::Font^ value);
|
||||
SHADE::FontAsset^ get();
|
||||
void set(SHADE::FontAsset^ value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue