From e9cafd079e7d379bcacca8b99d334a7c008e0507 Mon Sep 17 00:00:00 2001 From: Trevor Hollmann <thollmann@uni-koblenz.de> Date: Fri, 28 May 2021 08:05:08 +0200 Subject: [PATCH] [#26] Update TODO comments and fix some formatting. --- .../asset_loader/include/vkcv/asset/asset_loader.hpp | 10 +++++++--- modules/asset_loader/src/vkcv/asset/asset_loader.cpp | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/asset_loader/include/vkcv/asset/asset_loader.hpp b/modules/asset_loader/include/vkcv/asset/asset_loader.hpp index c677f600..8d255143 100644 --- a/modules/asset_loader/include/vkcv/asset/asset_loader.hpp +++ b/modules/asset_loader/include/vkcv/asset/asset_loader.hpp @@ -24,7 +24,7 @@ * top. * * Each Mesh has an array of one or more vertex groups (called "primitives" in - * glFW parlance) and an array of zero or more Materials. + * glTF parlance) and an array of zero or more Materials. * * Each vertex group describes a part of the meshes vertices by defining how * they should be rendered (as points, lines, triangles), how many indices and @@ -43,8 +43,12 @@ namespace vkcv::asset { -// enum matches modes in fx-gltf, the library returns a standard mode (TRIANGLES) if no mode is given in the file -enum PrimitiveMode { POINTS=0, LINES, LINELOOP, LINESTRIP, TRIANGLES, TRIANGLESTRIP, TRIANGLEFAN }; +/* This enum matches modes in fx-gltf, the library returns a standard mode + * (TRIANGLES) if no mode is given in the file. */ +enum PrimitiveMode { + POINTS=0, LINES, LINELOOP, LINESTRIP, TRIANGLES, TRIANGLESTRIP, + TRIANGLEFAN +}; /* With these enums, 0 is reserved to signal uninitialized or invalid data. */ enum PrimitiveType { POSITION=1, NORMAL, TEXCOORD_0 }; /* The indices in the index buffer can be of different bit width. */ diff --git a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp index 0a5f3527..6fe0da62 100644 --- a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp +++ b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp @@ -11,6 +11,9 @@ namespace vkcv::asset { * @param type * @return unsigned integer representation */ +// TODO Return proper error code (we need to define those as macros or enums, +// will discuss during the next core meeting if that should happen on the scope +// of the vkcv framework or just this module) uint8_t convertTypeToInt(const fx::gltf::Accessor::Type type) { switch (type) { case fx::gltf::Accessor::Type::None : @@ -63,11 +66,15 @@ int loadMesh(const std::string &path, Mesh &mesh) { return 0; } - // XXX Temporary restriction: Only one mesh per glTF file + // TODO Temporary restriction: Only one mesh per glTF file allowed + // currently. Later, we want to support whole scenes with more than + // just meshes. if (object.meshes.size() != 1) return 0; fx::gltf::Mesh const &objectMesh = object.meshes[0]; - // TODO We want to support more than one vertex group eventually... + // TODO We want to support more than one vertex group per mesh + // eventually... right now this is hard-coded to use only the first one + // because we only care about the example triangle and cube fx::gltf::Primitive const &objectPrimitive = objectMesh.primitives[0]; fx::gltf::Accessor posAccessor; -- GitLab