small fix
This commit is contained in:
parent
4b82c32cb3
commit
5a2e309b41
@ -34,29 +34,17 @@ void NewResourcePack::gui()
|
|||||||
tmp.m_resources = this->m_resources;
|
tmp.m_resources = this->m_resources;
|
||||||
output(tmp);
|
output(tmp);
|
||||||
}catch(cereal::Exception e){
|
}catch(cereal::Exception e){
|
||||||
std::cerr << "WUT : " << e.what() << std::endl;
|
std::cerr << "Error while saving resource pack : " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ImGui::Button("Load resource pack"))
|
if(ImGui::Button("Load resource pack"))
|
||||||
{
|
{
|
||||||
// std::fstream file;
|
|
||||||
// file.open("data/" + m_name + ".pack", std::ios_base::in);
|
|
||||||
// ObjectLoader loader;
|
|
||||||
// loader.loadAscii(file);
|
|
||||||
// file.close();
|
|
||||||
// const std::vector<ResourcePack*>& packVec = loader.getObjects<ResourcePack>();
|
|
||||||
// for(ResourceInterface* res : m_resources)
|
|
||||||
// delete res;
|
|
||||||
// m_resources = packVec[0]->m_resources;
|
|
||||||
// delete packVec[0];
|
|
||||||
|
|
||||||
std::ifstream inputStream("data/"+m_name+".pack");
|
std::ifstream inputStream("data/"+m_name+".pack");
|
||||||
cereal::JSONInputArchive input(inputStream);
|
cereal::JSONInputArchive input(inputStream);
|
||||||
NewResourcePack tmp = NewResourcePack();
|
NewResourcePack tmp = NewResourcePack();
|
||||||
input(tmp);
|
input(tmp);
|
||||||
this->m_name = tmp.m_name;
|
this->m_name = tmp.m_name;
|
||||||
this->m_resources = tmp.m_resources;
|
this->m_resources = tmp.m_resources;
|
||||||
inputStream.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui::Button("Add a texture"))
|
if(ImGui::Button("Add a texture"))
|
||||||
@ -149,6 +137,7 @@ void TextureResource::destroy()
|
|||||||
void TextureResource::gui()
|
void TextureResource::gui()
|
||||||
{
|
{
|
||||||
char buf[1024] = {0};
|
char buf[1024] = {0};
|
||||||
|
// m_name = ResourceInterface::m_name;
|
||||||
strcpy(buf, m_path.c_str());
|
strcpy(buf, m_path.c_str());
|
||||||
if(ImGui::InputText("Image file", buf, 1024))
|
if(ImGui::InputText("Image file", buf, 1024))
|
||||||
m_path = buf;
|
m_path = buf;
|
||||||
|
@ -82,6 +82,9 @@ public:
|
|||||||
void gui();
|
void gui();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CEREAL_REGISTER_TYPE(TextureResource)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(ResourceInterface,TextureResource)
|
||||||
|
|
||||||
class MaterialResource : public ResourceInterface
|
class MaterialResource : public ResourceInterface
|
||||||
{
|
{
|
||||||
glm::vec3 m_albedo;
|
glm::vec3 m_albedo;
|
||||||
@ -126,9 +129,25 @@ public:
|
|||||||
void gui();
|
void gui();
|
||||||
};
|
};
|
||||||
|
|
||||||
CEREAL_REGISTER_TYPE(TextureResource)
|
template<class Archive>
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(ResourceInterface,TextureResource)
|
void serialize(Archive & archive,MaterialResource mat)
|
||||||
//CEREAL_REGISTER_TYPE(MaterialResource)
|
{
|
||||||
//CEREAL_REGISTER_POLYMORPHIC_RELATION(ResourceInterface,MaterialResource)
|
archive(CEREAL_NVP(mat.m_name),
|
||||||
|
CEREAL_NVP(mat.m_albedo),
|
||||||
|
CEREAL_NVP(mat.m_metallic),
|
||||||
|
CEREAL_NVP(mat.m_roughness),
|
||||||
|
CEREAL_NVP(mat.m_emission),
|
||||||
|
CEREAL_NVP(mat.m_opacity),
|
||||||
|
CEREAL_NVP(mat.m_albedoTexture),
|
||||||
|
CEREAL_NVP(mat.m_metallicTexture),
|
||||||
|
CEREAL_NVP(mat.m_roughnessTexture),
|
||||||
|
CEREAL_NVP(mat.m_emissionTexture),
|
||||||
|
CEREAL_NVP(mat.m_normalTexture),
|
||||||
|
CEREAL_NVP(mat.m_alphaMaskTexture));
|
||||||
|
}
|
||||||
|
|
||||||
|
CEREAL_REGISTER_TYPE(MaterialResource)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(ResourceInterface,MaterialResource)
|
||||||
|
|
||||||
|
|
||||||
#endif // NEWRESOURCEPACK_H
|
#endif // NEWRESOURCEPACK_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user