- 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
45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
#include <XCEngine/Resources/Mesh/Mesh.h>
|
|
#include <cstring>
|
|
|
|
namespace XCEngine {
|
|
namespace Resources {
|
|
|
|
Mesh::Mesh() = default;
|
|
Mesh::~Mesh() = default;
|
|
|
|
void Mesh::Release() {
|
|
m_vertexData.Clear();
|
|
m_indexData.Clear();
|
|
m_sections.Clear();
|
|
SetInvalid();
|
|
}
|
|
|
|
void Mesh::SetVertexData(const void* data, size_t size, Core::uint32 vertexCount,
|
|
Core::uint32 vertexStride, VertexAttribute attributes) {
|
|
m_vertexCount = vertexCount;
|
|
m_vertexStride = vertexStride;
|
|
m_attributes = attributes;
|
|
|
|
m_vertexData.Resize(size);
|
|
std::memcpy(m_vertexData.Data(), data, size);
|
|
|
|
m_memorySize += size;
|
|
}
|
|
|
|
void Mesh::SetIndexData(const void* data, size_t size, Core::uint32 indexCount, bool use32Bit) {
|
|
m_indexCount = indexCount;
|
|
m_use32BitIndex = use32Bit;
|
|
|
|
m_indexData.Resize(size);
|
|
std::memcpy(m_indexData.Data(), data, size);
|
|
|
|
m_memorySize += size;
|
|
}
|
|
|
|
void Mesh::AddSection(const MeshSection& section) {
|
|
m_sections.PushBack(section);
|
|
}
|
|
|
|
} // namespace Resources
|
|
} // namespace XCEngine
|