diff --git a/README.md b/README.md index f1d8073a..da51b273 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,9 @@ Loads a 2D texture array containing multiple 2D texture slices (each with its ow Generates a 3D texture on the cpu (using perlin noise), uploads it to the device and samples it to render an animation. 3D textures store volumetric data and interpolate in all three dimensions. -#### [11 - Model rendering](examples/mesh/) +#### [11 - glTF scene loading and rendering](examples/gltfscene/) -Loads a 3D model and texture maps from a common file format (using [assimp](https://github.com/assimp/assimp)), uploads the vertex and index buffer data to video memory, sets up a matching vertex layout and renders the 3D model. +Shows how to load the scene from a [glTF 2.0](https://github.com/KhronosGroup/glTF) file. The structure of the glTF 2.0 scene is converted into data structures required to render the scene with Vulkan. #### [12 - Input attachments](examples/inputattachments) diff --git a/android/examples/mesh/CMakeLists.txt b/android/examples/gltfscene/CMakeLists.txt similarity index 93% rename from android/examples/mesh/CMakeLists.txt rename to android/examples/gltfscene/CMakeLists.txt index d90f4fb8..6a77bb64 100644 --- a/android/examples/mesh/CMakeLists.txt +++ b/android/examples/gltfscene/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4.1 FATAL_ERROR) -set(NAME mesh) +set(NAME gltfscene) set(SRC_DIR ../../../examples/${NAME}) set(BASE_DIR ../../../base) @@ -24,6 +24,7 @@ include_directories(${EXTERNAL_DIR}/glm) include_directories(${EXTERNAL_DIR}/gli) include_directories(${EXTERNAL_DIR}/imgui) include_directories(${EXTERNAL_DIR}/assimp) +include_directories(${EXTERNAL_DIR}/tinygltf) include_directories(${ANDROID_NDK}/sources/android/native_app_glue) target_link_libraries( diff --git a/android/examples/mesh/build.gradle b/android/examples/gltfscene/build.gradle similarity index 83% rename from android/examples/mesh/build.gradle rename to android/examples/gltfscene/build.gradle index 55879332..64ab443d 100644 --- a/android/examples/mesh/build.gradle +++ b/android/examples/gltfscene/build.gradle @@ -4,7 +4,7 @@ apply from: '../gradle/outputfilename.gradle' android { compileSdkVersion 26 defaultConfig { - applicationId "de.saschawillems.vulkanMesh" + applicationId "de.saschawillems.vulkanglTFScene" minSdkVersion 19 targetSdkVersion 26 versionCode 1 @@ -49,14 +49,14 @@ task copyTask { } copy { - from '../../../data/shaders/mesh' - into 'assets/shaders/mesh' + from '../../../data/shaders/gltfscene' + into 'assets/shaders/gltfscene' include '*.*' } copy { - from '../../../data/models/voyager' - into 'assets/models/voyager' + from '../../../data/models/FlightHelmet/glTF' + into 'assets/models/FlightHelmet/glTF' include '*.*' } diff --git a/android/examples/mesh/src/main/AndroidManifest.xml b/android/examples/gltfscene/src/main/AndroidManifest.xml similarity index 90% rename from android/examples/mesh/src/main/AndroidManifest.xml rename to android/examples/gltfscene/src/main/AndroidManifest.xml index 4e24788b..2c6a3474 100644 --- a/android/examples/mesh/src/main/AndroidManifest.xml +++ b/android/examples/gltfscene/src/main/AndroidManifest.xml @@ -1,9 +1,9 @@ + package="de.saschawillems.vulkanglTFScene"> shaderStages = { - loadShader(getAssetPath() + "shaders/mesh/mesh.vert.spv", VK_SHADER_STAGE_VERTEX_BIT), - loadShader(getAssetPath() + "shaders/mesh/mesh.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT) + loadShader(getAssetPath() + "shaders/gltfscene/mesh.vert.spv", VK_SHADER_STAGE_VERTEX_BIT), + loadShader(getAssetPath() + "shaders/gltfscene/mesh.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT) }; VkGraphicsPipelineCreateInfo pipelineCI = vks::initializers::pipelineCreateInfo(pipelineLayout, renderPass, 0);