Files
Seele/src/Engine/Asset/Asset.h
T

51 lines
1.2 KiB
C++
Raw Normal View History

2020-05-05 01:51:13 +02:00
#pragma once
#include "MinimalEngine.h"
2023-02-13 14:56:13 +01:00
#include "Serialization/ArchiveBuffer.h"
2020-05-05 01:51:13 +02:00
namespace Seele
{
2023-01-29 18:58:59 +01:00
DECLARE_NAME_REF(Gfx, Graphics)
2020-05-05 01:51:13 +02:00
class Asset
{
public:
2020-06-02 11:46:18 +02:00
enum class Status
{
Uninitialized,
Loading,
Ready
};
2020-05-05 01:51:13 +02:00
Asset();
2023-02-13 14:56:13 +01:00
Asset(std::string_view folderPath, std::string_view name);
2020-05-05 01:51:13 +02:00
virtual ~Asset();
2020-06-08 01:44:47 +02:00
2023-02-24 22:09:07 +01:00
void updateByteSize();
2023-02-13 14:56:13 +01:00
virtual void save(ArchiveBuffer& buffer) const = 0;
virtual void load(ArchiveBuffer& buffer) = 0;
2020-06-02 11:46:18 +02:00
2023-02-13 14:56:13 +01:00
// returns the assets name
std::string getName() const;
// returns the (virtual) folder path
std::string getFolderPath() const;
// returns the identifier with which it can be found from the asset registry
std::string getAssetIdentifier() const;
2023-02-24 22:09:07 +01:00
// returns the size of the assets data in bytes(excluding name and folder)
uint64 getByteSize() const { return byteSize; }
2023-02-13 14:56:13 +01:00
constexpr Status getStatus()
2020-06-02 11:46:18 +02:00
{
return status;
}
2023-02-13 14:56:13 +01:00
constexpr void setStatus(Status _status)
2020-06-02 11:46:18 +02:00
{
status = _status;
2020-06-02 11:46:18 +02:00
}
protected:
2023-02-13 14:56:13 +01:00
std::string folderPath;
std::string name;
std::string assetId;
2021-04-01 16:40:14 +02:00
Status status;
2023-02-24 22:09:07 +01:00
uint64 byteSize;
2020-05-05 01:51:13 +02:00
};
2021-04-01 16:40:14 +02:00
DEFINE_REF(Asset)
2020-05-05 01:51:13 +02:00
} // namespace Seele