Huge changes for 3d

This commit is contained in:
2026-09-30 18:53:16 -07:00
parent cd2e80cfca
commit b5b0eb9497
53 changed files with 1313 additions and 457 deletions
+6 -12
View File
@@ -14,7 +14,7 @@ MeshHandle ResourceRegistryRef::load<Mesh>(const std::string& path) {
(void)path;
SOPHIA_ASSERT(false,
"Mesh::load(path) is not implemented yet - no model file "
"format is supported; build one via Mesh::Builder for now");
"format is supported; build a MeshData instead");
return MeshHandle{};
}
@@ -40,6 +40,8 @@ TextureHandle ResourceRegistryRef::load<Texture>(const std::string& path) {
template <>
void ResourceRegistryRef::release<Mesh>(MeshHandle handle) {
// Frames in flight may still be drawing it.
registry->device.waitIdle();
registry->meshPool.release(handle);
}
@@ -57,17 +59,9 @@ void ResourceRegistryRef::release<Texture>(TextureHandle handle) {
registry->texturePool.release(handle);
}
MeshHandle ResourceRegistryRef::createResource(
std::type_identity<Mesh>, std::vector<CanvasVertex> vertices,
std::vector<u32> indices) {
Mesh::Builder builder{};
builder.vertices.reserve(vertices.size());
for (const CanvasVertex& vertex : vertices) {
builder.vertices.push_back({vertex.position, vertex.color});
}
builder.indices = std::move(indices);
return registry->meshPool.create(registry->device, builder);
MeshHandle ResourceRegistryRef::createResource(std::type_identity<Mesh>,
const MeshData& data) {
return registry->meshPool.create(registry->device, data);
}
RenderTargetHandle ResourceRegistryRef::createResource(