feat: Implement resource system Phase 2 - Concrete resource types

- Add Material class with shader/texture bindings and property system
- Add MaterialLoader for .mat/.json format
- Add Shader class (Vertex/Fragment/Geometry/Compute)
- Add ShaderLoader for .vert/.frag/.glsl/.hlsl
- Add AudioClip class (WAV/OGG/MP3/FLAC support)
- Add AudioLoader for audio files
- Add Texture/Mesh classes and loaders (from design doc)
- Fix HashMap iterator and String API usage
- Fix Mutex compatibility with std::lock_guard
- Update CMakeLists.txt with new resource files
- All tests pass: 11 Resources + 51 Containers
This commit is contained in:
2026-03-17 22:32:27 +08:00
parent 05c879a818
commit 4710e6ba60
33 changed files with 1339 additions and 47 deletions

View File

@@ -0,0 +1,40 @@
#include "Resources/Texture.h"
#include <cstring>
namespace XCEngine {
namespace Resources {
Texture::Texture() = default;
Texture::~Texture() = default;
void Texture::Release() {
m_pixelData.Clear();
SetInvalid();
}
bool Texture::Create(Core::uint32 width, Core::uint32 height, Core::uint32 depth,
Core::uint32 mipLevels, TextureType type, TextureFormat format,
const void* data, size_t dataSize) {
m_width = width;
m_height = height;
m_depth = depth;
m_mipLevels = mipLevels;
m_textureType = type;
m_format = format;
if (data && dataSize > 0) {
m_pixelData.Resize(dataSize);
std::memcpy(m_pixelData.Data(), data, dataSize);
}
m_memorySize = dataSize;
return true;
}
bool Texture::GenerateMipmaps() {
return false;
}
} // namespace Resources
} // namespace XCEngine