2022-10-28 19:23:40 +08:00
|
|
|
/************************************************************************************//*!
|
|
|
|
\file NativeAsset.cxx
|
|
|
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
|
|
|
\par email: kahwei.tng\@digipen.edu
|
|
|
|
\date Oct 28, 2022
|
|
|
|
\brief Contains the explicit template instantiation for some types of the
|
|
|
|
templated managed NativeAsset 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.
|
|
|
|
*//*************************************************************************************/
|
|
|
|
#include "SHpch.h"
|
|
|
|
// Primary Include
|
|
|
|
#include "NativeAsset.hxx"
|
|
|
|
// Project Includes
|
|
|
|
#include "Engine/GenericHandle.hxx"
|
2022-11-22 15:37:01 +08:00
|
|
|
#include "Utility/Convert.hxx"
|
|
|
|
#include "Resource/SHResourceManagerWrapper.h"
|
2022-10-28 19:23:40 +08:00
|
|
|
|
|
|
|
namespace SHADE
|
|
|
|
{
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-11-22 00:39:53 +08:00
|
|
|
/* Properties */
|
2022-10-28 19:23:40 +08:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-11-22 00:39:53 +08:00
|
|
|
GenericHandle Asset::NativeObjectHandle::get()
|
|
|
|
{
|
|
|
|
return nativeObjHandle;
|
|
|
|
}
|
2022-11-22 15:37:01 +08:00
|
|
|
AssetID Asset::NativeAssetID::get()
|
|
|
|
{
|
|
|
|
return SHResourceManagerWrapper::GetAssetID(Convert::ToNative(nativeObjHandle)).value_or(INVALID_ASSET_ID);
|
|
|
|
}
|
2022-11-22 00:39:53 +08:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Constructors */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Asset::Asset(Handle<void> nativeHandle)
|
|
|
|
: nativeObjHandle { Convert::ToCLI(Handle<void>(nativeHandle)) }
|
|
|
|
{}
|
2022-11-22 15:37:01 +08:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Operator Overloads */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Asset::operator bool(Asset asset)
|
|
|
|
{
|
|
|
|
return asset.nativeObjHandle && asset.NativeAssetID != INVALID_ASSET_ID;
|
|
|
|
}
|
2022-10-28 19:23:40 +08:00
|
|
|
}
|