You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
/******************************************************************************
|
|
* File - image.cpp
|
|
* Author - Joey Pollack
|
|
* Date - 2022/11/28 (y/m/d)
|
|
* Mod Date - 2022/11/28 (y/m/d)
|
|
* Description - The editor warpper for an Image asset
|
|
******************************************************************************/
|
|
|
|
#include "image.h"
|
|
#include <renderer/texture.h>
|
|
#include <utils/logger.h>
|
|
#include <editor/editor_helpers.h>
|
|
|
|
namespace lunarium { namespace editor {
|
|
|
|
Image::Image()
|
|
: EditorAsset(AssetType::EATYPE_IMAGE), mpImage(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
lunarium::Texture* Image::GetImage() const
|
|
{
|
|
return mpImage;
|
|
}
|
|
|
|
|
|
bool Image::DrawProperties()
|
|
{
|
|
|
|
return false;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
// SERIALIZATION
|
|
/////////////////////////////////////////////////////////////////////
|
|
OpRes Image::LoadRawFile()
|
|
{
|
|
mpImage = FileLoaders::LoadImage(mAssetDir / GetFileLocation());
|
|
mpImage->FlipVertically();
|
|
if (!mpImage)
|
|
{
|
|
return OpRes::Fail("Could not load image file: %s", GetFileLocation().string().c_str());
|
|
}
|
|
|
|
return OpRes::OK();
|
|
}
|
|
|
|
OpRes Image::Serialize(nlohmann::ordered_json& node)
|
|
{
|
|
|
|
|
|
return OpRes::OK();
|
|
}
|
|
|
|
OpRes Image::Deserialize(nlohmann::ordered_json& node)
|
|
{
|
|
LoadRawFile();
|
|
return OpRes::OK();
|
|
}
|
|
|
|
bool Image::IsValidNode(nlohmann::ordered_json& node)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
nlohmann::ordered_json Image::AsJSON()
|
|
{
|
|
return nlohmann::ordered_json();
|
|
}
|
|
|
|
}} |