renamed model to mesh

This commit is contained in:
2026-09-08 22:48:59 -07:00
parent c211fffda1
commit 73d2121bc1
8 changed files with 41 additions and 42 deletions
+13 -13
View File
@@ -14,7 +14,7 @@
#include "buffer.hpp"
#include "device.hpp"
#include "model.hpp"
#include "mesh.hpp"
#include "pipelines/graphics_pipeline.hpp"
#include "render_context.hpp"
#include "shader.hpp"
@@ -183,7 +183,7 @@ class Application::Impl {
commandBuffer.setViewport(0, viewport);
commandBuffer.setScissor(0, scissor);
modelRenderSystem.render(commandBuffer, this->models, frameInfo);
modelRenderSystem.render(commandBuffer, this->meshes, frameInfo);
commandBuffer.endRendering();
@@ -205,23 +205,23 @@ class Application::Impl {
log::info("Application ran for", totalRuntime, "s");
}
void pushModel(std::vector<CanvasVertex> vertices, std::vector<u32> indices) {
Model::Builder builder{};
void pushMesh(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);
this->models.push_back(std::make_unique<Model>(this->device, builder));
this->meshes.push_back(std::make_unique<Mesh>(this->device, builder));
}
void clearModels() {
// Models back live GPU vertex buffers and up to MAX_FRAMES_IN_FLIGHT
void clearMeshes() {
// Meshes back live GPU vertex buffers and up to MAX_FRAMES_IN_FLIGHT
// command buffers may still be executing against them, so wait for the
// device to go idle before freeing anything.
this->device.waitIdle();
this->models.clear();
this->meshes.clear();
}
private:
@@ -231,7 +231,7 @@ class Application::Impl {
Device device;
RenderContext renderContext;
std::vector<std::unique_ptr<Model>> models;
std::vector<std::unique_ptr<Mesh>> meshes;
};
void Application::setCommandLineArgs(int argc, const char* const* argv) {
@@ -247,11 +247,11 @@ Application::~Application() = default;
void Application::run() { impl->run(); }
void Application::pushModel(std::vector<CanvasVertex> vertices,
std::vector<u32> indices) {
impl->pushModel(std::move(vertices), std::move(indices));
void Application::pushMesh(std::vector<CanvasVertex> vertices,
std::vector<u32> indices) {
impl->pushMesh(std::move(vertices), std::move(indices));
}
void Application::clearModels() { impl->clearModels(); }
void Application::clearMeshes() { impl->clearMeshes(); }
} // namespace sophia