Skip to content

Commit

Permalink
remove image part
Browse files Browse the repository at this point in the history
  • Loading branch information
coco875 committed Jan 10, 2025
1 parent adda2c4 commit 53db223
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 114 deletions.
1 change: 0 additions & 1 deletion src/resource/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Archive;

#define RESOURCE_FORMAT_BINARY 0
#define RESOURCE_FORMAT_XML 1
#define RESOURCE_FORMAT_IMG 2

struct ResourceInitData {
std::shared_ptr<Archive> Parent;
Expand Down
20 changes: 0 additions & 20 deletions src/resource/ResourceFactoryImg.cpp

This file was deleted.

11 changes: 0 additions & 11 deletions src/resource/ResourceFactoryImg.h

This file was deleted.

29 changes: 1 addition & 28 deletions src/resource/ResourceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,7 @@ std::shared_ptr<ResourceFactory> ResourceLoader::GetFactory(uint32_t format, std

std::shared_ptr<ResourceInitData> ResourceLoader::ReadResourceInitDataLegacy(const std::string& filePath,
std::shared_ptr<File> fileToLoad) {
if (stbi_info_from_memory((const uint8_t*)fileToLoad->Buffer->data(), fileToLoad->Buffer->size(), nullptr, nullptr,
nullptr) != 0) {
auto stream = std::make_shared<MemoryStream>(fileToLoad->Buffer);
auto binaryReader = std::make_shared<BinaryReader>(stream);

return ReadResourceInitDataPng(filePath, binaryReader);
} else if (fileToLoad->Buffer->at(0) == '<') { // Determine if file is binary or XML...
if (fileToLoad->Buffer->at(0) == '<') { // Determine if file is binary or XML...
// File is XML
// Read the xml document
auto stream = std::make_shared<MemoryStream>(fileToLoad->Buffer);
Expand Down Expand Up @@ -211,7 +205,6 @@ std::shared_ptr<IResource> ResourceLoader::LoadResource(std::string filePath, st

switch (initData->Format) {
case RESOURCE_FORMAT_BINARY:
case RESOURCE_FORMAT_IMG:
fileToLoad->Reader = CreateBinaryReader(fileToLoad, initData);
break;
case RESOURCE_FORMAT_XML:
Expand Down Expand Up @@ -295,24 +288,4 @@ ResourceLoader::ReadResourceInitDataXml(const std::string& filePath, std::shared

return resourceInitData;
}

std::shared_ptr<ResourceInitData> ResourceLoader::ReadResourceInitDataPng(const std::string& filePath,
std::shared_ptr<BinaryReader> headerReader) {
auto resourceInitData = CreateDefaultResourceInitData();
resourceInitData->Path = filePath;

if (headerReader == nullptr) {
SPDLOG_ERROR("Error reading OTR header from XML: No header buffer document for file {}", filePath);
return resourceInitData;
}

resourceInitData->IsCustom = true;
resourceInitData->Format = RESOURCE_FORMAT_IMG;
resourceInitData->Type =
Context::GetInstance()->GetResourceManager()->GetResourceLoader()->GetResourceType("Texture");
resourceInitData->ResourceVersion = 0;

headerReader->Seek(0, SeekOffsetType::Start);
return resourceInitData;
}
} // namespace Ship
42 changes: 0 additions & 42 deletions src/resource/factory/PngFactory.cpp

This file was deleted.

12 changes: 0 additions & 12 deletions src/resource/factory/PngFactory.h

This file was deleted.

0 comments on commit 53db223

Please sign in to comment.