refactor: reorganize Resources module into Core/Asset, Core/IO and Resources subdirectories
- Split core resource architecture into Core/Asset/ (IResource, ResourceManager, ResourceCache, etc.)
- Moved IO layer into Core/IO/ (IResourceLoader, ResourceFileSystem, etc.)
- Reorganized concrete resource types into Resources/{Texture,Mesh,Material,Shader,AudioClip}/
- Updated all include paths from relative to <XCEngine/...> format
- Fixed circular dependency in Material.h (removed unnecessary ResourceManager.h include)
- Fixed malformed include syntax in ResourceManager.h and AsyncLoader.h
- Fixed glad.h path issues in CMakeLists.txt
This commit is contained in:
40
engine/src/Resources/Texture/Texture.cpp
Normal file
40
engine/src/Resources/Texture/Texture.cpp
Normal 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
|
||||
Reference in New Issue
Block a user