Added an abstract base class for NativeAsset to prepare to support serialization of Assets for scripts
This commit is contained in:
parent
af2ad6cc80
commit
07efa1ab51
|
@ -21,6 +21,17 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Explicit Tempalte Instantiations */
|
/* Properties */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
GenericHandle Asset::NativeObjectHandle::get()
|
||||||
|
{
|
||||||
|
return nativeObjHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Constructors */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
Asset::Asset(Handle<void> nativeHandle)
|
||||||
|
: nativeObjHandle { Convert::ToCLI(Handle<void>(nativeHandle)) }
|
||||||
|
{}
|
||||||
}
|
}
|
|
@ -24,11 +24,6 @@ namespace SHADE
|
||||||
/* Properties */
|
/* Properties */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename NativeAssetType>
|
template <typename NativeAssetType>
|
||||||
GenericHandle NativeAsset<NativeAssetType>::NativeObjectHandle::get()
|
|
||||||
{
|
|
||||||
return nativeObjHandle;
|
|
||||||
}
|
|
||||||
template <typename NativeAssetType>
|
|
||||||
Handle<NativeAssetType> NativeAsset<NativeAssetType>::NativeObject::get()
|
Handle<NativeAssetType> NativeAsset<NativeAssetType>::NativeObject::get()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -44,7 +39,6 @@ namespace SHADE
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
template <typename NativeAssetType>
|
template <typename NativeAssetType>
|
||||||
NativeAsset<NativeAssetType>::NativeAsset(Handle<NativeAssetType> nativeObj)
|
NativeAsset<NativeAssetType>::NativeAsset(Handle<NativeAssetType> nativeObj)
|
||||||
: nativeObjHandle{ Convert::ToCLI(Handle<void>(nativeObj)) }
|
: Asset { Handle<void>(nativeObj) }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,9 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generalised template class for a managed representation of a native asset
|
/// Abstract base class that all Native Assets will inherit from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="NativeAssetType">
|
public ref class Asset abstract
|
||||||
/// The type of the asset's native representation.
|
|
||||||
/// </typeparam>
|
|
||||||
template<typename NativeAssetType>
|
|
||||||
public ref class NativeAsset
|
|
||||||
{
|
{
|
||||||
internal:
|
internal:
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
@ -38,6 +34,36 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
GenericHandle get();
|
GenericHandle get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Constructors/Destructor */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for the asset.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ptr">Native asset object handle.</param>
|
||||||
|
Asset(Handle<void> nativeHandle);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Data Members */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
GenericHandle nativeObjHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generalised template class for a managed representation of a native asset
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="NativeAssetType">
|
||||||
|
/// The type of the asset's native representation.
|
||||||
|
/// </typeparam>
|
||||||
|
template<typename NativeAssetType>
|
||||||
|
public ref class NativeAsset abstract : Asset
|
||||||
|
{
|
||||||
|
internal:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Properties */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy of the Handle to the native object.
|
/// Copy of the Handle to the native object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -52,14 +78,8 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for the native asset
|
/// Constructor for the native asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ptr">Native asset object.</param>
|
/// <param name="ptr">Native asset object handle.</param>
|
||||||
NativeAsset(Handle<NativeAssetType> ptr);
|
NativeAsset(Handle<NativeAssetType> ptr);
|
||||||
|
|
||||||
protected:
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Data Members */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
GenericHandle nativeObjHandle;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue