├── .gitignore ├── .gitmodules ├── Android ├── .gitignore ├── app │ ├── .gitignore │ ├── assets │ │ ├── .gitignore │ │ ├── models │ │ │ └── .gitignore │ │ └── textures │ │ │ ├── .gitignore │ │ │ ├── awesomeface.png │ │ │ ├── container.png │ │ │ └── skybox │ │ │ ├── back.jpg │ │ │ ├── bottom.jpg │ │ │ ├── front.jpg │ │ │ ├── left.jpg │ │ │ ├── right.jpg │ │ │ └── top.jpg │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── engineer1109 │ │ │ └── learnvulkan │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── algorithm │ │ │ │ ├── ImageAlgorithm.cxx │ │ │ │ └── ImageAlgorithm.h │ │ │ ├── base │ │ │ │ ├── VulkanBase.cxx │ │ │ │ ├── VulkanBase.h │ │ │ │ ├── VulkanBaseEngine.cxx │ │ │ │ └── VulkanBaseEngine.h │ │ │ ├── common │ │ │ │ ├── base_template.h │ │ │ │ ├── filesystem_utils.h │ │ │ │ ├── render_common.h │ │ │ │ ├── vertex_struct.h │ │ │ │ ├── vulkan_macro.h │ │ │ │ └── vulkan_template.h │ │ │ ├── core │ │ │ │ ├── VulkanContext.h │ │ │ │ ├── VulkanDescriptorSet.cxx │ │ │ │ ├── VulkanDescriptorSet.h │ │ │ │ ├── VulkanFrameBuffer.cxx │ │ │ │ ├── VulkanFrameBuffer.h │ │ │ │ ├── VulkanPipelines.cxx │ │ │ │ ├── VulkanPipelines.h │ │ │ │ ├── VulkanRenderPass.cxx │ │ │ │ ├── VulkanRenderPass.h │ │ │ │ ├── VulkanVertexDescriptions.cxx │ │ │ │ └── VulkanVertexDescriptions.h │ │ │ ├── engines │ │ │ │ ├── ThirdPersonEngine.cxx │ │ │ │ └── ThirdPersonEngine.h │ │ │ ├── examples │ │ │ │ ├── 01_StaticTriangle │ │ │ │ │ ├── StaticTriangle.cxx │ │ │ │ │ ├── StaticTriangle.h │ │ │ │ │ └── myobjects │ │ │ │ │ │ ├── Triangle.cxx │ │ │ │ │ │ ├── Triangle.h │ │ │ │ │ │ ├── TriangleShader.cxx │ │ │ │ │ │ ├── TriangleShader.h │ │ │ │ │ │ ├── TriangleUniform.cxx │ │ │ │ │ │ └── TriangleUniform.h │ │ │ │ ├── 02_StaticCube │ │ │ │ │ ├── StaticCube.cxx │ │ │ │ │ └── StaticCube.h │ │ │ │ ├── 03_Texture2dCube │ │ │ │ │ ├── Texture2dCube.cxx │ │ │ │ │ └── Texture2dCube.h │ │ │ │ ├── 04_Skybox │ │ │ │ │ ├── SkyboxCube.cxx │ │ │ │ │ └── SkyboxCube.h │ │ │ │ ├── 05_PhongLighting │ │ │ │ │ ├── PhongLighting.cxx │ │ │ │ │ ├── PhongLighting.h │ │ │ │ │ ├── ReflectParaBuffer.cxx │ │ │ │ │ └── ReflectParaBuffer.h │ │ │ │ ├── 06_InstanceDraw │ │ │ │ │ ├── InstanceDraw.cxx │ │ │ │ │ ├── InstanceDraw.h │ │ │ │ │ ├── SpeedBuffer.cxx │ │ │ │ │ └── SpeedBuffer.h │ │ │ │ ├── 07_ShadowMapping │ │ │ │ │ ├── ReflectParaBuffer.cxx │ │ │ │ │ ├── ReflectParaBuffer.h │ │ │ │ │ ├── ShadowMapping.cxx │ │ │ │ │ └── ShadowMapping.h │ │ │ │ ├── 08_ShadowMappingOnmi │ │ │ │ │ ├── OnmiCamera.cpp │ │ │ │ │ ├── OnmiCamera.h │ │ │ │ │ ├── ReflectParaBuffer.cxx │ │ │ │ │ ├── ReflectParaBuffer.h │ │ │ │ │ ├── ShadowMappingOnmi.cxx │ │ │ │ │ └── ShadowMappingOnmi.h │ │ │ │ └── 11_AssimpModel │ │ │ │ │ ├── AssimpModelSample.cxx │ │ │ │ │ ├── AssimpModelSample.h │ │ │ │ │ ├── ReflectParaBuffer.cxx │ │ │ │ │ └── ReflectParaBuffer.h │ │ │ ├── native-lib.cpp │ │ │ ├── plugins │ │ │ │ └── assimp │ │ │ │ │ ├── AssimpObject.cxx │ │ │ │ │ └── AssimpObject.h │ │ │ ├── template │ │ │ │ ├── instance │ │ │ │ │ └── DefaultInstanceDescription.h │ │ │ │ └── object │ │ │ │ │ ├── VkObject.h │ │ │ │ │ ├── VulkanBuffer.cxx │ │ │ │ │ ├── VulkanBuffer.h │ │ │ │ │ ├── VulkanShader.cxx │ │ │ │ │ ├── VulkanShader.h │ │ │ │ │ ├── camera │ │ │ │ │ ├── ShadowCamera.cxx │ │ │ │ │ ├── ShadowCamera.h │ │ │ │ │ ├── ThirdPersonCamera.cxx │ │ │ │ │ ├── ThirdPersonCamera.h │ │ │ │ │ ├── UniformCamera.cxx │ │ │ │ │ └── UniformCamera.h │ │ │ │ │ ├── mesh │ │ │ │ │ ├── InstanceCube.cxx │ │ │ │ │ ├── InstanceCube.h │ │ │ │ │ ├── MeshObject.cxx │ │ │ │ │ ├── MeshObject.h │ │ │ │ │ ├── VulkanCube.cxx │ │ │ │ │ ├── VulkanCube.h │ │ │ │ │ ├── VulkanPlane.cxx │ │ │ │ │ └── VulkanPlane.h │ │ │ │ │ ├── shader │ │ │ │ │ └── VulkanVertFragShader.h │ │ │ │ │ └── texture │ │ │ │ │ ├── VulkanTexture.h │ │ │ │ │ ├── VulkanTexture2D.cxx │ │ │ │ │ ├── VulkanTexture2D.h │ │ │ │ │ ├── VulkanTextureCubeMap.cxx │ │ │ │ │ └── VulkanTextureCubeMap.h │ │ │ └── utils │ │ │ │ ├── AssetReader.h │ │ │ │ ├── VulkanAndroid.h │ │ │ │ ├── VulkanBuffer.hpp │ │ │ │ ├── VulkanDevice.hpp │ │ │ │ ├── VulkanInitializers.hpp │ │ │ │ ├── VulkanModel.hpp │ │ │ │ ├── VulkanModelV2.hpp │ │ │ │ ├── VulkanSwapChain.hpp │ │ │ │ ├── VulkanTools.cpp │ │ │ │ └── VulkanTools.h │ │ ├── java │ │ │ └── com │ │ │ │ └── engineer1109 │ │ │ │ └── learnvulkan │ │ │ │ ├── activities │ │ │ │ ├── BaseRenderActivity.java │ │ │ │ └── StartActivity.java │ │ │ │ ├── adapters │ │ │ │ ├── MenuAdapter.java │ │ │ │ └── SurfaceAdapters.java │ │ │ │ ├── itemdecoration │ │ │ │ └── VerticalRecyclerItemDecoration.java │ │ │ │ ├── model │ │ │ │ └── MenuData.java │ │ │ │ ├── render │ │ │ │ └── BaseRender.java │ │ │ │ └── viewmodel │ │ │ │ ├── BaseRenderViewModel.java │ │ │ │ └── MainViewModel.java │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_base_render.xml │ │ │ ├── activity_start.xml │ │ │ └── layout_menu.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── themes.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── themes.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── engineer1109 │ │ └── learnvulkan │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── CMakeLists.txt ├── LICENSE ├── bin ├── README.md └── data │ └── dummy ├── cmake ├── Config.cmake ├── FindAssimp.cmake ├── FindOpenMP.cmake ├── FindQt.cmake ├── FindVulkan.cmake ├── Functions.cmake ├── GCC.cmake ├── Git.cmake ├── Report.cmake └── Softlink.cmake ├── data ├── Roboto-Medium.ttf ├── gif │ └── output.gif ├── models │ ├── cube.obj │ └── sphere.obj ├── shaders │ ├── InstanceDraw │ │ ├── Makefile │ │ ├── instancedraw.glsl.frag │ │ ├── instancedraw.glsl.vert │ │ ├── instancedraw.so.frag │ │ └── instancedraw.so.vert │ ├── Makefile │ ├── PhongLighting │ │ ├── Makefile │ │ ├── phonglighting.glsl.frag │ │ ├── phonglighting.glsl.vert │ │ ├── phonglighting.so.frag │ │ └── phonglighting.so.vert │ ├── ShadowMapping │ │ ├── Makefile │ │ ├── plane.glsl.frag │ │ ├── plane.glsl.vert │ │ ├── plane.so.frag │ │ ├── plane.so.vert │ │ ├── quad.glsl.frag │ │ ├── quad.glsl.vert │ │ ├── quad.so.frag │ │ ├── quad.so.vert │ │ ├── scene.glsl.frag │ │ ├── scene.glsl.vert │ │ ├── scene.so.frag │ │ ├── scene.so.vert │ │ ├── shadow.glsl.frag │ │ ├── shadow.glsl.vert │ │ ├── shadow.so.frag │ │ └── shadow.so.vert │ ├── ShadowMappingOnmi │ │ ├── Makefile │ │ ├── cubemapdisplay.glsl.frag │ │ ├── cubemapdisplay.glsl.vert │ │ ├── cubemapdisplay.so.frag │ │ ├── cubemapdisplay.so.vert │ │ ├── offscreen.glsl.frag │ │ ├── offscreen.glsl.vert │ │ ├── offscreen.so.frag │ │ ├── offscreen.so.vert │ │ ├── room.glsl.frag │ │ ├── room.glsl.vert │ │ ├── room.so.frag │ │ ├── room.so.vert │ │ ├── scene.glsl.frag │ │ ├── scene.glsl.vert │ │ ├── scene.so.frag │ │ └── scene.so.vert │ ├── Skybox │ │ ├── Makefile │ │ ├── skybox.glsl.frag │ │ ├── skybox.glsl.vert │ │ ├── skybox.so.frag │ │ └── skybox.so.vert │ ├── StaticCube │ │ ├── Makefile │ │ ├── staticcube.glsl.frag │ │ ├── staticcube.glsl.vert │ │ ├── staticcube.so.frag │ │ └── staticcube.so.vert │ ├── StaticTriangle │ │ ├── Makefile │ │ ├── statictriangle.glsl.frag │ │ ├── statictriangle.glsl.vert │ │ ├── statictriangle.so.frag │ │ └── statictriangle.so.vert │ ├── Texture2dCube │ │ ├── Makefile │ │ ├── texture2d.glsl.frag │ │ ├── texture2d.glsl.vert │ │ ├── texture2d.so.frag │ │ └── texture2d.so.vert │ ├── VolumeFog │ │ ├── Makefile │ │ ├── volumefog.glsl.frag │ │ ├── volumefog.glsl.vert │ │ ├── volumefog.so.frag │ │ └── volumefog.so.vert │ └── base │ │ ├── uioverlay.frag │ │ ├── uioverlay.frag.spv │ │ ├── uioverlay.vert │ │ └── uioverlay.vert.spv └── textures │ ├── awesomeface.png │ ├── container.png │ ├── skybox │ ├── back.jpg │ ├── bottom.jpg │ ├── front.jpg │ ├── left.jpg │ ├── right.jpg │ └── top.jpg │ └── wood.png ├── examples ├── 01_SimpleExamples │ ├── 01_StaticTriangle │ │ ├── CMakeLists.txt │ │ ├── StaticTriangle.cxx │ │ ├── StaticTriangle.h │ │ ├── main.cxx │ │ └── myobjects │ │ │ ├── Triangle.cxx │ │ │ ├── Triangle.h │ │ │ ├── TriangleShader.cxx │ │ │ ├── TriangleShader.h │ │ │ ├── TriangleUniform.cxx │ │ │ └── TriangleUniform.h │ ├── 02_StaticCube │ │ ├── CMakeLists.txt │ │ ├── StaticCube.cxx │ │ ├── StaticCube.h │ │ └── main.cxx │ ├── 03_Texture2dCube │ │ ├── CMakeLists.txt │ │ ├── Texture2dCube.cxx │ │ ├── Texture2dCube.h │ │ └── main.cxx │ ├── 04_Skybox │ │ ├── CMakeLists.txt │ │ ├── SkyboxCube.cxx │ │ ├── SkyboxCube.h │ │ └── main.cxx │ ├── 05_PhongLighting │ │ ├── CMakeLists.txt │ │ ├── PhongLighting.cxx │ │ ├── PhongLighting.h │ │ ├── ReflectParaBuffer.cxx │ │ ├── ReflectParaBuffer.h │ │ └── main.cxx │ ├── 06_InstanceDraw │ │ ├── CMakeLists.txt │ │ ├── InstanceDraw.cxx │ │ ├── InstanceDraw.h │ │ ├── SpeedBuffer.cxx │ │ ├── SpeedBuffer.h │ │ └── main.cxx │ ├── 07_ShadowMapping │ │ ├── CMakeLists.txt │ │ ├── ReflectParaBuffer.cxx │ │ ├── ReflectParaBuffer.h │ │ ├── ShadowMapping.cxx │ │ ├── ShadowMapping.h │ │ └── main.cxx │ ├── 08_ShadowMappingOnmi │ │ ├── CMakeLists.txt │ │ ├── OnmiCamera.cpp │ │ ├── OnmiCamera.h │ │ ├── ReflectParaBuffer.cxx │ │ ├── ReflectParaBuffer.h │ │ ├── ShadowMappingOnmi.cxx │ │ ├── ShadowMappingOnmi.h │ │ └── main.cxx │ ├── 09_VolumeFog │ │ ├── CMakeLists.txt │ │ ├── VolumeFog.cxx │ │ ├── VolumeFog.h │ │ ├── VolumeModelUniform.cxx │ │ ├── VolumeModelUniform.h │ │ └── main.cxx │ └── CMakeLists.txt ├── 02_AdvancedExamples │ ├── 11_AssimpModel │ │ ├── AssimpModelSample.cxx │ │ ├── AssimpModelSample.h │ │ ├── CMakeLists.txt │ │ ├── ReflectParaBuffer.cxx │ │ ├── ReflectParaBuffer.h │ │ └── main.cxx │ └── CMakeLists.txt ├── 03_QtVulkan │ ├── .gitignore │ ├── 21_QtVulkanSceneDemo │ │ ├── CMakeLists.txt │ │ ├── ReflectParaBuffer.cxx │ │ ├── ReflectParaBuffer.h │ │ ├── ShadowMapping.cxx │ │ ├── ShadowMapping.h │ │ ├── main.cxx │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ └── mainwindow.ui │ └── CMakeLists.txt ├── 04_VulkanWithOpenCV │ └── CMakeLists.txt ├── 05_GraphicsAlgorithm │ └── CMakeLists.txt ├── 06_SimpleGame │ └── CMakeLists.txt ├── BaseProject │ ├── CMakeLists.txt │ ├── include │ │ └── baseproject.h │ └── src │ │ ├── baseproject.cxx │ │ └── main.cxx └── CMakeLists.txt ├── readme.md ├── source ├── CMakeLists.txt ├── algorithm │ ├── GraphicsAlgorithm.cxx │ ├── GraphicsAlgorithm.h │ ├── ImageAlgorithm.cxx │ ├── ImageAlgorithm.h │ ├── PerlinNoise.cxx │ ├── PerlinNoise.h │ ├── VertexFactory.cxx │ └── VertexFactory.h ├── base │ ├── VulkanBase.cxx │ ├── VulkanBase.h │ ├── VulkanBaseEngine.cxx │ ├── VulkanBaseEngine.h │ ├── VulkanBase_win32.cxx │ └── VulkanBase_xcb.cxx ├── common │ ├── base_template.h │ ├── filesystem_utils.h │ ├── render_common.h │ ├── vertex_struct.h │ ├── vulkan_macro.h │ └── vulkan_template.h ├── core │ ├── VulkanContext.h │ ├── VulkanDescriptorSet.cxx │ ├── VulkanDescriptorSet.h │ ├── VulkanFrameBuffer.cxx │ ├── VulkanFrameBuffer.h │ ├── VulkanPipelines.cxx │ ├── VulkanPipelines.h │ ├── VulkanRenderPass.cxx │ ├── VulkanRenderPass.h │ ├── VulkanVertexDescriptions.cxx │ └── VulkanVertexDescriptions.h ├── engines │ ├── ThirdPersonEngine.cxx │ └── ThirdPersonEngine.h ├── plugins │ ├── assimp │ │ ├── AssimpObject.cxx │ │ └── AssimpObject.h │ └── qt │ │ ├── QtVulkanWindow.cxx │ │ └── QtVulkanWindow.h ├── template │ ├── instance │ │ └── DefaultInstanceDescription.h │ └── object │ │ ├── VkObject.h │ │ ├── VulkanBuffer.cxx │ │ ├── VulkanBuffer.h │ │ ├── VulkanShader.cxx │ │ ├── VulkanShader.h │ │ ├── camera │ │ ├── ShadowCamera.cxx │ │ ├── ShadowCamera.h │ │ ├── ThirdPersonCamera.cxx │ │ ├── ThirdPersonCamera.h │ │ ├── UniformCamera.cxx │ │ └── UniformCamera.h │ │ ├── mesh │ │ ├── InstanceCube.cxx │ │ ├── InstanceCube.h │ │ ├── MeshObject.cxx │ │ ├── MeshObject.h │ │ ├── VulkanCube.cxx │ │ ├── VulkanCube.h │ │ ├── VulkanPlane.cxx │ │ └── VulkanPlane.h │ │ ├── shader │ │ └── VulkanVertFragShader.h │ │ └── texture │ │ ├── VulkanTexture.h │ │ ├── VulkanTexture2D.cxx │ │ ├── VulkanTexture2D.h │ │ ├── VulkanTexture3D.cxx │ │ ├── VulkanTexture3D.h │ │ ├── VulkanTextureCubeMap.cxx │ │ └── VulkanTextureCubeMap.h └── utils │ ├── CommandLineParser.hpp │ ├── VulkanAndroid.h │ ├── VulkanBuffer.hpp │ ├── VulkanDebug.h │ ├── VulkanDevice.hpp │ ├── VulkanInitializers.hpp │ ├── VulkanModel.hpp │ ├── VulkanModelV2.hpp │ ├── VulkanSwapChain.hpp │ ├── VulkanTools.cpp │ ├── VulkanTools.h │ ├── VulkanUIOverlay.cxx │ ├── VulkanUIOverlay.h │ └── keycodes.hpp └── third_party ├── assimp ├── include │ └── assimp │ │ ├── BaseImporter.h │ │ ├── Bitmap.h │ │ ├── BlobIOSystem.h │ │ ├── ByteSwapper.h │ │ ├── ColladaMetaData.h │ │ ├── Compiler │ │ ├── poppack1.h │ │ ├── pstdint.h │ │ └── pushpack1.h │ │ ├── CreateAnimMesh.h │ │ ├── DefaultIOStream.h │ │ ├── DefaultIOSystem.h │ │ ├── DefaultLogger.hpp │ │ ├── Defines.h │ │ ├── Exceptional.h │ │ ├── Exporter.hpp │ │ ├── GenericProperty.h │ │ ├── Hash.h │ │ ├── IOStream.hpp │ │ ├── IOStreamBuffer.h │ │ ├── IOSystem.hpp │ │ ├── Importer.hpp │ │ ├── LineSplitter.h │ │ ├── LogAux.h │ │ ├── LogStream.hpp │ │ ├── Logger.hpp │ │ ├── MathFunctions.h │ │ ├── MemoryIOWrapper.h │ │ ├── NullLogger.hpp │ │ ├── ParsingUtils.h │ │ ├── Profiler.h │ │ ├── ProgressHandler.hpp │ │ ├── RemoveComments.h │ │ ├── SGSpatialSort.h │ │ ├── SceneCombiner.h │ │ ├── SkeletonMeshBuilder.h │ │ ├── SmallVector.h │ │ ├── SmoothingGroups.h │ │ ├── SmoothingGroups.inl │ │ ├── SpatialSort.h │ │ ├── StandardShapes.h │ │ ├── StreamReader.h │ │ ├── StreamWriter.h │ │ ├── StringComparison.h │ │ ├── StringUtils.h │ │ ├── Subdivision.h │ │ ├── TinyFormatter.h │ │ ├── Vertex.h │ │ ├── XMLTools.h │ │ ├── XmlParser.h │ │ ├── ZipArchiveIOSystem.h │ │ ├── aabb.h │ │ ├── ai_assert.h │ │ ├── anim.h │ │ ├── camera.h │ │ ├── cexport.h │ │ ├── cfileio.h │ │ ├── cimport.h │ │ ├── color4.h │ │ ├── color4.inl │ │ ├── commonMetaData.h │ │ ├── config.h │ │ ├── defs.h │ │ ├── fast_atof.h │ │ ├── importerdesc.h │ │ ├── light.h │ │ ├── material.h │ │ ├── material.inl │ │ ├── matrix3x3.h │ │ ├── matrix3x3.inl │ │ ├── matrix4x4.h │ │ ├── matrix4x4.inl │ │ ├── mesh.h │ │ ├── metadata.h │ │ ├── pbrmaterial.h │ │ ├── postprocess.h │ │ ├── qnan.h │ │ ├── quaternion.h │ │ ├── quaternion.inl │ │ ├── scene.h │ │ ├── texture.h │ │ ├── types.h │ │ ├── vector2.h │ │ ├── vector2.inl │ │ ├── vector3.h │ │ ├── vector3.inl │ │ └── version.h └── lib │ └── android │ ├── arm64-v8a │ └── libassimp.so │ └── x86_64 │ └── libassimp.so ├── gli └── gli │ ├── CMakeLists.txt │ ├── clear.hpp │ ├── comparison.hpp │ ├── convert.hpp │ ├── copy.hpp │ ├── core │ ├── bc.hpp │ ├── bc.inl │ ├── clear.hpp │ ├── clear.inl │ ├── comparison.inl │ ├── convert.inl │ ├── convert_func.hpp │ ├── coord.hpp │ ├── copy.inl │ ├── dummy.cpp │ ├── duplicate.inl │ ├── dx.inl │ ├── file.hpp │ ├── file.inl │ ├── filter.hpp │ ├── filter.inl │ ├── filter_compute.hpp │ ├── flip.hpp │ ├── flip.inl │ ├── format.inl │ ├── generate_mipmaps.inl │ ├── gl.inl │ ├── image.inl │ ├── levels.inl │ ├── load.inl │ ├── load_dds.inl │ ├── load_kmg.inl │ ├── load_ktx.inl │ ├── make_texture.inl │ ├── mipmaps_compute.hpp │ ├── reduce.inl │ ├── s3tc.hpp │ ├── s3tc.inl │ ├── sampler.inl │ ├── sampler1d.inl │ ├── sampler1d_array.inl │ ├── sampler2d.inl │ ├── sampler2d_array.inl │ ├── sampler3d.inl │ ├── sampler_cube.inl │ ├── sampler_cube_array.inl │ ├── save.inl │ ├── save_dds.inl │ ├── save_kmg.inl │ ├── save_ktx.inl │ ├── storage.hpp │ ├── storage.inl │ ├── storage_linear.hpp │ ├── storage_linear.inl │ ├── texture.inl │ ├── texture1d.inl │ ├── texture1d_array.inl │ ├── texture2d.inl │ ├── texture2d_array.inl │ ├── texture3d.inl │ ├── texture_cube.inl │ ├── texture_cube_array.inl │ ├── transform.inl │ ├── view.inl │ └── workaround.hpp │ ├── duplicate.hpp │ ├── dx.hpp │ ├── format.hpp │ ├── generate_mipmaps.hpp │ ├── gl.hpp │ ├── gli.hpp │ ├── image.hpp │ ├── levels.hpp │ ├── load.hpp │ ├── load_dds.hpp │ ├── load_kmg.hpp │ ├── load_ktx.hpp │ ├── make_texture.hpp │ ├── reduce.hpp │ ├── sampler.hpp │ ├── sampler1d.hpp │ ├── sampler1d_array.hpp │ ├── sampler2d.hpp │ ├── sampler2d_array.hpp │ ├── sampler3d.hpp │ ├── sampler_cube.hpp │ ├── sampler_cube_array.hpp │ ├── save.hpp │ ├── save_dds.hpp │ ├── save_kmg.hpp │ ├── save_ktx.hpp │ ├── target.hpp │ ├── texture.hpp │ ├── texture1d.hpp │ ├── texture1d_array.hpp │ ├── texture2d.hpp │ ├── texture2d_array.hpp │ ├── texture3d.hpp │ ├── texture_cube.hpp │ ├── texture_cube_array.hpp │ ├── transform.hpp │ ├── type.hpp │ └── view.hpp ├── glm └── glm │ ├── CMakeLists.txt │ ├── common.hpp │ ├── detail │ ├── _features.hpp │ ├── _fixes.hpp │ ├── _noise.hpp │ ├── _swizzle.hpp │ ├── _swizzle_func.hpp │ ├── _vectorize.hpp │ ├── compute_common.hpp │ ├── compute_vector_relational.hpp │ ├── func_common.inl │ ├── func_common_simd.inl │ ├── func_exponential.inl │ ├── func_exponential_simd.inl │ ├── func_geometric.inl │ ├── func_geometric_simd.inl │ ├── func_integer.inl │ ├── func_integer_simd.inl │ ├── func_matrix.inl │ ├── func_matrix_simd.inl │ ├── func_packing.inl │ ├── func_packing_simd.inl │ ├── func_trigonometric.inl │ ├── func_trigonometric_simd.inl │ ├── func_vector_relational.inl │ ├── func_vector_relational_simd.inl │ ├── glm.cpp │ ├── qualifier.hpp │ ├── setup.hpp │ ├── type_float.hpp │ ├── type_half.hpp │ ├── type_half.inl │ ├── type_mat2x2.hpp │ ├── type_mat2x2.inl │ ├── type_mat2x3.hpp │ ├── type_mat2x3.inl │ ├── type_mat2x4.hpp │ ├── type_mat2x4.inl │ ├── type_mat3x2.hpp │ ├── type_mat3x2.inl │ ├── type_mat3x3.hpp │ ├── type_mat3x3.inl │ ├── type_mat3x4.hpp │ ├── type_mat3x4.inl │ ├── type_mat4x2.hpp │ ├── type_mat4x2.inl │ ├── type_mat4x3.hpp │ ├── type_mat4x3.inl │ ├── type_mat4x4.hpp │ ├── type_mat4x4.inl │ ├── type_mat4x4_simd.inl │ ├── type_quat.hpp │ ├── type_quat.inl │ ├── type_quat_simd.inl │ ├── type_vec1.hpp │ ├── type_vec1.inl │ ├── type_vec2.hpp │ ├── type_vec2.inl │ ├── type_vec3.hpp │ ├── type_vec3.inl │ ├── type_vec4.hpp │ ├── type_vec4.inl │ └── type_vec4_simd.inl │ ├── exponential.hpp │ ├── ext.hpp │ ├── ext │ ├── matrix_clip_space.hpp │ ├── matrix_clip_space.inl │ ├── matrix_common.hpp │ ├── matrix_common.inl │ ├── matrix_double2x2.hpp │ ├── matrix_double2x2_precision.hpp │ ├── matrix_double2x3.hpp │ ├── matrix_double2x3_precision.hpp │ ├── matrix_double2x4.hpp │ ├── matrix_double2x4_precision.hpp │ ├── matrix_double3x2.hpp │ ├── matrix_double3x2_precision.hpp │ ├── matrix_double3x3.hpp │ ├── matrix_double3x3_precision.hpp │ ├── matrix_double3x4.hpp │ ├── matrix_double3x4_precision.hpp │ ├── matrix_double4x2.hpp │ ├── matrix_double4x2_precision.hpp │ ├── matrix_double4x3.hpp │ ├── matrix_double4x3_precision.hpp │ ├── matrix_double4x4.hpp │ ├── matrix_double4x4_precision.hpp │ ├── matrix_float2x2.hpp │ ├── matrix_float2x2_precision.hpp │ ├── matrix_float2x3.hpp │ ├── matrix_float2x3_precision.hpp │ ├── matrix_float2x4.hpp │ ├── matrix_float2x4_precision.hpp │ ├── matrix_float3x2.hpp │ ├── matrix_float3x2_precision.hpp │ ├── matrix_float3x3.hpp │ ├── matrix_float3x3_precision.hpp │ ├── matrix_float3x4.hpp │ ├── matrix_float3x4_precision.hpp │ ├── matrix_float4x2.hpp │ ├── matrix_float4x2_precision.hpp │ ├── matrix_float4x3.hpp │ ├── matrix_float4x3_precision.hpp │ ├── matrix_float4x4.hpp │ ├── matrix_float4x4_precision.hpp │ ├── matrix_projection.hpp │ ├── matrix_projection.inl │ ├── matrix_relational.hpp │ ├── matrix_relational.inl │ ├── matrix_transform.hpp │ ├── matrix_transform.inl │ ├── quaternion_common.hpp │ ├── quaternion_common.inl │ ├── quaternion_common_simd.inl │ ├── quaternion_double.hpp │ ├── quaternion_double_precision.hpp │ ├── quaternion_exponential.hpp │ ├── quaternion_exponential.inl │ ├── quaternion_float.hpp │ ├── quaternion_float_precision.hpp │ ├── quaternion_geometric.hpp │ ├── quaternion_geometric.inl │ ├── quaternion_relational.hpp │ ├── quaternion_relational.inl │ ├── quaternion_transform.hpp │ ├── quaternion_transform.inl │ ├── quaternion_trigonometric.hpp │ ├── quaternion_trigonometric.inl │ ├── scalar_common.hpp │ ├── scalar_common.inl │ ├── scalar_constants.hpp │ ├── scalar_constants.inl │ ├── scalar_int_sized.hpp │ ├── scalar_integer.hpp │ ├── scalar_integer.inl │ ├── scalar_relational.hpp │ ├── scalar_relational.inl │ ├── scalar_uint_sized.hpp │ ├── scalar_ulp.hpp │ ├── scalar_ulp.inl │ ├── vector_bool1.hpp │ ├── vector_bool1_precision.hpp │ ├── vector_bool2.hpp │ ├── vector_bool2_precision.hpp │ ├── vector_bool3.hpp │ ├── vector_bool3_precision.hpp │ ├── vector_bool4.hpp │ ├── vector_bool4_precision.hpp │ ├── vector_common.hpp │ ├── vector_common.inl │ ├── vector_double1.hpp │ ├── vector_double1_precision.hpp │ ├── vector_double2.hpp │ ├── vector_double2_precision.hpp │ ├── vector_double3.hpp │ ├── vector_double3_precision.hpp │ ├── vector_double4.hpp │ ├── vector_double4_precision.hpp │ ├── vector_float1.hpp │ ├── vector_float1_precision.hpp │ ├── vector_float2.hpp │ ├── vector_float2_precision.hpp │ ├── vector_float3.hpp │ ├── vector_float3_precision.hpp │ ├── vector_float4.hpp │ ├── vector_float4_precision.hpp │ ├── vector_int1.hpp │ ├── vector_int1_precision.hpp │ ├── vector_int2.hpp │ ├── vector_int2_precision.hpp │ ├── vector_int3.hpp │ ├── vector_int3_precision.hpp │ ├── vector_int4.hpp │ ├── vector_int4_precision.hpp │ ├── vector_integer.hpp │ ├── vector_integer.inl │ ├── vector_relational.hpp │ ├── vector_relational.inl │ ├── vector_uint1.hpp │ ├── vector_uint1_precision.hpp │ ├── vector_uint2.hpp │ ├── vector_uint2_precision.hpp │ ├── vector_uint3.hpp │ ├── vector_uint3_precision.hpp │ ├── vector_uint4.hpp │ ├── vector_uint4_precision.hpp │ ├── vector_ulp.hpp │ └── vector_ulp.inl │ ├── fwd.hpp │ ├── geometric.hpp │ ├── glm.hpp │ ├── gtc │ ├── bitfield.hpp │ ├── bitfield.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── constants.hpp │ ├── constants.inl │ ├── epsilon.hpp │ ├── epsilon.inl │ ├── integer.hpp │ ├── integer.inl │ ├── matrix_access.hpp │ ├── matrix_access.inl │ ├── matrix_integer.hpp │ ├── matrix_inverse.hpp │ ├── matrix_inverse.inl │ ├── matrix_transform.hpp │ ├── matrix_transform.inl │ ├── noise.hpp │ ├── noise.inl │ ├── packing.hpp │ ├── packing.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── quaternion_simd.inl │ ├── random.hpp │ ├── random.inl │ ├── reciprocal.hpp │ ├── reciprocal.inl │ ├── round.hpp │ ├── round.inl │ ├── type_aligned.hpp │ ├── type_precision.hpp │ ├── type_precision.inl │ ├── type_ptr.hpp │ ├── type_ptr.inl │ ├── ulp.hpp │ ├── ulp.inl │ └── vec1.hpp │ ├── gtx │ ├── associated_min_max.hpp │ ├── associated_min_max.inl │ ├── bit.hpp │ ├── bit.inl │ ├── closest_point.hpp │ ├── closest_point.inl │ ├── color_encoding.hpp │ ├── color_encoding.inl │ ├── color_space.hpp │ ├── color_space.inl │ ├── color_space_YCoCg.hpp │ ├── color_space_YCoCg.inl │ ├── common.hpp │ ├── common.inl │ ├── compatibility.hpp │ ├── compatibility.inl │ ├── component_wise.hpp │ ├── component_wise.inl │ ├── dual_quaternion.hpp │ ├── dual_quaternion.inl │ ├── easing.hpp │ ├── easing.inl │ ├── euler_angles.hpp │ ├── euler_angles.inl │ ├── extend.hpp │ ├── extend.inl │ ├── extended_min_max.hpp │ ├── extended_min_max.inl │ ├── exterior_product.hpp │ ├── exterior_product.inl │ ├── fast_exponential.hpp │ ├── fast_exponential.inl │ ├── fast_square_root.hpp │ ├── fast_square_root.inl │ ├── fast_trigonometry.hpp │ ├── fast_trigonometry.inl │ ├── float_notmalize.inl │ ├── functions.hpp │ ├── functions.inl │ ├── gradient_paint.hpp │ ├── gradient_paint.inl │ ├── handed_coordinate_space.hpp │ ├── handed_coordinate_space.inl │ ├── hash.hpp │ ├── hash.inl │ ├── integer.hpp │ ├── integer.inl │ ├── intersect.hpp │ ├── intersect.inl │ ├── io.hpp │ ├── io.inl │ ├── log_base.hpp │ ├── log_base.inl │ ├── matrix_cross_product.hpp │ ├── matrix_cross_product.inl │ ├── matrix_decompose.hpp │ ├── matrix_decompose.inl │ ├── matrix_factorisation.hpp │ ├── matrix_factorisation.inl │ ├── matrix_interpolation.hpp │ ├── matrix_interpolation.inl │ ├── matrix_major_storage.hpp │ ├── matrix_major_storage.inl │ ├── matrix_operation.hpp │ ├── matrix_operation.inl │ ├── matrix_query.hpp │ ├── matrix_query.inl │ ├── matrix_transform_2d.hpp │ ├── matrix_transform_2d.inl │ ├── mixed_product.hpp │ ├── mixed_product.inl │ ├── norm.hpp │ ├── norm.inl │ ├── normal.hpp │ ├── normal.inl │ ├── normalize_dot.hpp │ ├── normalize_dot.inl │ ├── number_precision.hpp │ ├── number_precision.inl │ ├── optimum_pow.hpp │ ├── optimum_pow.inl │ ├── orthonormalize.hpp │ ├── orthonormalize.inl │ ├── perpendicular.hpp │ ├── perpendicular.inl │ ├── polar_coordinates.hpp │ ├── polar_coordinates.inl │ ├── projection.hpp │ ├── projection.inl │ ├── quaternion.hpp │ ├── quaternion.inl │ ├── range.hpp │ ├── raw_data.hpp │ ├── raw_data.inl │ ├── rotate_normalized_axis.hpp │ ├── rotate_normalized_axis.inl │ ├── rotate_vector.hpp │ ├── rotate_vector.inl │ ├── scalar_multiplication.hpp │ ├── scalar_relational.hpp │ ├── scalar_relational.inl │ ├── spline.hpp │ ├── spline.inl │ ├── std_based_type.hpp │ ├── std_based_type.inl │ ├── string_cast.hpp │ ├── string_cast.inl │ ├── texture.hpp │ ├── texture.inl │ ├── transform.hpp │ ├── transform.inl │ ├── transform2.hpp │ ├── transform2.inl │ ├── type_aligned.hpp │ ├── type_aligned.inl │ ├── type_trait.hpp │ ├── type_trait.inl │ ├── vec_swizzle.hpp │ ├── vector_angle.hpp │ ├── vector_angle.inl │ ├── vector_query.hpp │ ├── vector_query.inl │ ├── wrap.hpp │ └── wrap.inl │ ├── integer.hpp │ ├── mat2x2.hpp │ ├── mat2x3.hpp │ ├── mat2x4.hpp │ ├── mat3x2.hpp │ ├── mat3x3.hpp │ ├── mat3x4.hpp │ ├── mat4x2.hpp │ ├── mat4x3.hpp │ ├── mat4x4.hpp │ ├── matrix.hpp │ ├── packing.hpp │ ├── simd │ ├── common.h │ ├── exponential.h │ ├── geometric.h │ ├── integer.h │ ├── matrix.h │ ├── packing.h │ ├── platform.h │ ├── trigonometric.h │ └── vector_relational.h │ ├── trigonometric.hpp │ ├── vec2.hpp │ ├── vec3.hpp │ ├── vec4.hpp │ └── vector_relational.hpp ├── imgui ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_internal.h ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h └── imstb_truetype.h └── stb_image ├── include └── stb_image_aug.h └── src └── stb_image_aug.c /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。 3 | ################################################################################ 4 | 5 | /build 6 | /Release 7 | /Release 8 | /Release 9 | bin/ 10 | cmake-build-debug/ 11 | .vs/ 12 | out/ 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/.gitmodules -------------------------------------------------------------------------------- /Android/.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle/ 2 | /.idea/ 3 | /local.properties 4 | -------------------------------------------------------------------------------- /Android/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /.cxx/ 3 | /lib/ 4 | -------------------------------------------------------------------------------- /Android/app/assets/.gitignore: -------------------------------------------------------------------------------- 1 | /shaders/ 2 | -------------------------------------------------------------------------------- /Android/app/assets/models/.gitignore: -------------------------------------------------------------------------------- 1 | *.obj 2 | -------------------------------------------------------------------------------- /Android/app/assets/textures/.gitignore: -------------------------------------------------------------------------------- 1 | *.png 2 | -------------------------------------------------------------------------------- /Android/app/assets/textures/awesomeface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/awesomeface.png -------------------------------------------------------------------------------- /Android/app/assets/textures/container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/container.png -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/back.jpg -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/bottom.jpg -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/front.jpg -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/left.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/left.jpg -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/right.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/right.jpg -------------------------------------------------------------------------------- /Android/app/assets/textures/skybox/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/assets/textures/skybox/top.jpg -------------------------------------------------------------------------------- /Android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /Android/app/src/androidTest/java/com/engineer1109/learnvulkan/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.engineer1109.learnvulkan; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.wjl.learnvulkan", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /Android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/algorithm/ImageAlgorithm.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-3-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_IMAGEALGORITHM_H 6 | #define LEARNVULKAN_IMAGEALGORITHM_H 7 | 8 | #include "base_template.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class ImageAlgorithm { 13 | public: 14 | static void turnRGB2RGBA(uint8_t* inData, uint8_t* outData, int width, int height); 15 | 16 | static void mirrorX(uint8_t* data, int width, int height); 17 | 18 | static void mirror_X_Y(uint8_t* data, int width, int height); 19 | 20 | static void mirrorXY(uint8_t* data, int width, int height); 21 | 22 | static uint8_t &at(uint8_t* data, int x, int y, int c, int width, int height); 23 | }; 24 | 25 | END_NAMESPACE(VulkanEngine) 26 | 27 | #endif //LEARNVULKAN_IMAGEALGORITHM_H 28 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/common/base_template.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-23. 3 | // 4 | 5 | #ifndef LEARNVULKAN_BASE_TEMPLATE_H 6 | #define LEARNVULKAN_BASE_TEMPLATE_H 7 | 8 | #include "render_common.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | template 13 | void delete_ptr(T* &ptr){ 14 | if(ptr){ 15 | delete ptr; 16 | ptr = nullptr; 17 | } 18 | } 19 | 20 | template 21 | void delete_array(T* &ptr){ 22 | if(ptr){ 23 | delete[] ptr; 24 | ptr = nullptr; 25 | } 26 | } 27 | 28 | template 29 | T clamp(T value, T minValue, T maxValue){ 30 | T res = std::min(maxValue, value); 31 | res = std::max(minValue, value); 32 | return res; 33 | } 34 | 35 | END_NAMESPACE(VulkanEngine) 36 | 37 | #endif //LEARNVULKAN_BASE_TEMPLATE_H 38 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/common/vertex_struct.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 20-11-22. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VERTEX_STRUCT_H 6 | #define LEARNVULKAN_VERTEX_STRUCT_H 7 | 8 | #include "render_common.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | struct Vertex { 13 | float pos[3]; 14 | float uv[2]; 15 | float normal[3]; 16 | }; 17 | 18 | struct VertexUVW { 19 | float pos[3]; 20 | float uv[3]; 21 | float normal[3]; 22 | }; 23 | 24 | struct VertexTexVec4 { 25 | float pos[3]; 26 | float uv[4]; 27 | float normal[3]; 28 | }; 29 | 30 | END_NAMESPACE(VulkanEngine) 31 | 32 | #endif //LEARNVULKAN_VERTEX_STRUCT_H 33 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/common/vulkan_macro.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-23. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKAN_MACRO_H 6 | #define LEARNVULKAN_VULKAN_MACRO_H 7 | 8 | #include "render_common.h" 9 | 10 | #define VK_SAFE_DELETE(var, f) \ 11 | { \ 12 | if(var != VK_NULL_HANDLE){ \ 13 | (f); \ 14 | var = VK_NULL_HANDLE; \ 15 | } \ 16 | } 17 | 18 | #endif //LEARNVULKAN_VULKAN_MACRO_H 19 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/common/vulkan_template.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-23. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKAN_TEMPLATE_H 6 | #define LEARNVULKAN_VULKAN_TEMPLATE_H 7 | 8 | #include "base_template.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | 13 | END_NAMESPACE(VulkanEngine) 14 | 15 | #endif //LEARNVULKAN_VULKAN_TEMPLATE_H 16 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/core/VulkanContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-26. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKANCONTEXT_H 6 | #define LEARNVULKAN_VULKANCONTEXT_H 7 | 8 | #include "render_common.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | struct VulkanContext { 13 | vks::VulkanDevice *vulkanDevice = nullptr; 14 | VkCommandBuffer copyCmd = VK_NULL_HANDLE; 15 | VkCommandPool cmdPool = VK_NULL_HANDLE; 16 | VkPipelineLayout *pPipelineLayout = nullptr; 17 | VkPipelineCache pipelineCache = VK_NULL_HANDLE; 18 | VkRenderPass renderPass = VK_NULL_HANDLE; 19 | VkQueue queue = VK_NULL_HANDLE; 20 | uint32_t *pScreenWidth = nullptr; 21 | uint32_t *pScreenHeight = nullptr; 22 | 23 | #ifdef __ANDROID__ 24 | AAssetManager *m_asset = nullptr; 25 | #endif 26 | 27 | VkDevice &getDevice(){ 28 | return vulkanDevice->logicalDevice; 29 | } 30 | 31 | VkPhysicalDevice &getPhysicalDevice(){ 32 | return vulkanDevice->physicalDevice; 33 | } 34 | }; 35 | 36 | END_NAMESPACE(VulkanEngine) 37 | 38 | #endif //LEARNVULKAN_VULKANCONTEXT_H 39 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/core/VulkanRenderPass.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-5-23. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKANRENDERPASS_H 6 | #define LEARNVULKAN_VULKANRENDERPASS_H 7 | 8 | #include "render_common.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class VulkanRenderPass { 13 | public: 14 | VulkanRenderPass() = default; 15 | 16 | virtual ~VulkanRenderPass(); 17 | 18 | void setDevice(const VkDevice &device) { m_device = device; } 19 | 20 | void setFormat(VkFormat format) { m_format = format; } 21 | 22 | void setDepthFormat(VkFormat format) { m_depthFormat = format; } 23 | 24 | void createColorDepthPass(); 25 | 26 | void createDepthPass(); 27 | 28 | VkRenderPass &get() { return m_renderPass; } 29 | 30 | protected: 31 | VkDevice m_device = VK_NULL_HANDLE; 32 | VkRenderPass m_renderPass = VK_NULL_HANDLE; 33 | VkFormat m_format = VK_FORMAT_R32_SFLOAT; 34 | VkFormat m_depthFormat = VK_FORMAT_D16_UNORM; 35 | }; 36 | 37 | END_NAMESPACE(VulkanEngine) 38 | 39 | #endif //LEARNVULKAN_VULKANRENDERPASS_H 40 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/core/VulkanVertexDescriptions.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-25. 3 | // 4 | 5 | #include "VulkanVertexDescriptions.h" 6 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/engines/ThirdPersonEngine.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #include "ThirdPersonEngine.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void ThirdPersonEngine::updateCamera() { 10 | defaultTouchOperation(); 11 | 12 | if (m_touchMode == TouchMode::SINGLE) { 13 | if (m_mousePos[0].x > m_mousePosOld[0].x) { 14 | m_rotation.y += 1.f; 15 | } else if (m_mousePos[0].x < m_mousePosOld[0].x) { 16 | m_rotation.y -= 1.f; 17 | } 18 | if (m_mousePos[0].y > m_mousePosOld[0].y) { 19 | m_rotation.x += 1.f; 20 | } else if (m_mousePos[0].y < m_mousePosOld[0].y) { 21 | m_rotation.x -= 1.f; 22 | } 23 | } else if (m_touchMode == TouchMode::DOUBLE) { 24 | m_zoom = m_distance + m_baseZoom; 25 | } 26 | m_mousePosOld[0] = m_mousePos[0]; 27 | } 28 | 29 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/engines/ThirdPersonEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_THIRDPERSONENGINE_H 6 | #define LEARNVULKAN_THIRDPERSONENGINE_H 7 | 8 | #include "VulkanBaseEngine.h" 9 | #include "ThirdPersonCamera.h" 10 | 11 | BEGIN_NAMESPACE(VulkanEngine) 12 | 13 | class ThirdPersonEngine : public VulkanBaseEngine , public ThirdPersonCamera { 14 | public: 15 | ThirdPersonEngine() = default; 16 | virtual ~ThirdPersonEngine() {} 17 | 18 | void updateCamera(); 19 | }; 20 | 21 | END_NAMESPACE(VulkanEngine) 22 | 23 | #endif //LEARNVULKAN_THIRDPERSONENGINE_H 24 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/01_StaticTriangle/myobjects/Triangle.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_TRIANGLE_H 6 | #define LEARNVULKAN_TRIANGLE_H 7 | 8 | #include "object/mesh/MeshObject.h" 9 | #include "vertex_struct.h" 10 | 11 | BEGIN_NAMESPACE(VulkanEngine) 12 | 13 | class Triangle : public MeshObject { 14 | public: 15 | Triangle() = default; 16 | virtual ~Triangle(); 17 | 18 | void generateVertex() override; 19 | 20 | void updateVertex() override{} 21 | 22 | }; 23 | 24 | END_NAMESPACE(VulkanEngine) 25 | 26 | #endif //LEARNVULKAN_TRIANGLE_H 27 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/01_StaticTriangle/myobjects/TriangleShader.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #include "TriangleShader.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void TriangleShader::prepareShaders() { 10 | m_shaderStages.push_back( 11 | loadShader(FS::getPath("shaders/StaticTriangle/statictriangle.so.vert"), VK_SHADER_STAGE_VERTEX_BIT)); 12 | m_shaderStages.push_back( 13 | loadShader(FS::getPath("shaders/StaticTriangle/statictriangle.so.frag"), VK_SHADER_STAGE_FRAGMENT_BIT)); 14 | } 15 | 16 | END_NAMESPACE(VulkanEngine) 17 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/01_StaticTriangle/myobjects/TriangleShader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_TRIANGLESHADER_H 6 | #define LEARNVULKAN_TRIANGLESHADER_H 7 | 8 | #include "VulkanShader.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class TriangleShader : public VulkanShader { 13 | public: 14 | TriangleShader() = default; 15 | ~TriangleShader() = default; 16 | 17 | virtual void prepareShaders() override; 18 | }; 19 | 20 | END_NAMESPACE(VulkanEngine) 21 | 22 | #endif //LEARNVULKAN_TRIANGLESHADER_H 23 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/01_StaticTriangle/myobjects/TriangleUniform.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_TRIANGLEUNIFORM_H 6 | #define LEARNVULKAN_TRIANGLEUNIFORM_H 7 | 8 | #include "UniformCamera.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class TriangleUniform : public UniformCamera { 13 | public: 14 | TriangleUniform() = default; 15 | ~TriangleUniform() = default; 16 | 17 | virtual void updateUniformBuffers() override ; 18 | 19 | public: 20 | glm::vec3 *m_pRotation = nullptr; 21 | glm::vec3 *m_pCameraPos = nullptr; 22 | float *m_pZoom = nullptr; 23 | }; 24 | 25 | END_NAMESPACE(VulkanEngine) 26 | 27 | #endif //LEARNVULKAN_TRIANGLEUNIFORM_H 28 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/02_StaticCube/StaticCube.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-21. 3 | // 4 | 5 | #ifndef LEARNVULKAN_STATICCUBE_H 6 | #define LEARNVULKAN_STATICCUBE_H 7 | 8 | #include "ThirdPersonEngine.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class VulkanCube; 13 | 14 | class VulkanVertFragShader; 15 | 16 | class UniformCamera; 17 | 18 | class StaticCube : public ThirdPersonEngine { 19 | public: 20 | StaticCube() = default; 21 | 22 | virtual ~StaticCube(); 23 | 24 | void prepareMyObjects() override; 25 | 26 | void buildMyObjects(VkCommandBuffer &cmd) override; 27 | 28 | void render() override; 29 | 30 | void setDescriptorSet(); 31 | 32 | void createPipelines(); 33 | 34 | void createCube(); 35 | 36 | protected: 37 | std::shared_ptr m_cube = nullptr; 38 | std::shared_ptr m_cubeShader = nullptr; 39 | std::shared_ptr m_cubeUniform = nullptr; 40 | }; 41 | 42 | END_NAMESPACE(VulkanEngine) 43 | 44 | #endif //LEARNVULKAN_STATICCUBE_H 45 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/05_PhongLighting/ReflectParaBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #include "ReflectParaBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void ReflectParaBuffer::reflect() { 10 | if(getReflect() <= 0.f){ 11 | setReflect(1.f); 12 | } 13 | else{ 14 | setReflect(0.f); 15 | } 16 | } 17 | 18 | void ReflectParaBuffer::prepareUniformBuffers() { 19 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 20 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 21 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 22 | &m_uniformBuffer, sizeof(m_para), &m_para)); 23 | VK_CHECK_RESULT(m_uniformBuffer.map()); 24 | updateUniformBuffers(); 25 | } 26 | 27 | void ReflectParaBuffer::updateUniformBuffers() { 28 | memcpy(m_uniformBuffer.mapped, &m_para, sizeof(m_para)); 29 | } 30 | 31 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/05_PhongLighting/ReflectParaBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #ifndef LEARNVULKAN_REFLECTPARABUFFER_H 6 | #define LEARNVULKAN_REFLECTPARABUFFER_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class ReflectParaBuffer : public VulkanBuffer { 13 | public: 14 | struct ReflectPara{ 15 | glm::vec4 para; 16 | } m_para; 17 | 18 | public: 19 | ReflectParaBuffer() = default; 20 | ~ReflectParaBuffer() = default; 21 | 22 | void setReflect(float value) { m_para.para[0] = value; } 23 | 24 | float getReflect() { return m_para.para[0];} 25 | 26 | void reflect(); 27 | 28 | virtual void prepareUniformBuffers() override; 29 | virtual void updateUniformBuffers() override ; 30 | }; 31 | 32 | END_NAMESPACE(VulkanEngine) 33 | 34 | #endif //LEARNVULKAN_REFLECTPARABUFFER_H 35 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/06_InstanceDraw/SpeedBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-5-5. 3 | // 4 | 5 | #include "SpeedBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void SpeedBuffer::prepareUniformBuffers() { 10 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 11 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 12 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 13 | &m_uniformBuffer, sizeof(m_speedData), &m_speedData)); 14 | VK_CHECK_RESULT(m_uniformBuffer.map()); 15 | updateUniformBuffers(); 16 | } 17 | 18 | void SpeedBuffer::updateUniformBuffers() { 19 | memcpy(m_uniformBuffer.mapped, &m_speedData, sizeof(m_speedData)); 20 | } 21 | 22 | 23 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/06_InstanceDraw/SpeedBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-5-5. 3 | // 4 | 5 | #ifndef LEARNVULKAN_SPEEDBUFFER_H 6 | #define LEARNVULKAN_SPEEDBUFFER_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class SpeedBuffer : public VulkanBuffer { 13 | public: 14 | struct SpeedData{ 15 | glm::vec4 speed; 16 | } m_speedData; 17 | public: 18 | SpeedBuffer() = default; 19 | ~SpeedBuffer() = default; 20 | 21 | virtual void prepareUniformBuffers() override; 22 | virtual void updateUniformBuffers() override ; 23 | }; 24 | 25 | END_NAMESPACE(VulkanEngine) 26 | 27 | #endif //LEARNVULKAN_SPEEDBUFFER_H 28 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/07_ShadowMapping/ReflectParaBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #include "ReflectParaBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void ReflectParaBuffer::reflect() { 10 | if(getReflect() <= 0.f){ 11 | setReflect(1.f); 12 | } 13 | else{ 14 | setReflect(0.f); 15 | } 16 | } 17 | 18 | void ReflectParaBuffer::prepareUniformBuffers() { 19 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 20 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 21 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 22 | &m_uniformBuffer, sizeof(m_para), &m_para)); 23 | VK_CHECK_RESULT(m_uniformBuffer.map()); 24 | updateUniformBuffers(); 25 | } 26 | 27 | void ReflectParaBuffer::updateUniformBuffers() { 28 | memcpy(m_uniformBuffer.mapped, &m_para, sizeof(m_para)); 29 | } 30 | 31 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/07_ShadowMapping/ReflectParaBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #ifndef LEARNVULKAN_REFLECTPARABUFFER_H 6 | #define LEARNVULKAN_REFLECTPARABUFFER_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class ReflectParaBuffer : public VulkanBuffer { 13 | public: 14 | struct ReflectPara{ 15 | glm::vec4 para; 16 | } m_para; 17 | 18 | public: 19 | ReflectParaBuffer() = default; 20 | ~ReflectParaBuffer() = default; 21 | 22 | void setReflect(float value) { m_para.para[0] = value; } 23 | 24 | float getReflect() { return m_para.para[0];} 25 | 26 | void reflect(); 27 | 28 | virtual void prepareUniformBuffers() override; 29 | virtual void updateUniformBuffers() override ; 30 | }; 31 | 32 | END_NAMESPACE(VulkanEngine) 33 | 34 | #endif //LEARNVULKAN_REFLECTPARABUFFER_H 35 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/08_ShadowMappingOnmi/OnmiCamera.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 2021/8/16. 3 | // 4 | 5 | #include "OnmiCamera.h" 6 | 7 | #include 8 | 9 | BEGIN_NAMESPACE(VulkanEngine) 10 | 11 | void OnmiCamera::prepareUniformBuffers() { 12 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 13 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 14 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 15 | &m_uniformBuffer, sizeof(m_mvp), &m_mvp)); 16 | VK_CHECK_RESULT(m_uniformBuffer.map()); 17 | updateUniformBuffers(); 18 | } 19 | 20 | void OnmiCamera::updateUniformBuffers() { 21 | m_mvp.projection = glm::perspective((float)(M_PI / 2.0), 1.0f, 0.1f, 64.0f); 22 | m_mvp.view = glm::mat4(1.0f); 23 | m_mvp.model = glm::translate(glm::mat4(1.0f), glm::vec3(-m_mvp.lightpos.x, -m_mvp.lightpos.y, -m_mvp.lightpos.z)); 24 | memcpy(m_uniformBuffer.mapped, &m_mvp, sizeof(m_mvp)); 25 | } 26 | 27 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/08_ShadowMappingOnmi/OnmiCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 2021/8/16. 3 | // 4 | 5 | #ifndef LEARNVULKAN_ONMICAMERA_H 6 | #define LEARNVULKAN_ONMICAMERA_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class OnmiCamera : public VulkanBuffer { 13 | public: 14 | struct { 15 | glm::mat4 projection; 16 | glm::mat4 view; 17 | glm::mat4 model; 18 | glm::vec4 lightpos; 19 | }m_mvp; 20 | public: 21 | OnmiCamera() = default; 22 | 23 | virtual void prepareUniformBuffers() override; 24 | virtual void updateUniformBuffers() override ; 25 | }; 26 | 27 | END_NAMESPACE(VulkanEngine) 28 | 29 | #endif //LEARNVULKAN_ONMICAMERA_H 30 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/08_ShadowMappingOnmi/ReflectParaBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #include "ReflectParaBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | void ReflectParaBuffer::reflect() { 10 | if(getReflect() <= 0.f){ 11 | setReflect(1.f); 12 | } 13 | else{ 14 | setReflect(0.f); 15 | } 16 | } 17 | 18 | void ReflectParaBuffer::prepareUniformBuffers() { 19 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 20 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 21 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 22 | &m_uniformBuffer, sizeof(m_para), &m_para)); 23 | VK_CHECK_RESULT(m_uniformBuffer.map()); 24 | updateUniformBuffers(); 25 | } 26 | 27 | void ReflectParaBuffer::updateUniformBuffers() { 28 | memcpy(m_uniformBuffer.mapped, &m_para, sizeof(m_para)); 29 | } 30 | 31 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/08_ShadowMappingOnmi/ReflectParaBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #ifndef LEARNVULKAN_REFLECTPARABUFFER_H 6 | #define LEARNVULKAN_REFLECTPARABUFFER_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class ReflectParaBuffer : public VulkanBuffer { 13 | public: 14 | struct ReflectPara{ 15 | glm::vec4 para; 16 | } m_para; 17 | 18 | public: 19 | ReflectParaBuffer() = default; 20 | ~ReflectParaBuffer() = default; 21 | 22 | void setReflect(float value) { m_para.para[0] = value; } 23 | 24 | float getReflect() { return m_para.para[0];} 25 | 26 | void reflect(); 27 | 28 | virtual void prepareUniformBuffers() override; 29 | virtual void updateUniformBuffers() override ; 30 | }; 31 | 32 | END_NAMESPACE(VulkanEngine) 33 | 34 | #endif //LEARNVULKAN_REFLECTPARABUFFER_H 35 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/11_AssimpModel/ReflectParaBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #include "ReflectParaBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | BEGIN_NAMESPACE(AssimpSample) 10 | 11 | void ReflectParaBuffer::reflect() { 12 | if(getReflect() <= 0.f){ 13 | setReflect(1.f); 14 | } 15 | else{ 16 | setReflect(0.f); 17 | } 18 | } 19 | 20 | void ReflectParaBuffer::prepareUniformBuffers() { 21 | VK_CHECK_RESULT(m_context->vulkanDevice->createBuffer( 22 | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, 23 | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, 24 | &m_uniformBuffer, sizeof(m_para), &m_para)); 25 | VK_CHECK_RESULT(m_uniformBuffer.map()); 26 | updateUniformBuffers(); 27 | } 28 | 29 | void ReflectParaBuffer::updateUniformBuffers() { 30 | memcpy(m_uniformBuffer.mapped, &m_para, sizeof(m_para)); 31 | } 32 | 33 | END_NAMESPACE(AssimpSample) 34 | 35 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/examples/11_AssimpModel/ReflectParaBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-4-10. 3 | // 4 | 5 | #ifndef LEARNVULKAN_REFLECTPARABUFFER_H 6 | #define LEARNVULKAN_REFLECTPARABUFFER_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | BEGIN_NAMESPACE(AssimpSample) 13 | 14 | class ReflectParaBuffer : public VulkanBuffer { 15 | public: 16 | struct ReflectPara{ 17 | glm::vec4 para; 18 | } m_para; 19 | 20 | public: 21 | ReflectParaBuffer() = default; 22 | ~ReflectParaBuffer() = default; 23 | 24 | void setReflect(float value) { m_para.para[0] = value; } 25 | 26 | float getReflect() { return m_para.para[0];} 27 | 28 | void reflect(); 29 | 30 | virtual void prepareUniformBuffers() override; 31 | virtual void updateUniformBuffers() override ; 32 | }; 33 | 34 | END_NAMESPACE(AssimpSample) 35 | 36 | END_NAMESPACE(VulkanEngine) 37 | 38 | #endif //LEARNVULKAN_REFLECTPARABUFFER_H 39 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/plugins/assimp/AssimpObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 2021/6/20. 3 | // 4 | 5 | #ifndef LEARNVULKAN_ASSIMPOBJECT_H 6 | #define LEARNVULKAN_ASSIMPOBJECT_H 7 | 8 | #include "MeshObject.h" 9 | 10 | namespace vks{ 11 | class Model; 12 | } 13 | 14 | BEGIN_NAMESPACE(VulkanEngine) 15 | 16 | class AssimpObject : public MeshObject { 17 | public: 18 | AssimpObject() = default; 19 | 20 | virtual ~AssimpObject(); 21 | 22 | void setModelPath(const std::string &modelPath) { 23 | m_modelPath = modelPath; 24 | } 25 | 26 | void generateVertex() override; 27 | 28 | void updateVertex() override{} 29 | 30 | virtual void build(VkCommandBuffer &cmdBuffer, VulkanShader *vulkanShader) override; 31 | 32 | virtual void build(VkCommandBuffer &cmdBuffer, std::shared_ptr vulkanShader) override { 33 | build(cmdBuffer, vulkanShader.get()); 34 | } 35 | 36 | protected: 37 | std::string m_modelPath; 38 | vks::Model *m_model = nullptr; 39 | }; 40 | 41 | END_NAMESPACE(VulkanEngine) 42 | 43 | #endif //LEARNVULKAN_ASSIMPOBJECT_H 44 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/VkObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-26. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VKOBJECT_H 6 | #define LEARNVULKAN_VKOBJECT_H 7 | 8 | #include "vulkan_macro.h" 9 | #include "vulkan_template.h" 10 | #include "filesystem_utils.h" 11 | #include "VulkanDevice.hpp" 12 | #include "VulkanContext.h" 13 | 14 | BEGIN_NAMESPACE(VulkanEngine) 15 | 16 | interface VkObject{ 17 | public: 18 | VkObject() = default; 19 | 20 | virtual ~VkObject() = default; 21 | 22 | template 23 | static std::shared_ptr New(VulkanContext* context){ 24 | std::shared_ptr object = std::make_shared(); 25 | object->setContext(context); 26 | return object; 27 | } 28 | 29 | virtual void setContext(VulkanContext* context){ 30 | m_context = context; 31 | } 32 | 33 | virtual void prepare() = 0; 34 | 35 | virtual void update() = 0; 36 | 37 | protected: 38 | VulkanContext* m_context = nullptr; 39 | }; 40 | 41 | END_NAMESPACE(VulkanEngine) 42 | 43 | #endif //LEARNVULKAN_VKOBJECT_H 44 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/VulkanBuffer.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #include "VulkanBuffer.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | VulkanBuffer::~VulkanBuffer(){ 10 | m_uniformBuffer.unmap(); 11 | m_uniformBuffer.destroy(); 12 | } 13 | 14 | void VulkanBuffer::prepare() { 15 | prepareUniformBuffers(); 16 | } 17 | 18 | void VulkanBuffer::update() { 19 | updateUniformBuffers(); 20 | } 21 | 22 | END_NAMESPACE(VulkanEngine) 23 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/VulkanBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKANBUFFER_H 6 | #define LEARNVULKAN_VULKANBUFFER_H 7 | 8 | #include "VkObject.h" 9 | #include "VulkanContext.h" 10 | #include "VulkanBuffer.hpp" 11 | 12 | BEGIN_NAMESPACE(VulkanEngine) 13 | 14 | class VulkanBuffer : public VkObject { 15 | public: 16 | VulkanBuffer() = default; 17 | virtual ~VulkanBuffer(); 18 | 19 | virtual void prepare() override; 20 | 21 | virtual void update() override; 22 | 23 | virtual void prepareUniformBuffers() = 0; 24 | 25 | virtual void updateUniformBuffers() = 0; 26 | 27 | public: 28 | vks::Buffer m_uniformBuffer; 29 | }; 30 | 31 | END_NAMESPACE(VulkanEngine) 32 | 33 | #endif //LEARNVULKAN_VULKANBUFFER_H 34 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/camera/ShadowCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-5-24. 3 | // 4 | 5 | #ifndef LEARNVULKAN_SHADOWCAMERA_H 6 | #define LEARNVULKAN_SHADOWCAMERA_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class ShadowCamera : public VulkanBuffer { 13 | public: 14 | struct ShadowMVP { 15 | glm::mat4 depthMVP; 16 | }; 17 | public: 18 | ShadowCamera() = default; 19 | ~ShadowCamera() = default; 20 | 21 | virtual void prepareUniformBuffers() override; 22 | virtual void updateUniformBuffers() override ; 23 | 24 | public: 25 | ShadowMVP m_uboVS; 26 | float m_lightFOV = 45.f; 27 | float m_zNear = 1.f; 28 | float m_zFar = 96.f; 29 | glm::vec3 m_lightPos = glm::vec3(0.f); 30 | }; 31 | 32 | END_NAMESPACE(VulkanEngine) 33 | 34 | 35 | #endif //LEARNVULKAN_SHADOWCAMERA_H 36 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/camera/ThirdPersonCamera.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #include "ThirdPersonCamera.h" 6 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/camera/ThirdPersonCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_THIRDPERSONCAMERA_H 6 | #define LEARNVULKAN_THIRDPERSONCAMERA_H 7 | 8 | #include 9 | 10 | class ThirdPersonCamera { 11 | public: 12 | ThirdPersonCamera()=default; 13 | ~ThirdPersonCamera()=default; 14 | 15 | glm::vec3 m_rotation = glm::vec3(); 16 | glm::vec3 m_cameraPos = glm::vec3(); 17 | const float m_baseZoom = -2.f; 18 | float m_zoom = m_baseZoom; 19 | }; 20 | 21 | 22 | #endif //LEARNVULKAN_THIRDPERSONCAMERA_H 23 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/camera/UniformCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #ifndef LEARNVULKAN_UNIFORMCAMERA_H 6 | #define LEARNVULKAN_UNIFORMCAMERA_H 7 | 8 | #include "VulkanBuffer.h" 9 | 10 | BEGIN_NAMESPACE(VulkanEngine) 11 | 12 | class UniformCamera : public VulkanBuffer { 13 | public: 14 | struct CameraMatrix{ 15 | glm::mat4 projection; 16 | glm::mat4 model; 17 | glm::mat4 view; 18 | glm::mat4 normal; 19 | glm::vec4 lightpos; 20 | }; 21 | 22 | public: 23 | UniformCamera() = default; 24 | ~UniformCamera() = default; 25 | 26 | virtual void prepareUniformBuffers() override; 27 | virtual void updateUniformBuffers() override ; 28 | 29 | public: 30 | CameraMatrix m_uboVS; 31 | 32 | glm::vec3 *m_pRotation = nullptr; 33 | glm::vec3 *m_pCameraPos = nullptr; 34 | float *m_pZoom = nullptr; 35 | 36 | }; 37 | 38 | END_NAMESPACE(VulkanEngine) 39 | 40 | #endif //LEARNVULKAN_UNIFORMCAMERA_H 41 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/mesh/MeshObject.cxx: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-2-28. 3 | // 4 | 5 | #include "MeshObject.h" 6 | 7 | BEGIN_NAMESPACE(VulkanEngine) 8 | 9 | MeshObject::~MeshObject() { 10 | m_vertexBuffer.destroy(); 11 | m_indexBuffer.destroy(); 12 | } 13 | 14 | void MeshObject::prepare() { 15 | generateVertex(); 16 | } 17 | 18 | void MeshObject::update() { 19 | updateVertex(); 20 | } 21 | 22 | void MeshObject::build(VkCommandBuffer &cmdBuffer, VulkanShader* vulkanShader) { 23 | VkDeviceSize offsets[1] = {0}; 24 | if (vulkanShader->getPipeLine()) { 25 | vkCmdBindPipeline(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, vulkanShader->getPipeLine()); 26 | } else { 27 | std::cout << "Pipeline null,bind failure" << std::endl; 28 | } 29 | vkCmdBindVertexBuffers(cmdBuffer, VERTEX_BUFFER_BIND_ID, 1, &m_vertexBuffer.buffer, offsets); 30 | vkCmdBindIndexBuffer(cmdBuffer, m_indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32); 31 | vkCmdDrawIndexed(cmdBuffer, m_indexCount, 1, 0, 0, 0); 32 | } 33 | 34 | END_NAMESPACE(VulkanEngine) -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/mesh/VulkanCube.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-3-14. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKANCUBE_H 6 | #define LEARNVULKAN_VULKANCUBE_H 7 | 8 | #include "vertex_struct.h" 9 | #include "MeshObject.h" 10 | 11 | BEGIN_NAMESPACE(VulkanEngine) 12 | 13 | class VulkanCube : public MeshObject { 14 | public: 15 | VulkanCube() = default; 16 | virtual ~VulkanCube(); 17 | 18 | void generateVertex() override; 19 | 20 | void updateVertex() override{} 21 | 22 | void setSize(float a, float b, float c){ 23 | m_a = a; 24 | m_b = b; 25 | m_c = c; 26 | } 27 | 28 | protected: 29 | float m_a = 1.f; 30 | float m_b = 1.f; 31 | float m_c = 1.f; 32 | }; 33 | 34 | END_NAMESPACE(VulkanEngine) 35 | 36 | #endif //LEARNVULKAN_VULKANCUBE_H 37 | -------------------------------------------------------------------------------- /Android/app/src/main/cpp/template/object/mesh/VulkanPlane.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by wjl on 21-5-17. 3 | // 4 | 5 | #ifndef LEARNVULKAN_VULKANPLANE_H 6 | #define LEARNVULKAN_VULKANPLANE_H 7 | 8 | #include "vertex_struct.h" 9 | #include "MeshObject.h" 10 | 11 | BEGIN_NAMESPACE(VulkanEngine) 12 | 13 | class VulkanPlane : public MeshObject { 14 | public: 15 | VulkanPlane() = default; 16 | 17 | ~VulkanPlane(); 18 | 19 | void generateVertex() override; 20 | 21 | void updateVertex() override {} 22 | 23 | void setSize(float a, float b) { 24 | m_a = a; 25 | m_b = b; 26 | } 27 | 28 | protected: 29 | float m_a = 1.f; 30 | float m_b = 1.f; 31 | }; 32 | 33 | END_NAMESPACE(VulkanEngine) 34 | 35 | #endif //LEARNVULKAN_VULKANPLANE_H 36 | -------------------------------------------------------------------------------- /Android/app/src/main/java/com/engineer1109/learnvulkan/model/MenuData.java: -------------------------------------------------------------------------------- 1 | package com.engineer1109.learnvulkan.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class MenuData implements Serializable { 6 | private int mID = 0; 7 | 8 | private String mMenuText = ""; 9 | 10 | private int mKind = 0; 11 | 12 | public int getID() { 13 | return mID; 14 | } 15 | 16 | public void setID(int mID) { 17 | this.mID = mID; 18 | } 19 | 20 | public String getMenuText() { 21 | return mMenuText; 22 | } 23 | 24 | public void setMenuText(String mMenuText) { 25 | this.mMenuText = mMenuText; 26 | } 27 | 28 | public int getKind() { 29 | return mKind; 30 | } 31 | 32 | public void setKind(int mKind) { 33 | this.mKind = mKind; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Android/app/src/main/res/layout/layout_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |