- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset, Core/IO, and Resources/<Type> subdirectories - TEST_SPEC.md: Updated module names and test counts (852 total) - TEST_SPEC.md: Updated build commands for new Resources subdirectories - README.md: Updated engine structure with Core/Asset/ and Core/IO/ - README.md: Updated Resources section with layered architecture - README.md: Updated test coverage table with accurate counts
41 lines
913 B
C++
41 lines
913 B
C++
#include <XCEngine/Resources/Texture/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
|