feat: 完成资源系统导入设置类实现
- 新增 ImportSettings 基类 - 新增 TextureImportSettings 纹理导入设置类 - 新增 MeshImportSettings 网格导入设置类 - 新增 ResourcePath 资源路径类 - 完善 CMakeLists.txt 配置 - 新增对应单元测试 (45个测试用例)
This commit is contained in:
@@ -167,10 +167,13 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourceManager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourceCache.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/AsyncLoader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ImportSettings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/Texture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/Mesh.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/TextureLoader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/TextureImportSettings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/MeshLoader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/MeshImportSettings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/Material.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/MaterialLoader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/Shader.h
|
||||
@@ -179,6 +182,9 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/AudioLoader.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourceFileSystem.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/FileArchive.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourcePackage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourceDependencyGraph.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourcePath.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ResourceManager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ResourceCache.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/AsyncLoader.cpp
|
||||
@@ -187,7 +193,9 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/Texture.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/Mesh.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/TextureLoader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/TextureImportSettings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/MeshLoader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/MeshImportSettings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/Material.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/MaterialLoader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/Shader.cpp
|
||||
@@ -198,9 +206,7 @@ add_library(XCEngine STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/FileArchive.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ResourcePackage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ResourceDependencyGraph.cpp
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourcePackage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/XCEngine/Resources/ResourceDependencyGraph.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/Resources/ResourcePath.cpp
|
||||
)
|
||||
|
||||
target_include_directories(XCEngine PUBLIC
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "IResourceLoader.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "../Containers/Array.h"
|
||||
#include "../Threading/Mutex.h"
|
||||
#include <atomic>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "IResource.h"
|
||||
#include "ResourceTypes.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "../Containers/String.h"
|
||||
#include "../Containers/Array.h"
|
||||
#include <functional>
|
||||
|
||||
19
engine/include/XCEngine/Resources/ImportSettings.h
Normal file
19
engine/include/XCEngine/Resources/ImportSettings.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Core/SmartPtr.h"
|
||||
#include "ResourceTypes.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
class ImportSettings {
|
||||
public:
|
||||
virtual ~ImportSettings() = default;
|
||||
|
||||
virtual Core::UniqueRef<ImportSettings> Clone() const = 0;
|
||||
virtual bool LoadFromJSON(const Containers::String& json) { return false; }
|
||||
virtual Containers::String SaveToJSON() const { return Containers::String(); }
|
||||
};
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
85
engine/include/XCEngine/Resources/MeshImportSettings.h
Normal file
85
engine/include/XCEngine/Resources/MeshImportSettings.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "ImportSettings.h"
|
||||
#include "Mesh.h"
|
||||
#include "../Math/Vector3.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
enum class MeshImportFlags : Core::uint32 {
|
||||
None = 0,
|
||||
FlipUVs = 1 << 0,
|
||||
FlipWindingOrder = 1 << 1,
|
||||
GenerateNormals = 1 << 2,
|
||||
GenerateTangents = 1 << 3,
|
||||
OptimizeMesh = 1 << 4,
|
||||
ImportSkinning = 1 << 5,
|
||||
ImportAnimations = 1 << 6,
|
||||
ImportMaterials = 1 << 7,
|
||||
ImportCameras = 1 << 8,
|
||||
ImportLights = 1 << 9
|
||||
};
|
||||
|
||||
inline MeshImportFlags operator|(MeshImportFlags a, MeshImportFlags b) {
|
||||
return static_cast<MeshImportFlags>(static_cast<Core::uint32>(a) | static_cast<Core::uint32>(b));
|
||||
}
|
||||
|
||||
inline MeshImportFlags operator&(MeshImportFlags a, MeshImportFlags b) {
|
||||
return static_cast<MeshImportFlags>(static_cast<Core::uint32>(a) & static_cast<Core::uint32>(b));
|
||||
}
|
||||
|
||||
inline MeshImportFlags operator~(MeshImportFlags a) {
|
||||
return static_cast<MeshImportFlags>(~static_cast<Core::uint32>(a));
|
||||
}
|
||||
|
||||
class MeshImportSettings : public ImportSettings {
|
||||
public:
|
||||
MeshImportSettings();
|
||||
virtual ~MeshImportSettings() override;
|
||||
|
||||
Core::UniqueRef<ImportSettings> Clone() const override;
|
||||
bool LoadFromJSON(const Containers::String& json) override;
|
||||
Containers::String SaveToJSON() const override;
|
||||
|
||||
void SetImportFlags(MeshImportFlags flags) { m_importFlags = flags; }
|
||||
MeshImportFlags GetImportFlags() const { return m_importFlags; }
|
||||
|
||||
void AddImportFlag(MeshImportFlags flag) { m_importFlags = static_cast<MeshImportFlags>(static_cast<Core::uint32>(m_importFlags) | static_cast<Core::uint32>(flag)); }
|
||||
void RemoveImportFlag(MeshImportFlags flag) { m_importFlags = static_cast<MeshImportFlags>(static_cast<Core::uint32>(m_importFlags) & ~static_cast<Core::uint32>(flag)); }
|
||||
bool HasImportFlag(MeshImportFlags flag) const { return (static_cast<Core::uint32>(m_importFlags) & static_cast<Core::uint32>(flag)) != 0; }
|
||||
|
||||
void SetScale(float scale) { m_scale = scale; }
|
||||
float GetScale() const { return m_scale; }
|
||||
|
||||
void SetOffset(const Math::Vector3& offset) { m_offset = offset; }
|
||||
const Math::Vector3& GetOffset() const { return m_offset; }
|
||||
|
||||
void SetAxisConversion(bool convert) { m_axisConversion = convert; }
|
||||
bool GetAxisConversion() const { return m_axisConversion; }
|
||||
|
||||
void SetMergeMeshes(bool merge) { m_mergeMeshes = merge; }
|
||||
bool GetMergeMeshes() const { return m_mergeMeshes; }
|
||||
|
||||
void SetOptimizeThreshold(float threshold) { m_optimizeThreshold = threshold; }
|
||||
float GetOptimizeThreshold() const { return m_optimizeThreshold; }
|
||||
|
||||
void SetImportScale(float scale) { m_importScale = scale; }
|
||||
float GetImportScale() const { return m_importScale; }
|
||||
|
||||
void SetThreshold(float threshold) { m_threshold = threshold; }
|
||||
float GetThreshold() const { return m_threshold; }
|
||||
|
||||
private:
|
||||
MeshImportFlags m_importFlags = MeshImportFlags::None;
|
||||
float m_scale = 1.0f;
|
||||
Math::Vector3 m_offset = Math::Vector3::Zero();
|
||||
bool m_axisConversion = true;
|
||||
bool m_mergeMeshes = false;
|
||||
float m_optimizeThreshold = 0.3f;
|
||||
float m_importScale = 1.0f;
|
||||
float m_threshold = 0.0f;
|
||||
};
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "ResourceCache.h"
|
||||
#include "AsyncLoader.h"
|
||||
#include "ResourceHandle.h"
|
||||
#include "ImportSettings.h"
|
||||
#include "../Containers/String.h"
|
||||
#include "../Containers/Array.h"
|
||||
#include "../Containers/HashMap.h"
|
||||
|
||||
46
engine/include/XCEngine/Resources/ResourcePath.h
Normal file
46
engine/include/XCEngine/Resources/ResourcePath.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "ResourceTypes.h"
|
||||
#include "../Containers/String.h"
|
||||
#include "../Containers/Array.h"
|
||||
#include "../Core/Types.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
class ResourcePath {
|
||||
public:
|
||||
ResourcePath() = default;
|
||||
ResourcePath(const char* path);
|
||||
ResourcePath(const Containers::String& path);
|
||||
|
||||
Containers::String GetExtension() const;
|
||||
|
||||
Containers::String GetStem() const;
|
||||
|
||||
Containers::String GetFullPath() const;
|
||||
|
||||
Containers::String GetFileName() const;
|
||||
|
||||
Containers::String GetDirectory() const;
|
||||
|
||||
Containers::String GetRelativePath() const;
|
||||
|
||||
ResourceGUID ToGUID() const;
|
||||
|
||||
bool HasExtension(const char* ext) const;
|
||||
|
||||
bool HasAnyExtension(const char* const* extensions, Core::uint32 count) const;
|
||||
|
||||
bool IsValid() const { return !m_path.Empty(); }
|
||||
|
||||
const Containers::String& GetPath() const { return m_path; }
|
||||
|
||||
void SetPath(const Containers::String& path) { m_path = path; }
|
||||
|
||||
private:
|
||||
Containers::String m_path;
|
||||
};
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
@@ -90,14 +90,5 @@ template<> inline ResourceType GetResourceType<class Shader>() { return Resource
|
||||
template<> inline ResourceType GetResourceType<class AudioClip>() { return ResourceType::AudioClip; }
|
||||
template<> inline ResourceType GetResourceType<class BinaryResource>() { return ResourceType::Binary; }
|
||||
|
||||
class ImportSettings {
|
||||
public:
|
||||
virtual ~ImportSettings() = default;
|
||||
|
||||
virtual Core::UniqueRef<ImportSettings> Clone() const = 0;
|
||||
virtual bool LoadFromJSON(const Containers::String& json) { return false; }
|
||||
virtual Containers::String SaveToJSON() const { return Containers::String(); }
|
||||
};
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
|
||||
#include "Texture.h"
|
||||
#include "TextureLoader.h"
|
||||
#include "TextureImportSettings.h"
|
||||
#include "Mesh.h"
|
||||
#include "MeshLoader.h"
|
||||
#include "MeshImportSettings.h"
|
||||
#include "Material.h"
|
||||
#include "MaterialLoader.h"
|
||||
#include "Shader.h"
|
||||
@@ -24,6 +26,7 @@
|
||||
#include "ResourceFileSystem.h"
|
||||
#include "FileArchive.h"
|
||||
#include "ResourcePackage.h"
|
||||
#include "ResourcePath.h"
|
||||
|
||||
// Forward declarations for concrete resource types
|
||||
namespace XCEngine {
|
||||
|
||||
91
engine/include/XCEngine/Resources/TextureImportSettings.h
Normal file
91
engine/include/XCEngine/Resources/TextureImportSettings.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include "ImportSettings.h"
|
||||
#include "Texture.h"
|
||||
#include "../Math/Vector3.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
enum class MipmapFilter {
|
||||
Box,
|
||||
Kaiser
|
||||
};
|
||||
|
||||
enum class CompressionQuality {
|
||||
Low,
|
||||
Medium,
|
||||
High,
|
||||
Ultra
|
||||
};
|
||||
|
||||
class TextureImportSettings : public ImportSettings {
|
||||
public:
|
||||
TextureImportSettings();
|
||||
virtual ~TextureImportSettings() override;
|
||||
|
||||
Core::UniqueRef<ImportSettings> Clone() const override;
|
||||
bool LoadFromJSON(const Containers::String& json) override;
|
||||
Containers::String SaveToJSON() const override;
|
||||
|
||||
void SetTextureType(TextureType type) { m_textureType = type; }
|
||||
TextureType GetTextureType() const { return m_textureType; }
|
||||
|
||||
void SetTargetFormat(TextureFormat format) { m_targetFormat = format; }
|
||||
TextureFormat GetTargetFormat() const { return m_targetFormat; }
|
||||
|
||||
void SetGenerateMipmaps(bool generate) { m_generateMipmaps = generate; }
|
||||
bool GetGenerateMipmaps() const { return m_generateMipmaps; }
|
||||
|
||||
void SetMipmapFilter(MipmapFilter filter) { m_mipmapFilter = filter; }
|
||||
MipmapFilter GetMipmapFilter() const { return m_mipmapFilter; }
|
||||
|
||||
void SetMaxAnisotropy(Core::uint32 anisotropy) { m_maxAnisotropy = anisotropy; }
|
||||
Core::uint32 GetMaxAnisotropy() const { return m_maxAnisotropy; }
|
||||
|
||||
void SetSRGB(bool srgb) { m_sRGB = srgb; }
|
||||
bool GetSRGB() const { return m_sRGB; }
|
||||
|
||||
void SetFlipVertical(bool flip) { m_flipVertical = flip; }
|
||||
bool GetFlipVertical() const { return m_flipVertical; }
|
||||
|
||||
void SetFlipHorizontal(bool flip) { m_flipHorizontal = flip; }
|
||||
bool GetFlipHorizontal() const { return m_flipHorizontal; }
|
||||
|
||||
void SetBorderColor(const Math::Vector3& color) { m_borderColor = color; }
|
||||
const Math::Vector3& GetBorderColor() const { return m_borderColor; }
|
||||
|
||||
void SetCompressionQuality(CompressionQuality quality) { m_compressionQuality = quality; }
|
||||
CompressionQuality GetCompressionQuality() const { return m_compressionQuality; }
|
||||
|
||||
void SetUseHardwareCompression(bool use) { m_useHardwareCompression = use; }
|
||||
bool GetUseHardwareCompression() const { return m_useHardwareCompression; }
|
||||
|
||||
void SetMaxSize(Core::uint32 size) { m_maxSize = size; }
|
||||
Core::uint32 GetMaxSize() const { return m_maxSize; }
|
||||
|
||||
void SetGenerateNormalMap(bool generate) { m_generateNormalMap = generate; }
|
||||
bool GetGenerateNormalMap() const { return m_generateNormalMap; }
|
||||
|
||||
void SetNormalMapStrength(float strength) { m_normalMapStrength = strength; }
|
||||
float GetNormalMapStrength() const { return m_normalMapStrength; }
|
||||
|
||||
private:
|
||||
TextureType m_textureType = TextureType::Texture2D;
|
||||
TextureFormat m_targetFormat = TextureFormat::Unknown;
|
||||
bool m_generateMipmaps = true;
|
||||
MipmapFilter m_mipmapFilter = MipmapFilter::Box;
|
||||
Core::uint32 m_maxAnisotropy = 16;
|
||||
bool m_sRGB = false;
|
||||
bool m_flipVertical = false;
|
||||
bool m_flipHorizontal = false;
|
||||
Math::Vector3 m_borderColor = Math::Vector3::Zero();
|
||||
CompressionQuality m_compressionQuality = CompressionQuality::High;
|
||||
bool m_useHardwareCompression = true;
|
||||
Core::uint32 m_maxSize = 0;
|
||||
bool m_generateNormalMap = false;
|
||||
float m_normalMapStrength = 1.0f;
|
||||
};
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
23
engine/src/Resources/MeshImportSettings.cpp
Normal file
23
engine/src/Resources/MeshImportSettings.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <XCEngine/Resources/MeshImportSettings.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
MeshImportSettings::MeshImportSettings() = default;
|
||||
|
||||
MeshImportSettings::~MeshImportSettings() = default;
|
||||
|
||||
Core::UniqueRef<ImportSettings> MeshImportSettings::Clone() const {
|
||||
return Core::UniqueRef<ImportSettings>(new MeshImportSettings(*this));
|
||||
}
|
||||
|
||||
bool MeshImportSettings::LoadFromJSON(const Containers::String& json) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Containers::String MeshImportSettings::SaveToJSON() const {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
136
engine/src/Resources/ResourcePath.cpp
Normal file
136
engine/src/Resources/ResourcePath.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
#include <XCEngine/Resources/ResourcePath.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
static size_t FindLastOf(const Containers::String& str, char ch) {
|
||||
for (size_t i = str.Length(); i > 0; --i) {
|
||||
if (str[i - 1] == ch) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
return Containers::String::npos;
|
||||
}
|
||||
|
||||
ResourcePath::ResourcePath(const char* path)
|
||||
: m_path(path) {}
|
||||
|
||||
ResourcePath::ResourcePath(const Containers::String& path)
|
||||
: m_path(path) {}
|
||||
|
||||
Containers::String ResourcePath::GetExtension() const {
|
||||
if (m_path.Empty()) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
size_t dotPos = FindLastOf(m_path, '.');
|
||||
if (dotPos == Containers::String::npos) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
return m_path.Substring(dotPos);
|
||||
}
|
||||
|
||||
Containers::String ResourcePath::GetStem() const {
|
||||
if (m_path.Empty()) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
size_t slashPos = FindLastOf(m_path, '/');
|
||||
size_t backslashPos = FindLastOf(m_path, '\\');
|
||||
size_t nameStart = (slashPos != Containers::String::npos && backslashPos != Containers::String::npos)
|
||||
? std::max(slashPos, backslashPos)
|
||||
: (slashPos != Containers::String::npos ? slashPos : backslashPos);
|
||||
|
||||
if (nameStart == Containers::String::npos) {
|
||||
nameStart = 0;
|
||||
} else {
|
||||
nameStart += 1;
|
||||
}
|
||||
|
||||
size_t dotPos = FindLastOf(m_path, '.');
|
||||
if (dotPos == Containers::String::npos || dotPos < nameStart) {
|
||||
return m_path.Substring(nameStart);
|
||||
}
|
||||
|
||||
return m_path.Substring(nameStart, dotPos - nameStart);
|
||||
}
|
||||
|
||||
Containers::String ResourcePath::GetFullPath() const {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
Containers::String ResourcePath::GetFileName() const {
|
||||
if (m_path.Empty()) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
size_t slashPos = FindLastOf(m_path, '/');
|
||||
size_t backslashPos = FindLastOf(m_path, '\\');
|
||||
size_t nameStart = (slashPos != Containers::String::npos && backslashPos != Containers::String::npos)
|
||||
? std::max(slashPos, backslashPos)
|
||||
: (slashPos != Containers::String::npos ? slashPos : backslashPos);
|
||||
|
||||
if (nameStart == Containers::String::npos) {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
return m_path.Substring(nameStart + 1);
|
||||
}
|
||||
|
||||
Containers::String ResourcePath::GetDirectory() const {
|
||||
if (m_path.Empty()) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
size_t slashPos = FindLastOf(m_path, '/');
|
||||
size_t backslashPos = FindLastOf(m_path, '\\');
|
||||
size_t dirEnd = (slashPos != Containers::String::npos && backslashPos != Containers::String::npos)
|
||||
? std::max(slashPos, backslashPos)
|
||||
: (slashPos != Containers::String::npos ? slashPos : backslashPos);
|
||||
|
||||
if (dirEnd == Containers::String::npos) {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
return m_path.Substring(0, dirEnd);
|
||||
}
|
||||
|
||||
Containers::String ResourcePath::GetRelativePath() const {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
ResourceGUID ResourcePath::ToGUID() const {
|
||||
return ResourceGUID::Generate(m_path);
|
||||
}
|
||||
|
||||
bool ResourcePath::HasExtension(const char* ext) const {
|
||||
if (!ext || m_path.Empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Containers::String pathExt = GetExtension();
|
||||
if (pathExt.Empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return pathExt == ext;
|
||||
}
|
||||
|
||||
bool ResourcePath::HasAnyExtension(const char* const* extensions, Core::uint32 count) const {
|
||||
if (!extensions || count == 0 || m_path.Empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Core::uint32 i = 0; i < count; ++i) {
|
||||
if (HasExtension(extensions[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
23
engine/src/Resources/TextureImportSettings.cpp
Normal file
23
engine/src/Resources/TextureImportSettings.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <XCEngine/Resources/TextureImportSettings.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Resources {
|
||||
|
||||
TextureImportSettings::TextureImportSettings() = default;
|
||||
|
||||
TextureImportSettings::~TextureImportSettings() = default;
|
||||
|
||||
Core::UniqueRef<ImportSettings> TextureImportSettings::Clone() const {
|
||||
return Core::UniqueRef<ImportSettings>(new TextureImportSettings(*this));
|
||||
}
|
||||
|
||||
bool TextureImportSettings::LoadFromJSON(const Containers::String& json) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Containers::String TextureImportSettings::SaveToJSON() const {
|
||||
return Containers::String();
|
||||
}
|
||||
|
||||
} // namespace Resources
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user