From e0c15f62da6361ec862b870dbb005dd6c8118b4c Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 19 Apr 2020 11:50:46 +0200 Subject: [PATCH] Renamed mesh example to glTF scene --- README.md | 4 ++-- android/examples/{mesh => gltfscene}/CMakeLists.txt | 3 ++- android/examples/{mesh => gltfscene}/build.gradle | 10 +++++----- .../src/main/AndroidManifest.xml | 4 ++-- .../saschawillems/vulkanSample/VulkanActivity.java | 0 data/shaders/{mesh => gltfscene}/mesh.frag | 0 data/shaders/{mesh => gltfscene}/mesh.frag.spv | Bin data/shaders/{mesh => gltfscene}/mesh.vert | 0 data/shaders/{mesh => gltfscene}/mesh.vert.spv | Bin data/shaders/mesh/generate-spirv.bat | 2 -- examples/CMakeLists.txt | 2 +- examples/{mesh/mesh.cpp => gltfscene/gltfscene.cpp} | 5 +++-- 12 files changed, 15 insertions(+), 15 deletions(-) rename android/examples/{mesh => gltfscene}/CMakeLists.txt (93%) rename android/examples/{mesh => gltfscene}/build.gradle (83%) rename android/examples/{mesh => gltfscene}/src/main/AndroidManifest.xml (90%) rename android/examples/{mesh => gltfscene}/src/main/java/de/saschawillems/vulkanSample/VulkanActivity.java (100%) rename data/shaders/{mesh => gltfscene}/mesh.frag (100%) rename data/shaders/{mesh => gltfscene}/mesh.frag.spv (100%) rename data/shaders/{mesh => gltfscene}/mesh.vert (100%) rename data/shaders/{mesh => gltfscene}/mesh.vert.spv (100%) delete mode 100644 data/shaders/mesh/generate-spirv.bat rename examples/{mesh/mesh.cpp => gltfscene/gltfscene.cpp} (99%) 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);