Skip to content

Commit

Permalink
model loading working
Browse files Browse the repository at this point in the history
  • Loading branch information
WinteryFox committed Dec 4, 2023
1 parent 4508afd commit a158160
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/engine/vk/test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ int main() {
Assimp::Importer importer;
const auto& scene = importer.ReadFile("../../src/engine/vk/test/vikingroom.glb",
aiProcessPreset_TargetRealtime_Fast);
if (!scene)
if (nullptr == scene)
throw std::runtime_error("Failed to load model from file");

const auto& mesh = scene->mMeshes[0];
std::vector<Vertex> vertices{mesh->mNumVertices};
std::vector<Vertex> vertices(mesh->mNumVertices);
for (uint32_t i = 0; i < mesh->mNumVertices; i++) {
const auto& vertex = mesh->mVertices[i];
const auto& color = mesh->HasVertexColors(i) ? *mesh->mColors[i] : aiColor4D{1.0f, 1.0f, 1.0f, 1.0f};
Expand All @@ -99,9 +99,9 @@ int main() {
};
}

std::vector indices{mesh->mNumFaces * 3};
std::vector<uint32_t> indices(mesh->mNumFaces * 3);
for (uint32_t i = 0; i < mesh->mNumFaces; i++) {
const auto& face = mesh->mFaces[i];
const auto &face = mesh->mFaces[i];
if (face.mNumIndices != 3) {
spdlog::warn("Skipping face with {} indices", face.mNumIndices);
continue;
Expand Down

0 comments on commit a158160

Please sign in to comment.