Renamed mesh example to glTF scene

This commit is contained in:
Sascha Willems 2020-04-19 11:50:46 +02:00
parent 3ae053d005
commit e0c15f62da
12 changed files with 15 additions and 15 deletions

View file

@ -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)

View file

@ -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(

View file

@ -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 '*.*'
}

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.saschawillems.vulkanMesh">
package="de.saschawillems.vulkanglTFScene">
<application
android:label="Vulkan model rendering"
android:label="Vulkan glTF scene rendering"
android:icon="@drawable/icon"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<activity android:name="de.saschawillems.vulkanSample.VulkanActivity"

View file

@ -1,2 +0,0 @@
glslangvalidator -V mesh.vert -o mesh.vert.spv
glslangvalidator -V mesh.frag -o mesh.frag.spv

View file

@ -64,13 +64,13 @@ set(EXAMPLES
dynamicuniformbuffer
gears
geometryshader
gltfscene
hdr
imgui
indirectdraw
inlineuniformblocks
inputattachments
instancing
mesh
multisampling
multithreading
multiview

View file

@ -452,6 +452,7 @@ public:
VkClearValue clearValues[2];
clearValues[0].color = defaultClearColor;
clearValues[0].color = { { 0.25f, 0.25f, 0.25f, 1.0f } };;
clearValues[1].depthStencil = { 1.0f, 0 };
VkRenderPassBeginInfo renderPassBeginInfo = vks::initializers::renderPassBeginInfo();
@ -682,8 +683,8 @@ public:
vertexInputStateCI.pVertexAttributeDescriptions = vertexInputAttributes.data();
const std::array<VkPipelineShaderStageCreateInfo, 2> 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);