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

38 lines
1.0 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
2024-06-09 12:20:04 +02:00
namespace Seele {
2023-01-29 18:58:59 +01:00
DECLARE_NAME_REF(Gfx, Graphics)
2024-06-09 12:20:04 +02:00
class Asset {
public:
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;
2024-06-09 12:20:04 +02:00
2023-07-31 21:43:20 +02:00
bool isModified() const;
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;
2024-06-09 12:20:04 +02:00
constexpr Status getStatus() { return status; }
constexpr void setStatus(Status _status) { status = _status; }
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