diff --git a/data/shaders/gltfskinning/mesh.frag b/data/shaders/gltfskinning/skinnedmodel.frag similarity index 100% rename from data/shaders/gltfskinning/mesh.frag rename to data/shaders/gltfskinning/skinnedmodel.frag diff --git a/data/shaders/gltfskinning/mesh.frag.spv b/data/shaders/gltfskinning/skinnedmodel.frag.spv similarity index 100% rename from data/shaders/gltfskinning/mesh.frag.spv rename to data/shaders/gltfskinning/skinnedmodel.frag.spv diff --git a/data/shaders/gltfskinning/mesh.vert b/data/shaders/gltfskinning/skinnedmodel.vert similarity index 100% rename from data/shaders/gltfskinning/mesh.vert rename to data/shaders/gltfskinning/skinnedmodel.vert diff --git a/data/shaders/gltfskinning/mesh.vert.spv b/data/shaders/gltfskinning/skinnedmodel.vert.spv similarity index 100% rename from data/shaders/gltfskinning/mesh.vert.spv rename to data/shaders/gltfskinning/skinnedmodel.vert.spv diff --git a/examples/gltfskinning/gltfskinning.h b/examples/gltfskinning/gltfskinning.h index fa28716c..abc44af3 100644 --- a/examples/gltfskinning/gltfskinning.h +++ b/examples/gltfskinning/gltfskinning.h @@ -56,23 +56,16 @@ public: vks::VulkanDevice* vulkanDevice; VkQueue copyQueue; - struct Vertex { - glm::vec3 pos; - glm::vec3 normal; - glm::vec2 uv; - glm::vec3 color; - // Contains indices of the joints that effect this vertex - glm::vec4 jointIndices; - // Contains the weights that define how strongly this vertex is affected by above joints - glm::vec4 jointWeights; - }; + /* + Base glTF structures, see gltfscene sample for details + */ - struct { + struct Vertices { VkBuffer buffer; VkDeviceMemory memory; } vertices; - struct { + struct Indices { int count; VkBuffer buffer; VkDeviceMemory memory; @@ -120,15 +113,28 @@ public: glm::mat4 getLocalMatrix(); }; - // A skin contains the joints and matrices applied during vertex skinning - // @todo: Add link to spec + struct Vertex { + glm::vec3 pos; + glm::vec3 normal; + glm::vec2 uv; + glm::vec3 color; + // Contains indices of the joints that effect this vertex + glm::vec4 jointIndices; + // Contains the weights that define how strongly this vertex is affected by above joints + glm::vec4 jointWeights; + }; + + /* + Skin structure + Spec: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins + */ + struct Skin { std::string name; Node* skeletonRoot = nullptr; std::vector inverseBindMatrices; std::vector joints; - // POI: Store joint matrices in an SSBO - // @todo: proper comment + // The join matrices for this skin are stored in an shader storage buffer std::vector jointMatrices; vks::Buffer ssbo; VkDescriptorSet descriptorSet; @@ -136,29 +142,22 @@ public: /* - glTF animation channel - // @todo: Comment + Animation related structures + Spec: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations */ + struct AnimationChannel { std::string path; Node* node; uint32_t samplerIndex; }; - /* - glTF animation sampler - // @todo: Comment - */ struct AnimationSampler { std::string interpolation; std::vector inputs; std::vector outputsVec4; }; - /* - glTF animation - // @todo: Comment - */ struct Animation { std::string name; std::vector samplers; @@ -172,21 +171,9 @@ public: std::vector textures; std::vector materials; std::vector nodes; - - // Store skins and animations std::vector skins; std::vector animations; - // POI: @todo: document - struct MeshData { - glm::mat4 jointMatrix[32]{}; - }; - struct ShaderData { - vks::Buffer buffer; - } shaderData; - VkDescriptorSet descriptorSet; - std::vector meshdata; - uint32_t activeAnimation = 0; ~VulkanglTFModel();