Refactoring

This commit is contained in:
saschawillems 2017-02-11 09:44:22 +01:00
parent 9c6e30fdd6
commit 77646cf658

View file

@ -6,19 +6,19 @@
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
* *
* Summary: * Summary:
* Renders a scene made of multiple meshes with different materials and textures. * Renders a scene made of multiple parts with different materials and textures.
* *
* The example loads a scene made up of multiple meshes into one vertex and index buffer to only * The example loads a scene made up of multiple parts into one vertex and index buffer to only
* have one (big) memory allocation. In Vulkan it's advised to keep number of memory allocations * have one (big) memory allocation. In Vulkan it's advised to keep number of memory allocations
* down and try to allocate large blocks of memory at once instead of having many small allocations. * down and try to allocate large blocks of memory at once instead of having many small allocations.
* *
* Every mesh has a separate material and multiple descriptor sets (set = x layout qualifier in GLSL) * Every part has a separate material and multiple descriptor sets (set = x layout qualifier in GLSL)
* are used to bind a uniform buffer with global matrices and the mesh' material's sampler at once. * are used to bind a uniform buffer with global matrices and the part's material's sampler at once.
* *
* To demonstrate another way of passing data the example also uses push constants for passing * To demonstrate another way of passing data the example also uses push constants for passing
* material properties. * material properties.
* *
* Note that this example is just one way of rendering a scene made up of multiple meshes iin Vulkan. * Note that this example is just one way of rendering a scene made up of multiple parts in Vulkan.
*/ */
#include <stdio.h> #include <stdio.h>
@ -33,6 +33,11 @@
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/cimport.h>
#include <vulkan/vulkan.h> #include <vulkan/vulkan.h>
#include "vulkanexamplebase.h" #include "vulkanexamplebase.h"
#include "VulkanTexture.hpp" #include "VulkanTexture.hpp"
@ -77,7 +82,7 @@ struct SceneMaterial
}; };
// Stores per-mesh Vulkan resources // Stores per-mesh Vulkan resources
struct SceneMesh struct ScenePart
{ {
// Index of first index in the scene buffer // Index of first index in the scene buffer
uint32_t indexBase; uint32_t indexBase;
@ -393,7 +398,7 @@ public:
std::string assetPath = ""; std::string assetPath = "";
std::vector<SceneMaterial> materials; std::vector<SceneMaterial> materials;
std::vector<SceneMesh> meshes; std::vector<ScenePart> meshes;
// Shared ubo containing matrices used by all // Shared ubo containing matrices used by all
// materials and meshes // materials and meshes