├── .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 |
16 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Android/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LearnVulkan
3 |
--------------------------------------------------------------------------------
/Android/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/Android/app/src/test/java/com/engineer1109/learnvulkan/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.engineer1109.learnvulkan;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:4.1.2"
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/Android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 17 20:14:26 CST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
7 |
--------------------------------------------------------------------------------
/Android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "LearnVulkan"
--------------------------------------------------------------------------------
/bin/README.md:
--------------------------------------------------------------------------------
1 | This is the install directory.
2 | Remember
3 | ```
4 | export LD_LIBRARY_PATH=./:/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
5 | ```
6 |
--------------------------------------------------------------------------------
/bin/data/dummy:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/cmake/Config.cmake:
--------------------------------------------------------------------------------
1 | option(GIT_ThirdParty "git submodule the thirdparty" ON)
2 | option(USE_OpenMP "Use CPU Multithread OpenMP" ON)
3 | option(BUILD_BASE "Build libvulkanbase.so" ON)
4 | option(BUILD_SimpleExamples "Build SimpleExamples" ON)
5 | option(BUILD_AdvExamples "Build AdancedExamples" OFF)
6 | option(BUILD_QtExamples "Build SimpleExamples" OFF)
7 | set(QT_VERSION_MAJOR 5)
8 |
--------------------------------------------------------------------------------
/cmake/FindAssimp.cmake:
--------------------------------------------------------------------------------
1 | if(BUILD_AdvExamples MATCHES ON)
2 | find_package(assimp REQUIRED)
3 | add_definitions(-DBUILD_ASSIMP)
4 | else()
5 | find_package(assimp)
6 | if(assimp_FOUND)
7 | message("Found Assimp,enable Advanced Examples Build.")
8 | set(BUILD_AdvExamples ON)
9 | add_definitions(-DBUILD_ASSIMP)
10 | else()
11 | message("Assimp not found, Advanced Examples will not be built.")
12 | message("or you manually set path.And try 'cmake .. -DBUILD_AdvExamples=ON' ")
13 | endif()
14 | endif()
15 |
--------------------------------------------------------------------------------
/cmake/FindOpenMP.cmake:
--------------------------------------------------------------------------------
1 | if(USE_OpenMP MATCHES ON)
2 | FIND_PACKAGE( OpenMP REQUIRED)
3 | if(OPENMP_FOUND)
4 | message("OPENMP FOUND")
5 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
7 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
8 | endif()
9 | endif()
10 |
--------------------------------------------------------------------------------
/cmake/FindQt.cmake:
--------------------------------------------------------------------------------
1 | find_package(Qt6 COMPONENTS Widgets)
2 |
3 | if (Qt6_FOUND)
4 | set(QT_VERSION_MAJOR 6)
5 | set(BUILD_QtExamples ON)
6 | message("Find QT6")
7 | else()
8 | find_package(Qt5 COMPONENTS Widgets)
9 | if (Qt5_FOUND)
10 | set(QT_VERSION_MAJOR 5)
11 | set(BUILD_QtExamples ON)
12 | message("Find QT5")
13 | else()
14 | message("Qt${QT_VERSION_MAJOR} not Found, you need to manually set your Qt Path. And try cmake .. -DBUILD_QtExamples=ON")
15 | endif()
16 | endif()
17 |
18 | return()
19 |
--------------------------------------------------------------------------------
/cmake/FindVulkan.cmake:
--------------------------------------------------------------------------------
1 | Find_Package(Vulkan)
2 | if(Vulkan_FOUND)
3 | message("Vulkan has been found in")
4 | message(${Vulkan_INCLUDE_DIRS})
5 | message(${Vulkan_LIBRARIES})
6 | include_directories(${Vulkan_INCLUDE_DIRS})
7 | link_directories(${Vulkan_LIBRARY})
8 | else()
9 | message("Vulkan not found.Do you set your VulkanSdk PATH correctly?")
10 | message("link and include /usr/local instead")
11 | include_directories(/usr/local/include)
12 | link_directories(/usr/local/lib)
13 | if(UNIX)
14 | set(Vulkan_LIBRARIES vulkan)
15 | else()
16 | set(Vulkan_LIBRARIES vulkan-1)
17 | endif()
18 | endif()
19 |
--------------------------------------------------------------------------------
/cmake/Functions.cmake:
--------------------------------------------------------------------------------
1 | function(set_work_dir_function pro_name)
2 | if(WIN32)
3 | SET_TARGET_PROPERTIES(${pro_name}
4 | PROPERTIES
5 | VS_DEBUGGER_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/bin
6 | )
7 | endif()
8 | endfunction()
--------------------------------------------------------------------------------
/cmake/GCC.cmake:
--------------------------------------------------------------------------------
1 | if(UNIX)
2 | set(CMAKE_EXE_LINKER_FLAGS "-fno-pie -no-pie")
3 | add_definitions("-std=c++17 -fPIC")
4 | add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
5 | elseif(WIN32)
6 | add_definitions(-DNOMINMAX)
7 | add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
8 | endif()
9 | set(CMAKE_CXX_STANDARD 17)
10 |
--------------------------------------------------------------------------------
/cmake/Git.cmake:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | project(newproject)
3 |
4 | FIND_PACKAGE( OpenMP REQUIRED)
5 | if(OPENMP_FOUND)
6 | message("OPENMP FOUND")
7 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
9 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
10 | endif()
11 |
12 | #find_package(OpenCV REQUIRED)
13 | #include_directories(${OpenCV_INCLUDE_DIRS})
14 | #message("opencv include dir")
15 | #message(${OpenCV_INCLUDE_DIRS})
16 | #link_directories(${OpenCV_LIBS})
17 |
18 |
19 | #set(LIBS ${LIBS} ${OpenCV_LIBS})
20 |
21 |
22 | #add_executable(main main.cxx)
23 | #target_link_libraries(main ${LIBS} pthread)
24 | #set_property(TARGET main PROPERTY CXX_STANDARD 11)
25 |
--------------------------------------------------------------------------------
/cmake/Report.cmake:
--------------------------------------------------------------------------------
1 | message("=============BUILD CONFIG=============")
2 | message("BUILD_Base\t\tON")
3 | message("BUILD_BaseEngine\t\tON")
4 | if(BUILD_AdvExamples MATCHES ON)
5 | message("BUILD_AdvExamples\t\tON")
6 | else()
7 | message("BUILD_AdvExamples\t\tOFF")
8 | endif()
9 | if(BUILD_QtExamples MATCHES ON)
10 | message("BUILD_QtExamples\t\tON")
11 | message("BUILD_QtVulkanWidget\t\tON")
12 | else()
13 | message("BUILD_QtExamples\t\tOFF")
14 | message("BUILD_QtVulkanWidget\t\tOFF")
15 | endif()
16 | message("======================================")
17 | message("Use cmake-gui .. to config.")
18 |
--------------------------------------------------------------------------------
/data/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/data/gif/output.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/gif/output.gif
--------------------------------------------------------------------------------
/data/shaders/InstanceDraw/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V instancedraw.glsl.frag -o instancedraw.so.frag
3 | glslangValidator -V instancedraw.glsl.vert -o instancedraw.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/InstanceDraw/instancedraw.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/InstanceDraw/instancedraw.so.frag
--------------------------------------------------------------------------------
/data/shaders/InstanceDraw/instancedraw.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/InstanceDraw/instancedraw.so.vert
--------------------------------------------------------------------------------
/data/shaders/Makefile:
--------------------------------------------------------------------------------
1 | define compileVertFrag
2 | glslangValidator -V $(1)/$(2).glsl.frag -o $(1)/$(2).so.frag
3 | glslangValidator -V $(1)/$(2).glsl.vert -o $(1)/$(2).so.vert
4 | endef
5 |
6 | all:
7 | $(call compileVertFrag,StaticTriangle,statictriangle)
8 | $(call compileVertFrag,StaticCube,staticcube)
9 | $(call compileVertFrag,Texture2dCube,texture2d)
10 | $(call compileVertFrag,Skybox,skybox)
11 | $(call compileVertFrag,PhongLighting,phonglighting)
12 | $(call compileVertFrag,InstanceDraw,instancedraw)
13 | $(call compileVertFrag,ShadowMapping,plane)
14 | $(call compileVertFrag,ShadowMapping,quad)
15 | $(call compileVertFrag,ShadowMapping,scene)
16 | $(call compileVertFrag,ShadowMapping,shadow)
17 | $(call compileVertFrag,ShadowMappingOnmi,cubemapdisplay)
18 | $(call compileVertFrag,ShadowMappingOnmi,offscreen)
19 | $(call compileVertFrag,ShadowMappingOnmi,room)
20 | $(call compileVertFrag,ShadowMappingOnmi,scene)
21 | $(call compileVertFrag,VolumeFog,volumefog)
22 |
--------------------------------------------------------------------------------
/data/shaders/PhongLighting/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V phonglighting.glsl.frag -o phonglighting.so.frag
3 | glslangValidator -V phonglighting.glsl.vert -o phonglighting.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/PhongLighting/phonglighting.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/PhongLighting/phonglighting.so.frag
--------------------------------------------------------------------------------
/data/shaders/PhongLighting/phonglighting.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/PhongLighting/phonglighting.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V scene.glsl.frag -o scene.so.frag
3 | glslangValidator -V scene.glsl.vert -o scene.so.vert
4 | glslangValidator -V plane.glsl.frag -o plane.so.frag
5 | glslangValidator -V plane.glsl.vert -o plane.so.vert
6 | glslangValidator -V shadow.glsl.frag -o shadow.so.frag
7 | glslangValidator -V shadow.glsl.vert -o shadow.so.vert
8 | glslangValidator -V quad.glsl.frag -o quad.so.frag
9 | glslangValidator -V quad.glsl.vert -o quad.so.vert
10 |
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/plane.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/plane.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/plane.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/plane.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/quad.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (binding = 5) uniform sampler2D shadowMap;
4 |
5 | layout (location = 0) in vec3 inUV;
6 |
7 | layout (location = 0) out vec4 outFragColor;
8 |
9 | float LinearizeDepth(float depth)
10 | {
11 | float n = 1.0; // camera z near
12 | float f = 128.0; // camera z far
13 | float z = depth;
14 | return (2.0 * n) / (f + n - z * (f - n));
15 | }
16 |
17 | void main()
18 | {
19 | float depth = texture(shadowMap, inUV.xy).r;
20 | outFragColor = vec4(vec3(1.0-LinearizeDepth(depth)), 1.0);
21 | }
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/quad.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | out gl_PerVertex
8 | {
9 | vec4 gl_Position;
10 | };
11 |
12 | layout (location = 0) out vec3 outUV;
13 |
14 | void main()
15 | {
16 | outUV = inUV.xyz;
17 | gl_Position = vec4(vec2(inPos.x + 0.5f, inPos.z + 0.5f), 0.0, 1.0);
18 | }
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/quad.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/quad.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/quad.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/quad.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/scene.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/scene.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/scene.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/scene.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/shadow.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout(location = 0) out vec4 color;
4 |
5 | void main()
6 | {
7 | color = vec4(1.0, 0.0, 0.0, 1.0);
8 | }
9 |
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/shadow.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 6) uniform UBO
8 | {
9 | mat4 depthMVP;
10 | } ubo;
11 |
12 | out gl_PerVertex
13 | {
14 | vec4 gl_Position;
15 | };
16 |
17 |
18 | void main()
19 | {
20 | gl_Position = ubo.depthMVP * vec4(inPos, 1.0);
21 | }
22 |
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/shadow.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/shadow.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMapping/shadow.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMapping/shadow.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V scene.glsl.frag -o scene.so.frag
3 | glslangValidator -V scene.glsl.vert -o scene.so.vert
4 | glslangValidator -V room.glsl.frag -o room.so.frag
5 | glslangValidator -V room.glsl.vert -o room.so.vert
6 | glslangValidator -V offscreen.glsl.frag -o offscreen.so.frag
7 | glslangValidator -V offscreen.glsl.vert -o offscreen.so.vert
8 | glslangValidator -V cubemapdisplay.glsl.frag -o cubemapdisplay.so.frag
9 | glslangValidator -V cubemapdisplay.glsl.vert -o cubemapdisplay.so.vert
10 |
11 |
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/cubemapdisplay.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (location = 0) out vec2 outUV;
8 |
9 | void main()
10 | {
11 | outUV = inUV.xy;
12 | gl_Position = vec4(vec2(inPos.x * 0.5f + 0.5f, inPos.z * 0.5f + 0.5f), 0.0, 1.0);
13 | // outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
14 | // gl_Position = vec4(outUV.xy * 2.0f - 1.0f, 0.0f, 1.0f);
15 | }
16 |
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/cubemapdisplay.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/cubemapdisplay.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/cubemapdisplay.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/cubemapdisplay.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/offscreen.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) out vec4 outFragColor;
4 |
5 | layout (location = 0) in vec4 inPos;
6 | layout (location = 1) in vec3 inLightPos;
7 |
8 | void main()
9 | {
10 | // Store distance to light as 32 bit float value
11 | vec3 lightVec = inPos.xyz - inLightPos;
12 | outFragColor = vec4(vec3(length(lightVec)) , 1.f);
13 | }
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/offscreen.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO2
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo_origin;
15 |
16 | layout (binding = 10) uniform UBO
17 | {
18 | mat4 projection;
19 | mat4 model;
20 | mat4 view;
21 | mat4 normal;
22 | vec4 lightpos;
23 | } ubo;
24 |
25 | layout(push_constant) uniform PushConsts
26 | {
27 | mat4 view;
28 | } pushConsts;
29 |
30 | out gl_PerVertex
31 | {
32 | vec4 gl_Position;
33 | };
34 |
35 | layout (location = 1) out vec4 outPos;
36 | layout (location = 2) out vec3 outLightPos;
37 |
38 | void main()
39 | {
40 | mat4 model = mat4(1.0f);
41 | gl_Position = ubo.projection * pushConsts.view * ubo.model * vec4(inPos, 1.0);
42 |
43 | outPos = vec4(inPos, 1.0);
44 | outLightPos = (ubo.lightpos).xyz;
45 | }
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/offscreen.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/offscreen.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/offscreen.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/offscreen.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/room.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/room.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/room.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/room.so.vert
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/scene.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/scene.so.frag
--------------------------------------------------------------------------------
/data/shaders/ShadowMappingOnmi/scene.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/ShadowMappingOnmi/scene.so.vert
--------------------------------------------------------------------------------
/data/shaders/Skybox/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V skybox.glsl.frag -o skybox.so.frag
3 | glslangValidator -V skybox.glsl.vert -o skybox.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/Skybox/skybox.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (binding = 3) uniform samplerCube samplerCubeMap;
4 |
5 | layout (location = 0) in vec3 inUV;
6 |
7 | layout (location = 0) out vec4 outFragColor;
8 |
9 | void main() {
10 | outFragColor = texture(samplerCubeMap, inUV);
11 | gl_FragDepth = 1.f;
12 | }
13 |
--------------------------------------------------------------------------------
/data/shaders/Skybox/skybox.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo;
15 |
16 | layout (location = 0) out vec3 outUV;
17 |
18 | void main() {
19 | outUV = inPos;
20 | outUV.x *= -1.0;
21 | outUV.y *= -1.0;
22 | vec3 pos = inPos.xyz * 10.f;
23 | gl_Position = ubo.projection * ubo.model * vec4(pos, 1.0);
24 | }
25 |
--------------------------------------------------------------------------------
/data/shaders/Skybox/skybox.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/Skybox/skybox.so.frag
--------------------------------------------------------------------------------
/data/shaders/Skybox/skybox.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/Skybox/skybox.so.vert
--------------------------------------------------------------------------------
/data/shaders/StaticCube/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V staticcube.glsl.frag -o staticcube.so.frag
3 | glslangValidator -V staticcube.glsl.vert -o staticcube.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/StaticCube/staticcube.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inUV;
4 |
5 | layout (location = 0) out vec4 outFragColor;
6 |
7 | void main()
8 | {
9 | outFragColor = vec4(inUV , 1.0);
10 | }
11 |
--------------------------------------------------------------------------------
/data/shaders/StaticCube/staticcube.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo;
15 |
16 | layout (location = 0) out vec3 outUV;
17 | layout (location = 2) out vec3 outNormal;
18 |
19 | out gl_PerVertex
20 | {
21 | vec4 gl_Position;
22 | };
23 |
24 | void main()
25 | {
26 | outUV = inPos*0.5f+vec3(0.5f);
27 |
28 | mat4 modelView = ubo.view * ubo.model;
29 | vec4 pos = modelView * vec4(inPos.xyz, 1.0);
30 |
31 | gl_Position = ubo.projection * pos;
32 | }
33 |
--------------------------------------------------------------------------------
/data/shaders/StaticCube/staticcube.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/StaticCube/staticcube.so.frag
--------------------------------------------------------------------------------
/data/shaders/StaticCube/staticcube.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/StaticCube/staticcube.so.vert
--------------------------------------------------------------------------------
/data/shaders/StaticTriangle/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V statictriangle.glsl.frag -o statictriangle.so.frag
3 | glslangValidator -V statictriangle.glsl.vert -o statictriangle.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/StaticTriangle/statictriangle.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inUV;
4 |
5 | layout (location = 0) out vec4 outFragColor;
6 |
7 | void main()
8 | {
9 | outFragColor = vec4(inUV , 1.0);
10 | }
11 |
--------------------------------------------------------------------------------
/data/shaders/StaticTriangle/statictriangle.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo;
15 |
16 | layout (location = 0) out vec3 outUV;
17 | layout (location = 2) out vec3 outNormal;
18 |
19 | out gl_PerVertex
20 | {
21 | vec4 gl_Position;
22 | };
23 |
24 | void main()
25 | {
26 | outUV = inUV.rgb;
27 |
28 | mat4 modelView = ubo.view * ubo.model;
29 | vec4 pos = modelView * vec4(inPos.xyz, 1.0);
30 |
31 | gl_Position = ubo.projection * pos;
32 | }
33 |
--------------------------------------------------------------------------------
/data/shaders/StaticTriangle/statictriangle.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/StaticTriangle/statictriangle.so.frag
--------------------------------------------------------------------------------
/data/shaders/StaticTriangle/statictriangle.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/StaticTriangle/statictriangle.so.vert
--------------------------------------------------------------------------------
/data/shaders/Texture2dCube/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V texture2d.glsl.frag -o texture2d.so.frag
3 | glslangValidator -V texture2d.glsl.vert -o texture2d.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/Texture2dCube/texture2d.glsl.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (binding = 1) uniform sampler2D samplerTextureA;
4 |
5 | layout (binding = 2) uniform sampler2D samplerTextureB;
6 |
7 | layout (location = 0) in vec3 inUV;
8 |
9 | layout (location = 0) out vec4 outFragColor;
10 |
11 | void main()
12 | {
13 | vec4 colorA = texture(samplerTextureA, inUV.xy, 1.0f);
14 | vec4 colorB = texture(samplerTextureB, inUV.xy, 1.0f);
15 |
16 | outFragColor = vec4(0.5*colorA.rgb + 0.5*colorB.rgb , 1.0);
17 | }
18 |
--------------------------------------------------------------------------------
/data/shaders/Texture2dCube/texture2d.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec4 inUV;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo;
15 |
16 | layout (location = 0) out vec3 outUV;
17 |
18 | out gl_PerVertex
19 | {
20 | vec4 gl_Position;
21 | };
22 |
23 | void main()
24 | {
25 | outUV = inUV.xyz;
26 |
27 | gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0);
28 | }
29 |
--------------------------------------------------------------------------------
/data/shaders/Texture2dCube/texture2d.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/Texture2dCube/texture2d.so.frag
--------------------------------------------------------------------------------
/data/shaders/Texture2dCube/texture2d.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/Texture2dCube/texture2d.so.vert
--------------------------------------------------------------------------------
/data/shaders/VolumeFog/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | glslangValidator -V volumefog.glsl.frag -o volumefog.so.frag
3 | glslangValidator -V volumefog.glsl.vert -o volumefog.so.vert
4 |
--------------------------------------------------------------------------------
/data/shaders/VolumeFog/volumefog.glsl.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec3 inPos;
4 | layout (location = 1) in vec3 inUVW;
5 | layout (location = 2) in vec3 inNormal;
6 |
7 | layout (binding = 0) uniform UBO
8 | {
9 | mat4 projection;
10 | mat4 model;
11 | mat4 view;
12 | mat4 normal;
13 | vec4 lightpos;
14 | } ubo;
15 |
16 | layout (binding = 1) uniform ModelView
17 | {
18 | mat4 model;
19 | } volumeModel;
20 |
21 | layout (location = 0) out vec3 outUV;
22 | layout (location = 1) out mat4 outVolumeModel;
23 | layout (location = 5) out mat4 outCubeProjModel;
24 |
25 | out gl_PerVertex
26 | {
27 | vec4 gl_Position;
28 | };
29 |
30 | void main()
31 | {
32 | vec3 pos = inPos * 3.f;
33 | // outUV = vec3(inUVW);
34 | outVolumeModel = volumeModel.model;
35 | outCubeProjModel = ubo.projection * ubo.view * ubo.model;
36 |
37 | float ratio = ubo.projection[0][0] / ubo.projection[1][1];
38 | outUV = vec3(pos.x / ratio * 0.5f + (0.5f), pos.y * 0.5f + 0.5f, 0.f);
39 | gl_Position = vec4(pos, 1.0);
40 | }
41 |
--------------------------------------------------------------------------------
/data/shaders/VolumeFog/volumefog.so.frag:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/VolumeFog/volumefog.so.frag
--------------------------------------------------------------------------------
/data/shaders/VolumeFog/volumefog.so.vert:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/VolumeFog/volumefog.so.vert
--------------------------------------------------------------------------------
/data/shaders/base/uioverlay.frag:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (binding = 0) uniform sampler2D fontSampler;
4 |
5 | layout (location = 0) in vec2 inUV;
6 | layout (location = 1) in vec4 inColor;
7 |
8 | layout (location = 0) out vec4 outColor;
9 |
10 | void main()
11 | {
12 | outColor = inColor * texture(fontSampler, inUV);
13 | }
--------------------------------------------------------------------------------
/data/shaders/base/uioverlay.frag.spv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/base/uioverlay.frag.spv
--------------------------------------------------------------------------------
/data/shaders/base/uioverlay.vert:
--------------------------------------------------------------------------------
1 | #version 450
2 |
3 | layout (location = 0) in vec2 inPos;
4 | layout (location = 1) in vec2 inUV;
5 | layout (location = 2) in vec4 inColor;
6 |
7 | layout (push_constant) uniform PushConstants {
8 | vec2 scale;
9 | vec2 translate;
10 | } pushConstants;
11 |
12 | layout (location = 0) out vec2 outUV;
13 | layout (location = 1) out vec4 outColor;
14 |
15 | out gl_PerVertex
16 | {
17 | vec4 gl_Position;
18 | };
19 |
20 | void main()
21 | {
22 | outUV = inUV;
23 | outColor = inColor;
24 | gl_Position = vec4(inPos * pushConstants.scale + pushConstants.translate, 0.0, 1.0);
25 | }
--------------------------------------------------------------------------------
/data/shaders/base/uioverlay.vert.spv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/shaders/base/uioverlay.vert.spv
--------------------------------------------------------------------------------
/data/textures/awesomeface.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/awesomeface.png
--------------------------------------------------------------------------------
/data/textures/container.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/container.png
--------------------------------------------------------------------------------
/data/textures/skybox/back.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/back.jpg
--------------------------------------------------------------------------------
/data/textures/skybox/bottom.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/bottom.jpg
--------------------------------------------------------------------------------
/data/textures/skybox/front.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/front.jpg
--------------------------------------------------------------------------------
/data/textures/skybox/left.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/left.jpg
--------------------------------------------------------------------------------
/data/textures/skybox/right.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/right.jpg
--------------------------------------------------------------------------------
/data/textures/skybox/top.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/skybox/top.jpg
--------------------------------------------------------------------------------
/data/textures/wood.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/data/textures/wood.png
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/01_StaticTriangle/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 01_StaticTriangle)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/01_StaticTriangle/StaticTriangle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 21-2-21.
3 | //
4 |
5 | #ifndef LEARNVULKAN_STATICTRIANGLE_H
6 | #define LEARNVULKAN_STATICTRIANGLE_H
7 |
8 | #include "ThirdPersonEngine.h"
9 |
10 | BEGIN_NAMESPACE(VulkanEngine)
11 |
12 | class Triangle;
13 |
14 | class TriangleShader;
15 |
16 | class TriangleUniform;
17 |
18 | class StaticTriangle : public ThirdPersonEngine{
19 | public:
20 | StaticTriangle() = default;
21 |
22 | virtual ~StaticTriangle();
23 |
24 | public:
25 |
26 | void prepareMyObjects() override ;
27 |
28 | void buildMyObjects(VkCommandBuffer &cmd) override ;
29 |
30 | void render() override;
31 |
32 | void setDescriptorSet();
33 |
34 | void createPipelines();
35 |
36 | void createTriangle();
37 |
38 | private:
39 | std::shared_ptr m_triangle = nullptr;
40 | std::shared_ptr m_triangleShader = nullptr;
41 | std::shared_ptr m_triangleUniform = nullptr;
42 | };
43 |
44 | END_NAMESPACE(VulkanEngine)
45 |
46 | #endif //LEARNVULKAN_STATICTRIANGLE_H
47 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/01_StaticTriangle/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "StaticTriangle.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::StaticTriangle* engine = new VulkanEngine::StaticTriangle();
9 | engine->parseArgs(argc, argv);
10 | engine->initWindow();
11 | engine->initVulkan();
12 | engine->prepare();
13 | engine->renderLoop();
14 | return 1;
15 | }
16 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/02_StaticCube/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 02_StaticCube)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/02_StaticCube/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "StaticCube.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::StaticCube* engine = new VulkanEngine::StaticCube();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/03_Texture2dCube/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 03_Texture2dCube)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/03_Texture2dCube/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "Texture2dCube.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::Texture2dCube* engine = new VulkanEngine::Texture2dCube();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/04_Skybox/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 04_SkyboxCube)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/04_Skybox/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "SkyboxCube.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::SkyboxCube* engine = new VulkanEngine::SkyboxCube();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/05_PhongLighting/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 05_PhongLighting)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/05_PhongLighting/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "PhongLighting.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::PhongLighting* engine = new VulkanEngine::PhongLighting();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/06_InstanceDraw/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 06_InstanceDraw)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/06_InstanceDraw/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "InstanceDraw.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::InstanceDraw* engine = new VulkanEngine::InstanceDraw();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/07_ShadowMapping/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 07_ShadowMapping)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/07_ShadowMapping/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "ShadowMapping.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::ShadowMapping* engine = new VulkanEngine::ShadowMapping();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/08_ShadowMappingOnmi/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 08_ShadowMappingOnmi)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/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 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/08_ShadowMappingOnmi/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/4/7.
3 | //
4 |
5 | #include "ShadowMappingOnmi.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::ShadowMappingOnmi* engine = new VulkanEngine::ShadowMappingOnmi();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/09_VolumeFog/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 09_VolumeFog)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/09_VolumeFog/VolumeModelUniform.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #include "VolumeModelUniform.h"
6 |
7 | BEGIN_NAMESPACE(VulkanEngine)
8 |
9 | void VolumeModelUniform::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_model), &m_model));
14 | VK_CHECK_RESULT(m_uniformBuffer.map());
15 | updateUniformBuffers();
16 | }
17 |
18 | void VolumeModelUniform::updateUniformBuffers() {
19 | memcpy(m_uniformBuffer.mapped, &m_model, sizeof(m_model));
20 | }
21 |
22 | END_NAMESPACE(VulkanEngine)
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/09_VolumeFog/VolumeModelUniform.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #ifndef LEARNVULKAN_VOLUMEMODELUNIFORM_H
6 | #define LEARNVULKAN_VOLUMEMODELUNIFORM_H
7 |
8 | #include "VulkanBuffer.h"
9 |
10 | BEGIN_NAMESPACE(VulkanEngine)
11 |
12 | class VolumeModelUniform : public VulkanBuffer {
13 | public:
14 | struct ReflectPara{
15 | glm::mat4 model;
16 | } m_model;
17 |
18 | virtual void prepareUniformBuffers() override;
19 |
20 | virtual void updateUniformBuffers() override;
21 | };
22 |
23 | END_NAMESPACE(VulkanEngine)
24 |
25 | #endif //LEARNVULKAN_VOLUMEMODELUNIFORM_H
26 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/09_VolumeFog/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #include "VolumeFog.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::VolumeFog* engine = new VulkanEngine::VolumeFog();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/01_SimpleExamples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(01_StaticTriangle)
2 | add_subdirectory(02_StaticCube)
3 | add_subdirectory(03_Texture2dCube)
4 | add_subdirectory(04_Skybox)
5 | add_subdirectory(05_PhongLighting)
6 | add_subdirectory(06_InstanceDraw)
7 | add_subdirectory(07_ShadowMapping)
8 | add_subdirectory(08_ShadowMappingOnmi)
9 | add_subdirectory(09_VolumeFog)
10 |
--------------------------------------------------------------------------------
/examples/02_AdvancedExamples/11_AssimpModel/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 11_AssimpModel)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/* ${CMAKE_CURRENT_SOURCE_DIR}/myobjects/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine_assimp_plugin VulkanEngine ${Vulkan_LIBRARIES})
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
--------------------------------------------------------------------------------
/examples/02_AdvancedExamples/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 | 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)
--------------------------------------------------------------------------------
/examples/02_AdvancedExamples/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 | 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 |
--------------------------------------------------------------------------------
/examples/02_AdvancedExamples/11_AssimpModel/main.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/6/20.
3 | //
4 |
5 | #include "AssimpModelSample.h"
6 |
7 | int main(int argc, char** argv){
8 | VulkanEngine::AssimpModelSample* engine = new VulkanEngine::AssimpModelSample();
9 | engine->initWindow();
10 | engine->initVulkan();
11 | engine->prepare();
12 | engine->renderLoop();
13 | return 1;
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/examples/02_AdvancedExamples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(BUILD_AdvExamples MATCHES ON)
2 | add_subdirectory(11_AssimpModel)
3 | endif()
4 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/.gitignore:
--------------------------------------------------------------------------------
1 | /old/
2 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/21_QtVulkanSceneDemo/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT 21_QtVulkanSceneDemo)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
5 |
6 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES})
7 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} VulkanEngine_qt_plugin VulkanEngine ${Vulkan_LIBRARIES} Qt${QT_VERSION_MAJOR}::Widgets)
8 |
9 | set_work_dir_function(${LEARN_VULKAN_PROJECT})
10 |
11 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
12 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/21_QtVulkanSceneDemo/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)
--------------------------------------------------------------------------------
/examples/03_QtVulkan/21_QtVulkanSceneDemo/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 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/21_QtVulkanSceneDemo/main.cxx:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "mainwindow.h"
4 |
5 | int main(int argc, char** argv){
6 | QApplication a(argc, argv);
7 | MainWindow w;
8 | w.show();
9 |
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/21_QtVulkanSceneDemo/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class MainWindow;
8 | }
9 |
10 | namespace VulkanEngine {
11 | class ShadowMapping;
12 | }
13 |
14 | class MainWindow : public QMainWindow
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | explicit MainWindow(QWidget *parent = nullptr);
20 | ~MainWindow();
21 |
22 | void uiSettings();
23 |
24 | void connectSettings();
25 |
26 | void initRender();
27 |
28 | public slots:
29 | void debugQuad();
30 |
31 | void setDistance();
32 |
33 | void setReflect();
34 |
35 | protected:
36 | void showEvent(QShowEvent *event);
37 |
38 | void closeEvent(QCloseEvent *event);
39 |
40 | private:
41 | Ui::MainWindow *ui = nullptr;
42 |
43 | VulkanEngine::ShadowMapping *m_vkEngine = nullptr;
44 | };
45 |
46 | #endif // MAINWINDOW_H
47 |
--------------------------------------------------------------------------------
/examples/03_QtVulkan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | if(BUILD_QtExamples MATCHES ON)
2 | set(CMAKE_INCLUDE_CURRENT_DIR True)
3 | set(CMAKE_AUTOMOC ON)
4 | set(CMAKE_AUTOUIC ON)
5 | set(CMAKE_AUTORCC ON)
6 |
7 | include_directories(${PROJECT_SOURCE_DIR}/source/plugins/qt)
8 | add_subdirectory(21_QtVulkanSceneDemo)
9 | endif()
10 |
--------------------------------------------------------------------------------
/examples/04_VulkanWithOpenCV/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
3 | project(learnVulkan)
4 |
5 | if(UNIX)
6 | set(CMAKE_EXE_LINKER_FLAGS "-fno-pie -no-pie")
7 | add_definitions("-Ofast -std=c++17")
8 | add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
9 | elseif(WIN32)
10 | add_definitions(-DNOMINMAX)
11 | add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
12 | endif()
13 |
14 | FIND_PACKAGE( OpenMP REQUIRED)
15 | if(OPENMP_FOUND)
16 | message("OPENMP FOUND")
17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
19 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
20 | endif()
21 |
22 | include_directories(${PROJECT_SOURCE_DIR}/include)
23 | include_directories(${PROJECT_SOURCE_DIR}/include/base)
24 | include_directories(${PROJECT_SOURCE_DIR}/include/external)
25 | link_directories(${PROJECT_SOURCE_DIR}/lib)
26 |
27 | add_subdirectory(src)
28 |
--------------------------------------------------------------------------------
/examples/05_GraphicsAlgorithm/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
3 | project(learnVulkan)
4 |
5 | if(UNIX)
6 | set(CMAKE_EXE_LINKER_FLAGS "-fno-pie -no-pie")
7 | add_definitions("-Ofast -std=c++17")
8 | add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
9 | elseif(WIN32)
10 | add_definitions(-DNOMINMAX)
11 | add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
12 | endif()
13 |
14 | FIND_PACKAGE( OpenMP REQUIRED)
15 | if(OPENMP_FOUND)
16 | message("OPENMP FOUND")
17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
19 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
20 | endif()
21 |
22 | include_directories(${PROJECT_SOURCE_DIR}/include)
23 | include_directories(${PROJECT_SOURCE_DIR}/include/base)
24 | include_directories(${PROJECT_SOURCE_DIR}/include/external)
25 | link_directories(${PROJECT_SOURCE_DIR}/lib)
26 |
27 | add_subdirectory(src)
28 |
--------------------------------------------------------------------------------
/examples/06_SimpleGame/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | MESSAGE(STATUS "operation system is ${CMAKE_SYSTEM}")
3 | project(learnVulkan)
4 |
5 | if(UNIX)
6 | set(CMAKE_EXE_LINKER_FLAGS "-fno-pie -no-pie")
7 | add_definitions("-Ofast -std=c++17")
8 | add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
9 | elseif(WIN32)
10 | add_definitions(-DNOMINMAX)
11 | add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
12 | endif()
13 |
14 | FIND_PACKAGE( OpenMP REQUIRED)
15 | if(OPENMP_FOUND)
16 | message("OPENMP FOUND")
17 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
19 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
20 | endif()
21 |
22 | include_directories(${PROJECT_SOURCE_DIR}/include)
23 | include_directories(${PROJECT_SOURCE_DIR}/include/base)
24 | include_directories(${PROJECT_SOURCE_DIR}/include/external)
25 | link_directories(${PROJECT_SOURCE_DIR}/lib)
26 |
27 | add_subdirectory(src)
28 |
--------------------------------------------------------------------------------
/examples/BaseProject/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
2 | SET(LEARN_VULKAN_PROJECT BaseProject)
3 |
4 | FILE(GLOB_RECURSE SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/*)
5 | FILE(GLOB HEAD_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/*)
6 |
7 |
8 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
9 | add_executable(${LEARN_VULKAN_PROJECT} ${SRC_FILES} ${HEAD_FILES})
10 | TARGET_LINK_LIBRARIES(${LEARN_VULKAN_PROJECT} vulkan_basicengine vulkanbase ${Vulkan_LIBRARIES})
11 |
12 | INSTALL(TARGETS ${LEARN_VULKAN_PROJECT} DESTINATION "${PROJECT_SOURCE_DIR}/bin")
13 |
--------------------------------------------------------------------------------
/examples/BaseProject/src/main.cxx:
--------------------------------------------------------------------------------
1 | /*
2 | * LearnVulkan Examples
3 | *
4 | * This is the main function of the base project with native window vulkan application.
5 | *
6 | * Copyright (C) by engineer1109 - https://github.com/engineer1109/LearnVulkan
7 | *
8 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
9 | */
10 | #include "baseproject.h"
11 | int main(int argc, char **argv) {
12 | bool debug = false;
13 | BaseProject *pVulkan = new BaseProject(debug); // new an engine
14 | pVulkan->initVulkan(); // init vulkan
15 | pVulkan->initWindow(); // init native window
16 | pVulkan->prepare(); // prepare render pipeline
17 | pVulkan->renderLoop(); // start render loop until it stops
18 | delete pVulkan; // delete engine
19 | pVulkan = nullptr;
20 | return 1;
21 | }
22 |
--------------------------------------------------------------------------------
/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(01_SimpleExamples)
2 | add_subdirectory(02_AdvancedExamples)
3 | add_subdirectory(03_QtVulkan)
4 | #add_subdirectory(BaseProject)
5 |
--------------------------------------------------------------------------------
/source/algorithm/GraphicsAlgorithm.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #include "GraphicsAlgorithm.h"
6 |
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/algorithm/PerlinNoise.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #include "PerlinNoise.h"
6 |
--------------------------------------------------------------------------------
/source/algorithm/VertexFactory.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #ifndef LEARNVULKAN_VERTEXFACTORY_H
6 | #define LEARNVULKAN_VERTEXFACTORY_H
7 |
8 | #include "base_template.h"
9 | #include "vertex_struct.h"
10 |
11 | BEGIN_NAMESPACE(VulkanEngine)
12 |
13 | class VULKANENGINE_EXPORT_API VertexFactory {
14 | public:
15 | static std::vector GenPlaneVertex(int direction, glm::vec2 size);
16 | };
17 |
18 | END_NAMESPACE(VulkanEngine)
19 |
20 | #endif //LEARNVULKAN_VERTEXFACTORY_H
21 |
--------------------------------------------------------------------------------
/source/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 | #include "vulkan_macro.h"
10 |
11 | BEGIN_NAMESPACE(VulkanEngine)
12 |
13 | template
14 | void delete_ptr(T* &ptr){
15 | if(ptr){
16 | delete ptr;
17 | ptr = nullptr;
18 | }
19 | }
20 |
21 | template
22 | void delete_array(T* &ptr){
23 | if(ptr){
24 | delete[] ptr;
25 | ptr = nullptr;
26 | }
27 | }
28 |
29 | template
30 | T clamp(T value, T minValue, T maxValue){
31 | T res = std::min(maxValue, value);
32 | res = std::max(minValue, value);
33 | return res;
34 | }
35 |
36 | END_NAMESPACE(VulkanEngine)
37 |
38 | #endif //LEARNVULKAN_BASE_TEMPLATE_H
39 |
--------------------------------------------------------------------------------
/source/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 |
--------------------------------------------------------------------------------
/source/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 | #ifdef VULKANENGINE_EXPORT
19 | #ifdef WIN32
20 | #define VULKANENGINE_EXPORT_API __declspec(dllexport)
21 | #else
22 | #define VULKANENGINE_EXPORT_API __attribute__((visibility("default")))
23 | #endif
24 | #else
25 | #define VULKANENGINE_EXPORT_API
26 | #endif
27 |
28 | #endif //LEARNVULKAN_VULKAN_MACRO_H
29 |
--------------------------------------------------------------------------------
/source/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 | END_NAMESPACE(VulkanEngine)
13 |
14 | #endif //LEARNVULKAN_VULKAN_TEMPLATE_H
15 |
--------------------------------------------------------------------------------
/source/core/VulkanVertexDescriptions.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 21-2-25.
3 | //
4 |
5 | #include "VulkanVertexDescriptions.h"
6 |
--------------------------------------------------------------------------------
/source/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 | if(m_mouseButtons.left){
11 | if (m_mousePos.x > m_mousePosOld.x) {
12 | m_rotation.y += 1.f;
13 | } else if (m_mousePos.x < m_mousePosOld.x) {
14 | m_rotation.y -= 1.f;
15 | }
16 | if (m_mousePos.y > m_mousePosOld.y) {
17 | m_rotation.x += 1.f;
18 | } else if (m_mousePos.y < m_mousePosOld.y) {
19 | m_rotation.x -= 1.f;
20 | }
21 | }
22 | if(m_scroll.up){
23 | m_distance += 0.1f;
24 | }
25 | else if(m_scroll.down){
26 | m_distance -= 0.1f;
27 | }
28 | m_zoom += m_distance;
29 | m_distance = 0.f;
30 |
31 | m_mousePosOld = m_mousePos;
32 | }
33 |
34 | END_NAMESPACE(VulkanEngine)
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/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 |
--------------------------------------------------------------------------------
/source/plugins/qt/QtVulkanWindow.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2021/6/27.
3 | //
4 |
5 | #ifndef LEARNVULKAN_QTVULKANWINDOW_H
6 | #define LEARNVULKAN_QTVULKANWINDOW_H
7 |
8 | #include
9 |
10 | #include "VulkanBaseEngine.h"
11 |
12 | class VULKANENGINE_EXPORT_API QtVulkanWindow : public QMainWindow {
13 | Q_OBJECT
14 | public:
15 | QtVulkanWindow(QWidget *parent = Q_NULLPTR);
16 |
17 | virtual ~QtVulkanWindow();
18 |
19 | void setVulkanPtr(VulkanEngine::VulkanBaseEngine *vulkan);
20 |
21 | public slots:
22 |
23 | void mousePressEvent(QMouseEvent *event);
24 |
25 | void mouseReleaseEvent(QMouseEvent *event);
26 |
27 | void mouseMoveEvent(QMouseEvent *event);
28 |
29 | void showEvent(QShowEvent *event);
30 |
31 | void closeEvent(QCloseEvent *event);
32 |
33 | protected:
34 | VulkanEngine::VulkanBaseEngine *m_vulkan = nullptr;
35 | glm::vec2 *m_mousePos = nullptr;
36 | };
37 |
38 | #endif //LEARNVULKAN_QTVULKANWINDOW_H
39 |
--------------------------------------------------------------------------------
/source/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 |
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/template/object/camera/ThirdPersonCamera.cxx:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 21-2-28.
3 | //
4 |
5 | #include "ThirdPersonCamera.h"
6 |
--------------------------------------------------------------------------------
/source/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 | #include "base_template.h"
10 |
11 | class VULKANENGINE_EXPORT_API ThirdPersonCamera {
12 | public:
13 | ThirdPersonCamera()=default;
14 | ~ThirdPersonCamera()=default;
15 |
16 | void setZoom(float zoom) { m_zoom = zoom; }
17 |
18 | glm::vec3 m_rotation = glm::vec3();
19 | glm::vec3 m_cameraPos = glm::vec3();
20 | const float m_baseZoom = -2.f;
21 | float m_zoom = m_baseZoom;
22 | };
23 |
24 |
25 | #endif //LEARNVULKAN_THIRDPERSONCAMERA_H
26 |
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/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)
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API VULKANENGINE_EXPORT_API 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 |
--------------------------------------------------------------------------------
/source/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 VULKANENGINE_EXPORT_API VulkanPlane : public MeshObject {
14 | public:
15 | enum Direction {
16 | XZ = 0,
17 | XY = 1,
18 | };
19 |
20 | VulkanPlane() = default;
21 |
22 | ~VulkanPlane();
23 |
24 | void generateVertex() override;
25 |
26 | void updateVertex() override {}
27 |
28 | void setSize(float a, float b) {
29 | m_a = a;
30 | m_b = b;
31 | }
32 |
33 | void setDirection(Direction direction) {
34 | m_direction = direction;
35 | }
36 |
37 | protected:
38 | float m_a = 1.f;
39 | float m_b = 1.f;
40 | Direction m_direction{};
41 | };
42 |
43 | END_NAMESPACE(VulkanEngine)
44 |
45 | #endif //LEARNVULKAN_VULKANPLANE_H
46 |
--------------------------------------------------------------------------------
/source/template/object/texture/VulkanTexture3D.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by wjl on 2023/1/29.
3 | //
4 |
5 | #ifndef LEARNVULKAN_VULKANTEXTURE3D_H
6 | #define LEARNVULKAN_VULKANTEXTURE3D_H
7 |
8 | #include "VulkanTexture.h"
9 |
10 | BEGIN_NAMESPACE(VulkanEngine)
11 |
12 | class VULKANENGINE_EXPORT_API VulkanTexture3D : public VulkanTexture {
13 | public:
14 | VulkanTexture3D() = default;
15 |
16 | virtual ~VulkanTexture3D() = default;
17 |
18 | void loadFromData(void *imgData,
19 | uint32_t width,
20 | uint32_t height,
21 | uint32_t depth,
22 | VkFormat format,
23 | VkImageUsageFlags imageUsageFlags = VK_IMAGE_USAGE_SAMPLED_BIT,
24 | VkImageLayout imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
25 | bool forceLinear = false);
26 | };
27 |
28 | END_NAMESPACE(VulkanEngine)
29 |
30 | #endif //LEARNVULKAN_VULKANTEXTURE3D_H
31 |
--------------------------------------------------------------------------------
/third_party/assimp/include/assimp/Compiler/poppack1.h:
--------------------------------------------------------------------------------
1 |
2 | // ===============================================================================
3 | // May be included multiple times - resets structure packing to the defaults
4 | // for all supported compilers. Reverts the changes made by #include
5 | //
6 | // Currently this works on the following compilers:
7 | // MSVC 7,8,9
8 | // GCC
9 | // BORLAND (complains about 'pack state changed but not reverted', but works)
10 | // ===============================================================================
11 |
12 | #ifndef AI_PUSHPACK_IS_DEFINED
13 | # error pushpack1.h must be included after poppack1.h
14 | #endif
15 |
16 | // reset packing to the original value
17 | #if (defined(_MSC_VER) && !defined(__clang__)) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
18 | # pragma pack( pop )
19 | #endif
20 | #undef PACK_STRUCT
21 |
22 | #undef AI_PUSHPACK_IS_DEFINED
23 |
--------------------------------------------------------------------------------
/third_party/assimp/lib/android/arm64-v8a/libassimp.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/third_party/assimp/lib/android/arm64-v8a/libassimp.so
--------------------------------------------------------------------------------
/third_party/assimp/lib/android/x86_64/libassimp.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/third_party/assimp/lib/android/x86_64/libassimp.so
--------------------------------------------------------------------------------
/third_party/gli/gli/convert.hpp:
--------------------------------------------------------------------------------
1 | /// @brief Include to copy textures, images or a subset of either textures or an images. These operations will cause memory allocations.
2 | /// @file gli/convert.hpp
3 |
4 | #pragma once
5 |
6 | #include "texture1d.hpp"
7 | #include "texture1d_array.hpp"
8 | #include "texture2d.hpp"
9 | #include "texture2d_array.hpp"
10 | #include "texture3d.hpp"
11 | #include "texture_cube.hpp"
12 | #include "texture_cube_array.hpp"
13 |
14 | namespace gli
15 | {
16 | /// Convert texture data to a new format
17 | ///
18 | /// @param Texture Source texture, the format must be uncompressed.
19 | /// @param Format Destination Texture format, it must be uncompressed.
20 | template
21 | texture_type convert(texture_type const& Texture, format Format);
22 | }//namespace gli
23 |
24 | #include "./core/convert.inl"
25 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/clear.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "convert_func.hpp"
4 |
5 | namespace gli{
6 | namespace detail
7 | {
8 | template
9 | struct clear
10 | {
11 | static void call(textureType & Texture, typename convert::writeFunc Write, vec<4, T, P> const& Color)
12 | {
13 | GLI_ASSERT(Write);
14 |
15 | texture const ConvertTexel(Texture.target(), Texture.format(), texture::extent_type(1), 1, 1, 1);
16 | textureType Texel(ConvertTexel);
17 | Write(Texel, typename textureType::extent_type(0), 0, 0, 0, Color);
18 |
19 | size_t const BlockSize(block_size(Texture.format()));
20 | for(size_t BlockIndex = 0, BlockCount = Texture.size() / BlockSize; BlockIndex < BlockCount; ++BlockIndex)
21 | memcpy(static_cast(Texture.data()) + BlockSize * BlockIndex, Texel.data(), BlockSize);
22 | }
23 | };
24 | }//namespace detail
25 | }//namespace gli
26 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/dummy.cpp:
--------------------------------------------------------------------------------
1 | int main()
2 | {
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/file.hpp:
--------------------------------------------------------------------------------
1 | /// @brief File helper functions
2 | /// @file gli/core/file.hpp
3 |
4 | #pragma once
5 |
6 | #include
7 |
8 | namespace gli{
9 | namespace detail
10 | {
11 | FILE* open_file(const char *Filename, const char *mode);
12 | }//namespace detail
13 | }//namespace gli
14 |
15 | #include "./file.inl"
16 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/file.inl:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace gli{
6 | namespace detail
7 | {
8 | inline FILE* open_file(const char *Filename, const char *Mode)
9 | {
10 | # if GLM_COMPILER & GLM_COMPILER_VC
11 | FILE *File = nullptr;
12 | fopen_s(&File, Filename, Mode);
13 | return File;
14 | # else
15 | return std::fopen(Filename, Mode);
16 | # endif
17 | }
18 | }//namespace detail
19 | }//namespace gli
20 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/filter.hpp:
--------------------------------------------------------------------------------
1 | /// @brief Include to use filter enum, to select filtering methods.
2 | /// @file gli/core/filter.hpp
3 |
4 | #pragma once
5 |
6 | namespace gli
7 | {
8 | /// Texture filtring modes
9 | enum filter
10 | {
11 | FILTER_NONE = 0,
12 | FILTER_NEAREST, FILTER_FIRST = FILTER_NEAREST,
13 | FILTER_LINEAR, FILTER_LAST = FILTER_LINEAR
14 | };
15 |
16 | enum
17 | {
18 | FILTER_COUNT = FILTER_LAST - FILTER_FIRST + 1,
19 | FILTER_INVALID = -1
20 | };
21 | }//namespace gli
22 |
23 | #include "filter.inl"
24 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/filter.inl:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace gli{
4 | namespace detail
5 | {
6 |
7 | }//namespace detail
8 | }//namespace gli
9 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/flip.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "../texture2d.hpp"
6 | #include "../texture2d_array.hpp"
7 | #include "../texture_cube.hpp"
8 | #include "../texture_cube_array.hpp"
9 |
10 | namespace gli
11 | {
12 | template
13 | texture flip(texture const & Texture);
14 |
15 | }//namespace gli
16 |
17 | #include "flip.inl"
18 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/levels.inl:
--------------------------------------------------------------------------------
1 | #include
2 | #define GLM_ENABLE_EXPERIMENTAL
3 | #include
4 |
5 | namespace gli
6 | {
7 | template
8 | inline T levels(vec const& Extent)
9 | {
10 | return glm::log2(compMax(Extent)) + static_cast(1);
11 | }
12 |
13 | template
14 | inline T levels(T Extent)
15 | {
16 | return static_cast(glm::log2(Extent) + static_cast(1));
17 | }
18 | /*
19 | inline int levels(int Extent)
20 | {
21 | return glm::log2(Extent) + static_cast(1);
22 | }
23 | */
24 | }//namespace gli
25 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/sampler.inl:
--------------------------------------------------------------------------------
1 | #define GLM_ENABLE_EXPERIMENTAL
2 | #include
3 |
4 | namespace gli{
5 | namespace detail
6 | {
7 | template
8 | inline T passThrought(T const & SampleCoord)
9 | {
10 | return SampleCoord;
11 | }
12 | }//namespace detail
13 |
14 | inline sampler::sampler(wrap Wrap, filter Mip, filter Min)
15 | : Wrap(get_func(Wrap))
16 | , Mip(Mip)
17 | , Min(Min)
18 | {}
19 |
20 | inline sampler::wrap_type sampler::get_func(wrap WrapMode) const
21 | {
22 | static wrap_type Table[] =
23 | {
24 | glm::clamp,
25 | detail::passThrought,
26 | glm::repeat,
27 | glm::mirrorRepeat,
28 | glm::mirrorClamp,
29 | glm::mirrorClamp
30 | };
31 | static_assert(sizeof(Table) / sizeof(Table[0]) == WRAP_COUNT, "Table needs to be updated");
32 |
33 | return Table[WrapMode];
34 | }
35 | }//namespace gli
36 |
--------------------------------------------------------------------------------
/third_party/gli/gli/core/save.inl:
--------------------------------------------------------------------------------
1 | #include "../save_dds.hpp"
2 | #include "../save_kmg.hpp"
3 | #include "../save_ktx.hpp"
4 |
5 | namespace gli
6 | {
7 | inline bool save(texture const & Texture, char const * Path)
8 | {
9 | return save(Texture, std::string(Path));
10 | }
11 |
12 | inline bool save(texture const & Texture, std::string const & Path)
13 | {
14 | if(Path.rfind(".dds") != std::string::npos)
15 | return save_dds(Texture, Path);
16 | if(Path.rfind(".kmg") != std::string::npos)
17 | return save_kmg(Texture, Path);
18 | if(Path.rfind(".ktx") != std::string::npos)
19 | return save_ktx(Texture, Path);
20 | return false;
21 | }
22 | }//namespace gli
23 |
--------------------------------------------------------------------------------
/third_party/gli/gli/load.hpp:
--------------------------------------------------------------------------------
1 | /// @brief Include to load DDS, KTX or KMG textures from files or memory.
2 | /// @file gli/load.hpp
3 |
4 | #pragma once
5 |
6 | #include "texture.hpp"
7 |
8 | namespace gli
9 | {
10 | /// Loads a texture storage_linear from file. Returns an empty storage_linear in case of failure.
11 | ///
12 | /// @param Path Path of the file to open including filaname and filename extension
13 | texture load(char const* Path);
14 |
15 | /// Loads a texture storage_linear from file. Returns an empty storage_linear in case of failure.
16 | ///
17 | /// @param Path Path of the file to open including filaname and filename extension
18 | texture load(std::string const& Path);
19 |
20 | /// Loads a texture storage_linear from memory. Returns an empty storage_linear in case of failure.
21 | ///
22 | /// @param Data Data of a texture
23 | /// @param Size Size of the data
24 | texture load(char const* Data, std::size_t Size);
25 | }//namespace gli
26 |
27 | #include "./core/load.inl"
28 |
--------------------------------------------------------------------------------
/third_party/gli/gli/load_dds.hpp:
--------------------------------------------------------------------------------
1 | /// @brief Include to load DDS textures from files or memory.
2 | /// @file gli/load_dds.hpp
3 |
4 | #pragma once
5 |
6 | #include "texture.hpp"
7 |
8 | namespace gli
9 | {
10 | /// Loads a texture storage_linear from DDS file. Returns an empty storage_linear in case of failure.
11 | ///
12 | /// @param Path Path of the file to open including filaname and filename extension
13 | texture load_dds(char const* Path);
14 |
15 | /// Loads a texture storage_linear from DDS file. Returns an empty storage_linear in case of failure.
16 | ///
17 | /// @param Path Path of the file to open including filaname and filename extension
18 | texture load_dds(std::string const& Path);
19 |
20 | /// Loads a texture storage_linear from DDS memory. Returns an empty storage_linear in case of failure.
21 | ///
22 | /// @param Data Pointer to the beginning of the texture container data to read
23 | /// @param Size Size of texture container Data to read
24 | texture load_dds(char const* Data, std::size_t Size);
25 | }//namespace gli
26 |
27 | #include "./core/load_dds.inl"
28 |
--------------------------------------------------------------------------------
/third_party/gli/gli/load_ktx.hpp:
--------------------------------------------------------------------------------
1 | /// @brief Include to load KTX textures from files or memory.
2 | /// @file gli/load_ktx.hpp
3 |
4 | #pragma once
5 |
6 | #include "texture.hpp"
7 |
8 | namespace gli
9 | {
10 | /// Loads a texture storage_linear from KTX file. Returns an empty storage_linear in case of failure.
11 | ///
12 | /// @param Path Path of the file to open including filaname and filename extension
13 | texture load_ktx(char const* Path);
14 |
15 | /// Loads a texture storage_linear from KTX file. Returns an empty storage_linear in case of failure.
16 | ///
17 | /// @param Path Path of the file to open including filaname and filename extension
18 | texture load_ktx(std::string const& Path);
19 |
20 | /// Loads a texture storage_linear from KTX memory. Returns an empty storage_linear in case of failure.
21 | ///
22 | /// @param Data Pointer to the beginning of the texture container data to read
23 | /// @param Size Size of texture container Data to read
24 | texture load_ktx(char const* Data, std::size_t Size);
25 | }//namespace gli
26 |
27 | #include "./core/load_ktx.inl"
28 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/_fixes.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | //! Workaround for compatibility with other libraries
4 | #ifdef max
5 | #undef max
6 | #endif
7 |
8 | //! Workaround for compatibility with other libraries
9 | #ifdef min
10 | #undef min
11 | #endif
12 |
13 | //! Workaround for Android
14 | #ifdef isnan
15 | #undef isnan
16 | #endif
17 |
18 | //! Workaround for Android
19 | #ifdef isinf
20 | #undef isinf
21 | #endif
22 |
23 | //! Workaround for Chrone Native Client
24 | #ifdef log2
25 | #undef log2
26 | #endif
27 |
28 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/compute_vector_relational.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | //#include "compute_common.hpp"
4 | #include "setup.hpp"
5 | #include
6 |
7 | namespace glm{
8 | namespace detail
9 | {
10 | template
11 | struct compute_equal
12 | {
13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)
14 | {
15 | return a == b;
16 | }
17 | };
18 | /*
19 | template
20 | struct compute_equal
21 | {
22 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(T a, T b)
23 | {
24 | return detail::compute_abs::is_signed>::call(b - a) <= static_cast(0);
25 | //return std::memcmp(&a, &b, sizeof(T)) == 0;
26 | }
27 | };
28 | */
29 | }//namespace detail
30 | }//namespace glm
31 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/func_exponential_simd.inl:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/detail/func_exponential_simd.inl
3 |
4 | #include "../simd/exponential.h"
5 |
6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
7 |
8 | namespace glm{
9 | namespace detail
10 | {
11 | template
12 | struct compute_sqrt<4, float, Q, true>
13 | {
14 | GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
15 | {
16 | vec<4, float, Q> Result;
17 | Result.data = _mm_sqrt_ps(v.data);
18 | return Result;
19 | }
20 | };
21 |
22 | # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
23 | template<>
24 | struct compute_sqrt<4, float, aligned_lowp, true>
25 | {
26 | GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& v)
27 | {
28 | vec<4, float, aligned_lowp> Result;
29 | Result.data = glm_vec4_sqrt_lowp(v.data);
30 | return Result;
31 | }
32 | };
33 | # endif
34 | }//namespace detail
35 | }//namespace glm
36 |
37 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
38 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/func_packing_simd.inl:
--------------------------------------------------------------------------------
1 | namespace glm{
2 | namespace detail
3 | {
4 |
5 | }//namespace detail
6 | }//namespace glm
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/func_trigonometric_simd.inl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/third_party/glm/glm/detail/func_trigonometric_simd.inl
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/func_vector_relational_simd.inl:
--------------------------------------------------------------------------------
1 | namespace glm{
2 | namespace detail
3 | {
4 |
5 | }//namespace detail
6 | }//namespace glm
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/type_half.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "setup.hpp"
4 |
5 | namespace glm{
6 | namespace detail
7 | {
8 | typedef short hdata;
9 |
10 | GLM_FUNC_DECL float toFloat32(hdata value);
11 | GLM_FUNC_DECL hdata toFloat16(float const& value);
12 |
13 | }//namespace detail
14 | }//namespace glm
15 |
16 | #include "type_half.inl"
17 |
--------------------------------------------------------------------------------
/third_party/glm/glm/detail/type_mat4x4_simd.inl:
--------------------------------------------------------------------------------
1 | /// @ref core
2 |
3 | namespace glm
4 | {
5 |
6 | }//namespace glm
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_common.inl:
--------------------------------------------------------------------------------
1 | #include "../matrix.hpp"
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, U a)
7 | {
8 | return mat(x) * (static_cast(1) - a) + mat(y) * a;
9 | }
10 |
11 | template
12 | GLM_FUNC_QUALIFIER mat mix(mat const& x, mat const& y, mat const& a)
13 | {
14 | return matrixCompMult(mat(x), static_cast(1) - a) + matrixCompMult(mat(y), a);
15 | }
16 | }//namespace glm
17 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double2x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double2x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 2 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 2, double, defaultp> dmat2x2;
16 |
17 | /// 2 columns of 2 components matrix of double-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<2, 2, double, defaultp> dmat2;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double2x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double2x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 3 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 3, double, defaultp> dmat2x3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double2x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double2x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 4 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 4, double, defaultp> dmat2x4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double3x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double3x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 3 columns of 2 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 2, double, defaultp> dmat3x2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double3x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double3x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 3 columns of 3 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 3, double, defaultp> dmat3x3;
16 |
17 | /// 3 columns of 3 components matrix of double-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<3, 3, double, defaultp> dmat3;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double3x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double3x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 3 columns of 4 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 4, double, defaultp> dmat3x4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double4x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double4x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 2 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 2, double, defaultp> dmat4x2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double4x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double4x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 3 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 3, double, defaultp> dmat4x3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_double4x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_double4x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 4 components matrix of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 4, double, defaultp> dmat4x4;
16 |
17 | /// 4 columns of 4 components matrix of double-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<4, 4, double, defaultp> dmat4;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float2x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float2x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 2 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 2, float, defaultp> mat2x2;
16 |
17 | /// 2 columns of 2 components matrix of single-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<2, 2, float, defaultp> mat2;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float2x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float2x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 3 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 3, float, defaultp> mat2x3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float2x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float2x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat2x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 2 columns of 4 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<2, 4, float, defaultp> mat2x4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float3x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float3x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core
10 | /// @{
11 |
12 | /// 3 columns of 2 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 2, float, defaultp> mat3x2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float3x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float3x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 3 columns of 3 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 3, float, defaultp> mat3x3;
16 |
17 | /// 3 columns of 3 components matrix of single-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<3, 3, float, defaultp> mat3;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float3x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float3x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat3x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 3 columns of 4 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<3, 4, float, defaultp> mat3x4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float4x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float4x2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 2 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 2, float, defaultp> mat4x2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float4x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float4x3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 3 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 3, float, defaultp> mat4x3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/matrix_float4x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/matrix_float4x4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_mat4x4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @ingroup core_matrix
10 | /// @{
11 |
12 | /// 4 columns of 4 components matrix of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
15 | typedef mat<4, 4, float, defaultp> mat4x4;
16 |
17 | /// 4 columns of 4 components matrix of single-precision floating-point numbers.
18 | ///
19 | /// @see GLSL 4.20.8 specification, section 4.1.6 Matrices
20 | typedef mat<4, 4, float, defaultp> mat4;
21 |
22 | /// @}
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/quaternion_common_simd.inl:
--------------------------------------------------------------------------------
1 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
2 |
3 | namespace glm{
4 | namespace detail
5 | {
6 | template
7 | struct compute_dot, float, true>
8 | {
9 | static GLM_FUNC_QUALIFIER float call(qua const& x, qua const& y)
10 | {
11 | return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
12 | }
13 | };
14 | }//namespace detail
15 | }//namespace glm
16 |
17 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
18 |
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/quaternion_transform.inl:
--------------------------------------------------------------------------------
1 | namespace glm
2 | {
3 | template
4 | GLM_FUNC_QUALIFIER qua rotate(qua const& q, T const& angle, vec<3, T, Q> const& v)
5 | {
6 | vec<3, T, Q> Tmp = v;
7 |
8 | // Axis of rotation must be normalised
9 | T len = glm::length(Tmp);
10 | if(abs(len - static_cast(1)) > static_cast(0.001))
11 | {
12 | T oneOverLen = static_cast(1) / len;
13 | Tmp.x *= oneOverLen;
14 | Tmp.y *= oneOverLen;
15 | Tmp.z *= oneOverLen;
16 | }
17 |
18 | T const AngleRad(angle);
19 | T const Sin = sin(AngleRad * static_cast(0.5));
20 |
21 | return q * qua(cos(AngleRad * static_cast(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
22 | }
23 | }//namespace glm
24 |
25 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/quaternion_trigonometric.inl:
--------------------------------------------------------------------------------
1 | #include "scalar_constants.hpp"
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER T angle(qua const& x)
7 | {
8 | if (abs(x.w) > cos_one_over_two())
9 | {
10 | return asin(sqrt(x.x * x.x + x.y * x.y + x.z * x.z)) * static_cast(2);
11 | }
12 |
13 | return acos(x.w) * static_cast(2);
14 | }
15 |
16 | template
17 | GLM_FUNC_QUALIFIER vec<3, T, Q> axis(qua const& x)
18 | {
19 | T const tmp1 = static_cast(1) - x.w * x.w;
20 | if(tmp1 <= static_cast(0))
21 | return vec<3, T, Q>(0, 0, 1);
22 | T const tmp2 = static_cast(1) / sqrt(tmp1);
23 | return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
24 | }
25 |
26 | template
27 | GLM_FUNC_QUALIFIER qua angleAxis(T const& angle, vec<3, T, Q> const& v)
28 | {
29 | T const a(angle);
30 | T const s = glm::sin(a * static_cast(0.5));
31 |
32 | return qua(glm::cos(a * static_cast(0.5)), v * s);
33 | }
34 | }//namespace glm
35 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/scalar_constants.inl:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
7 | {
8 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'epsilon' only accepts floating-point inputs");
9 | return std::numeric_limits::epsilon();
10 | }
11 |
12 | template
13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
14 | {
15 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'pi' only accepts floating-point inputs");
16 | return static_cast(3.14159265358979323846264338327950288);
17 | }
18 |
19 | template
20 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType cos_one_over_two()
21 | {
22 | return genType(0.877582561890372716130286068203503191);
23 | }
24 | } //namespace glm
25 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_bool1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_bool1
2 | /// @file glm/ext/vector_bool1.hpp
3 | ///
4 | /// @defgroup ext_vector_bool1 GLM_EXT_vector_bool1
5 | /// @ingroup ext
6 | ///
7 | /// Exposes bvec1 vector type.
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// @see ext_vector_bool1_precision extension.
12 |
13 | #pragma once
14 |
15 | #include "../detail/type_vec1.hpp"
16 |
17 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
18 | # pragma message("GLM: GLM_EXT_vector_bool1 extension included")
19 | #endif
20 |
21 | namespace glm
22 | {
23 | /// @addtogroup ext_vector_bool1
24 | /// @{
25 |
26 | /// 1 components vector of boolean.
27 | typedef vec<1, bool, defaultp> bvec1;
28 |
29 | /// @}
30 | }//namespace glm
31 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_bool1_precision.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_bool1_precision
2 | /// @file glm/ext/vector_bool1_precision.hpp
3 | ///
4 | /// @defgroup ext_vector_bool1_precision GLM_EXT_vector_bool1_precision
5 | /// @ingroup ext
6 | ///
7 | /// Exposes highp_bvec1, mediump_bvec1 and lowp_bvec1 types.
8 | ///
9 | /// Include to use the features of this extension.
10 |
11 | #pragma once
12 |
13 | #include "../detail/type_vec1.hpp"
14 |
15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
16 | # pragma message("GLM: GLM_EXT_vector_bool1_precision extension included")
17 | #endif
18 |
19 | namespace glm
20 | {
21 | /// @addtogroup ext_vector_bool1_precision
22 | /// @{
23 |
24 | /// 1 component vector of bool values.
25 | typedef vec<1, bool, highp> highp_bvec1;
26 |
27 | /// 1 component vector of bool values.
28 | typedef vec<1, bool, mediump> mediump_bvec1;
29 |
30 | /// 1 component vector of bool values.
31 | typedef vec<1, bool, lowp> lowp_bvec1;
32 |
33 | /// @}
34 | }//namespace glm
35 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_bool2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_bool2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 2 components vector of boolean.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<2, bool, defaultp> bvec2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_bool3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_bool3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 3 components vector of boolean.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<3, bool, defaultp> bvec3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_bool4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_bool4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 4 components vector of boolean.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<4, bool, defaultp> bvec4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_double1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_double1
2 | /// @file glm/ext/vector_double1.hpp
3 | ///
4 | /// @defgroup ext_vector_double1 GLM_EXT_vector_double1
5 | /// @ingroup ext
6 | ///
7 | /// Exposes double-precision floating point vector type with one component.
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// @see ext_vector_double1_precision extension.
12 | /// @see ext_vector_float1 extension.
13 |
14 | #pragma once
15 |
16 | #include "../detail/type_vec1.hpp"
17 |
18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19 | # pragma message("GLM: GLM_EXT_vector_double1 extension included")
20 | #endif
21 |
22 | namespace glm
23 | {
24 | /// @addtogroup ext_vector_double1
25 | /// @{
26 |
27 | /// 1 components vector of double-precision floating-point numbers.
28 | typedef vec<1, double, defaultp> dvec1;
29 |
30 | /// @}
31 | }//namespace glm
32 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_double2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_double2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 2 components vector of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<2, double, defaultp> dvec2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_double3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_double3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 3 components vector of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<3, double, defaultp> dvec3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_double4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_double4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 4 components vector of double-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<4, double, defaultp> dvec4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_float1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_float1
2 | /// @file glm/ext/vector_float1.hpp
3 | ///
4 | /// @defgroup ext_vector_float1 GLM_EXT_vector_float1
5 | /// @ingroup ext
6 | ///
7 | /// Exposes single-precision floating point vector type with one component.
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// @see ext_vector_float1_precision extension.
12 | /// @see ext_vector_double1 extension.
13 |
14 | #pragma once
15 |
16 | #include "../detail/type_vec1.hpp"
17 |
18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19 | # pragma message("GLM: GLM_EXT_vector_float1 extension included")
20 | #endif
21 |
22 | namespace glm
23 | {
24 | /// @addtogroup ext_vector_float1
25 | /// @{
26 |
27 | /// 1 components vector of single-precision floating-point numbers.
28 | typedef vec<1, float, defaultp> vec1;
29 |
30 | /// @}
31 | }//namespace glm
32 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_float2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_float2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 2 components vector of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<2, float, defaultp> vec2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_float3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_float3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 3 components vector of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<3, float, defaultp> vec3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_float4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_float4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 4 components vector of single-precision floating-point numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<4, float, defaultp> vec4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_int1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_int1
2 | /// @file glm/ext/vector_int1.hpp
3 | ///
4 | /// @defgroup ext_vector_int1 GLM_EXT_vector_int1
5 | /// @ingroup ext
6 | ///
7 | /// Exposes ivec1 vector type.
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// @see ext_vector_uint1 extension.
12 | /// @see ext_vector_int1_precision extension.
13 |
14 | #pragma once
15 |
16 | #include "../detail/type_vec1.hpp"
17 |
18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19 | # pragma message("GLM: GLM_EXT_vector_int1 extension included")
20 | #endif
21 |
22 | namespace glm
23 | {
24 | /// @addtogroup ext_vector_int1
25 | /// @{
26 |
27 | /// 1 component vector of signed integer numbers.
28 | typedef vec<1, int, defaultp> ivec1;
29 |
30 | /// @}
31 | }//namespace glm
32 |
33 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_int1_precision.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_int1_precision
2 | /// @file glm/ext/vector_int1_precision.hpp
3 | ///
4 | /// @defgroup ext_vector_int1_precision GLM_EXT_vector_int1_precision
5 | /// @ingroup ext
6 | ///
7 | /// Exposes highp_ivec1, mediump_ivec1 and lowp_ivec1 types.
8 | ///
9 | /// Include to use the features of this extension.
10 |
11 | #pragma once
12 |
13 | #include "../detail/type_vec1.hpp"
14 |
15 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
16 | # pragma message("GLM: GLM_EXT_vector_int1_precision extension included")
17 | #endif
18 |
19 | namespace glm
20 | {
21 | /// @addtogroup ext_vector_int1_precision
22 | /// @{
23 |
24 | /// 1 component vector of signed integer values.
25 | typedef vec<1, int, highp> highp_ivec1;
26 |
27 | /// 1 component vector of signed integer values.
28 | typedef vec<1, int, mediump> mediump_ivec1;
29 |
30 | /// 1 component vector of signed integer values.
31 | typedef vec<1, int, lowp> lowp_ivec1;
32 |
33 | /// @}
34 | }//namespace glm
35 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_int2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_int2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 2 components vector of signed integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<2, int, defaultp> ivec2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_int3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_int3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 3 components vector of signed integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<3, int, defaultp> ivec3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_int4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_int4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 4 components vector of signed integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<4, int, defaultp> ivec4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_uint1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref ext_vector_uint1
2 | /// @file glm/ext/vector_uint1.hpp
3 | ///
4 | /// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1
5 | /// @ingroup ext
6 | ///
7 | /// Exposes uvec1 vector type.
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// @see ext_vector_int1 extension.
12 | /// @see ext_vector_uint1_precision extension.
13 |
14 | #pragma once
15 |
16 | #include "../detail/type_vec1.hpp"
17 |
18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19 | # pragma message("GLM: GLM_EXT_vector_uint1 extension included")
20 | #endif
21 |
22 | namespace glm
23 | {
24 | /// @addtogroup ext_vector_uint1
25 | /// @{
26 |
27 | /// 1 component vector of unsigned integer numbers.
28 | typedef vec<1, unsigned int, defaultp> uvec1;
29 |
30 | /// @}
31 | }//namespace glm
32 |
33 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_uint2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_uint2.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec2.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 2 components vector of unsigned integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<2, unsigned int, defaultp> uvec2;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_uint3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_uint3.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec3.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 3 components vector of unsigned integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<3, unsigned int, defaultp> uvec3;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/ext/vector_uint4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/ext/vector_uint4.hpp
3 |
4 | #pragma once
5 | #include "../detail/type_vec4.hpp"
6 |
7 | namespace glm
8 | {
9 | /// @addtogroup core_vector
10 | /// @{
11 |
12 | /// 4 components vector of unsigned integer numbers.
13 | ///
14 | /// @see GLSL 4.20.8 specification, section 4.1.5 Vectors
15 | typedef vec<4, unsigned int, defaultp> uvec4;
16 |
17 | /// @}
18 | }//namespace glm
19 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtc/matrix_transform.inl:
--------------------------------------------------------------------------------
1 | #include "../geometric.hpp"
2 | #include "../trigonometric.hpp"
3 | #include "../matrix.hpp"
4 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtc/quaternion_simd.inl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/third_party/glm/glm/gtc/quaternion_simd.inl
--------------------------------------------------------------------------------
/third_party/glm/glm/gtc/type_precision.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtc_precision
2 |
3 | namespace glm
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtc/vec1.hpp:
--------------------------------------------------------------------------------
1 | /// @ref gtc_vec1
2 | /// @file glm/gtc/vec1.hpp
3 | ///
4 | /// @see core (dependence)
5 | ///
6 | /// @defgroup gtc_vec1 GLM_GTC_vec1
7 | /// @ingroup gtc
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// Add vec1, ivec1, uvec1 and bvec1 types.
12 |
13 | #pragma once
14 |
15 | // Dependency:
16 | #include "../ext/vector_bool1.hpp"
17 | #include "../ext/vector_bool1_precision.hpp"
18 | #include "../ext/vector_float1.hpp"
19 | #include "../ext/vector_float1_precision.hpp"
20 | #include "../ext/vector_double1.hpp"
21 | #include "../ext/vector_double1_precision.hpp"
22 | #include "../ext/vector_int1.hpp"
23 | #include "../ext/vector_int1_precision.hpp"
24 | #include "../ext/vector_uint1.hpp"
25 | #include "../ext/vector_uint1_precision.hpp"
26 |
27 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
28 | # pragma message("GLM: GLM_GTC_vec1 extension included")
29 | #endif
30 |
31 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/exterior_product.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_exterior_product
2 |
3 | #include
4 |
5 | namespace glm {
6 | namespace detail
7 | {
8 | template
9 | struct compute_cross_vec2
10 | {
11 | GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& v, vec<2, T, Q> const& u)
12 | {
13 | GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cross' accepts only floating-point inputs");
14 |
15 | return v.x * u.y - u.x * v.y;
16 | }
17 | };
18 | }//namespace detail
19 |
20 | template
21 | GLM_FUNC_QUALIFIER T cross(vec<2, T, Q> const& x, vec<2, T, Q> const& y)
22 | {
23 | return detail::compute_cross_vec2::value>::call(x, y);
24 | }
25 | }//namespace glm
26 |
27 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/float_notmalize.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_float_normalize
2 |
3 | #include
4 |
5 | namespace glm
6 | {
7 | template
8 | GLM_FUNC_QUALIFIER vec floatNormalize(vec const& v)
9 | {
10 | return vec(v) / static_cast(std::numeric_limits::max());
11 | }
12 |
13 | }//namespace glm
14 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/functions.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_functions
2 |
3 | #include "../exponential.hpp"
4 |
5 | namespace glm
6 | {
7 | template
8 | GLM_FUNC_QUALIFIER T gauss
9 | (
10 | T x,
11 | T ExpectedValue,
12 | T StandardDeviation
13 | )
14 | {
15 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576)));
16 | }
17 |
18 | template
19 | GLM_FUNC_QUALIFIER T gauss
20 | (
21 | vec<2, T, Q> const& Coord,
22 | vec<2, T, Q> const& ExpectedValue,
23 | vec<2, T, Q> const& StandardDeviation
24 | )
25 | {
26 | vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation);
27 | return exp(-(Squared.x + Squared.y));
28 | }
29 | }//namespace glm
30 |
31 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/gradient_paint.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_gradient_paint
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER T radialGradient
7 | (
8 | vec<2, T, Q> const& Center,
9 | T const& Radius,
10 | vec<2, T, Q> const& Focal,
11 | vec<2, T, Q> const& Position
12 | )
13 | {
14 | vec<2, T, Q> F = Focal - Center;
15 | vec<2, T, Q> D = Position - Focal;
16 | T Radius2 = pow2(Radius);
17 | T Fx2 = pow2(F.x);
18 | T Fy2 = pow2(F.y);
19 |
20 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x));
21 | T Denominator = Radius2 - (Fx2 + Fy2);
22 | return Numerator / Denominator;
23 | }
24 |
25 | template
26 | GLM_FUNC_QUALIFIER T linearGradient
27 | (
28 | vec<2, T, Q> const& Point0,
29 | vec<2, T, Q> const& Point1,
30 | vec<2, T, Q> const& Position
31 | )
32 | {
33 | vec<2, T, Q> Dist = Point1 - Point0;
34 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
35 | }
36 | }//namespace glm
37 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/handed_coordinate_space.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_handed_coordinate_space
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER bool rightHanded
7 | (
8 | vec<3, T, Q> const& tangent,
9 | vec<3, T, Q> const& binormal,
10 | vec<3, T, Q> const& normal
11 | )
12 | {
13 | return dot(cross(normal, tangent), binormal) > T(0);
14 | }
15 |
16 | template
17 | GLM_FUNC_QUALIFIER bool leftHanded
18 | (
19 | vec<3, T, Q> const& tangent,
20 | vec<3, T, Q> const& binormal,
21 | vec<3, T, Q> const& normal
22 | )
23 | {
24 | return dot(cross(normal, tangent), binormal) < T(0);
25 | }
26 | }//namespace glm
27 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/log_base.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_log_base
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER genType log(genType const& x, genType const& base)
7 | {
8 | return glm::log(x) / glm::log(base);
9 | }
10 |
11 | template
12 | GLM_FUNC_QUALIFIER vec log(vec const& x, vec const& base)
13 | {
14 | return glm::log(x) / glm::log(base);
15 | }
16 | }//namespace glm
17 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/matrix_cross_product.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_matrix_cross_product
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> matrixCross3
7 | (
8 | vec<3, T, Q> const& x
9 | )
10 | {
11 | mat<3, 3, T, Q> Result(T(0));
12 | Result[0][1] = x.z;
13 | Result[1][0] = -x.z;
14 | Result[0][2] = -x.y;
15 | Result[2][0] = x.y;
16 | Result[1][2] = x.x;
17 | Result[2][1] = -x.x;
18 | return Result;
19 | }
20 |
21 | template
22 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> matrixCross4
23 | (
24 | vec<3, T, Q> const& x
25 | )
26 | {
27 | mat<4, 4, T, Q> Result(T(0));
28 | Result[0][1] = x.z;
29 | Result[1][0] = -x.z;
30 | Result[0][2] = -x.y;
31 | Result[2][0] = x.y;
32 | Result[1][2] = x.x;
33 | Result[2][1] = -x.x;
34 | return Result;
35 | }
36 |
37 | }//namespace glm
38 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/matrix_factorisation.inl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineer1109/LearnVulkan/6c535b6feb20d02b7c6a17112c9224fc30e1bdd9/third_party/glm/glm/gtx/matrix_factorisation.inl
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/mixed_product.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_mixed_product
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER T mixedProduct
7 | (
8 | vec<3, T, Q> const& v1,
9 | vec<3, T, Q> const& v2,
10 | vec<3, T, Q> const& v3
11 | )
12 | {
13 | return dot(cross(v1, v2), v3);
14 | }
15 | }//namespace glm
16 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/normal.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_normal
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER vec<3, T, Q> triangleNormal
7 | (
8 | vec<3, T, Q> const& p1,
9 | vec<3, T, Q> const& p2,
10 | vec<3, T, Q> const& p3
11 | )
12 | {
13 | return normalize(cross(p1 - p2, p1 - p3));
14 | }
15 | }//namespace glm
16 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/normalize_dot.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_normalize_dot
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER T normalizeDot(vec const& x, vec const& y)
7 | {
8 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
9 | }
10 |
11 | template
12 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vec const& x, vec const& y)
13 | {
14 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y));
15 | }
16 | }//namespace glm
17 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/number_precision.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_number_precision
2 |
3 | namespace glm
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/optimum_pow.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_optimum_pow
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER genType pow2(genType const& x)
7 | {
8 | return x * x;
9 | }
10 |
11 | template
12 | GLM_FUNC_QUALIFIER genType pow3(genType const& x)
13 | {
14 | return x * x * x;
15 | }
16 |
17 | template
18 | GLM_FUNC_QUALIFIER genType pow4(genType const& x)
19 | {
20 | return (x * x) * (x * x);
21 | }
22 | }//namespace glm
23 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/orthonormalize.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_orthonormalize
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> orthonormalize(mat<3, 3, T, Q> const& m)
7 | {
8 | mat<3, 3, T, Q> r = m;
9 |
10 | r[0] = normalize(r[0]);
11 |
12 | T d0 = dot(r[0], r[1]);
13 | r[1] -= r[0] * d0;
14 | r[1] = normalize(r[1]);
15 |
16 | T d1 = dot(r[1], r[2]);
17 | d0 = dot(r[0], r[2]);
18 | r[2] -= r[0] * d0 + r[1] * d1;
19 | r[2] = normalize(r[2]);
20 |
21 | return r;
22 | }
23 |
24 | template
25 | GLM_FUNC_QUALIFIER vec<3, T, Q> orthonormalize(vec<3, T, Q> const& x, vec<3, T, Q> const& y)
26 | {
27 | return normalize(x - y * dot(y, x));
28 | }
29 | }//namespace glm
30 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/perpendicular.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_perpendicular
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER genType perp(genType const& x, genType const& Normal)
7 | {
8 | return x - proj(x, Normal);
9 | }
10 | }//namespace glm
11 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/polar_coordinates.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_polar_coordinates
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER vec<3, T, Q> polar
7 | (
8 | vec<3, T, Q> const& euclidean
9 | )
10 | {
11 | T const Length(length(euclidean));
12 | vec<3, T, Q> const tmp(euclidean / Length);
13 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z));
14 |
15 | return vec<3, T, Q>(
16 | asin(tmp.y), // latitude
17 | atan(tmp.x, tmp.z), // longitude
18 | xz_dist); // xz distance
19 | }
20 |
21 | template
22 | GLM_FUNC_QUALIFIER vec<3, T, Q> euclidean
23 | (
24 | vec<2, T, Q> const& polar
25 | )
26 | {
27 | T const latitude(polar.x);
28 | T const longitude(polar.y);
29 |
30 | return vec<3, T, Q>(
31 | cos(latitude) * sin(longitude),
32 | sin(latitude),
33 | cos(latitude) * cos(longitude));
34 | }
35 |
36 | }//namespace glm
37 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/projection.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_projection
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER genType proj(genType const& x, genType const& Normal)
7 | {
8 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
9 | }
10 | }//namespace glm
11 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/raw_data.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_raw_data
2 |
3 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/scalar_relational.hpp:
--------------------------------------------------------------------------------
1 | /// @ref gtx_scalar_relational
2 | /// @file glm/gtx/scalar_relational.hpp
3 | ///
4 | /// @see core (dependence)
5 | ///
6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational
7 | /// @ingroup gtx
8 | ///
9 | /// Include to use the features of this extension.
10 | ///
11 | /// Extend a position from a source to a position at a defined length.
12 |
13 | #pragma once
14 |
15 | // Dependency:
16 | #include "../glm.hpp"
17 |
18 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19 | # ifndef GLM_ENABLE_EXPERIMENTAL
20 | # pragma message("GLM: GLM_GTX_extend is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.")
21 | # else
22 | # pragma message("GLM: GLM_GTX_extend extension included")
23 | # endif
24 | #endif
25 |
26 | namespace glm
27 | {
28 | /// @addtogroup gtx_scalar_relational
29 | /// @{
30 |
31 |
32 |
33 | /// @}
34 | }//namespace glm
35 |
36 | #include "scalar_relational.inl"
37 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/std_based_type.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_std_based_type
2 |
3 | namespace glm
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/texture.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_texture
2 |
3 | namespace glm
4 | {
5 | template
6 | inline T levels(vec const& Extent)
7 | {
8 | return glm::log2(compMax(Extent)) + static_cast(1);
9 | }
10 |
11 | template
12 | inline T levels(T Extent)
13 | {
14 | return vec<1, T, defaultp>(Extent).x;
15 | }
16 | }//namespace glm
17 |
18 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/transform.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtx_transform
2 |
3 | namespace glm
4 | {
5 | template
6 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v)
7 | {
8 | return translate(mat<4, 4, T, Q>(static_cast(1)), v);
9 | }
10 |
11 | template
12 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v)
13 | {
14 | return rotate(mat<4, 4, T, Q>(static_cast(1)), angle, v);
15 | }
16 |
17 | template
18 | GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v)
19 | {
20 | return scale(mat<4, 4, T, Q>(static_cast(1)), v);
21 | }
22 |
23 | }//namespace glm
24 |
--------------------------------------------------------------------------------
/third_party/glm/glm/gtx/type_aligned.inl:
--------------------------------------------------------------------------------
1 | /// @ref gtc_type_aligned
2 |
3 | namespace glm
4 | {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat2x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat2x2.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double2x2.hpp"
6 | #include "./ext/matrix_double2x2_precision.hpp"
7 | #include "./ext/matrix_float2x2.hpp"
8 | #include "./ext/matrix_float2x2_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat2x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat2x3.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double2x3.hpp"
6 | #include "./ext/matrix_double2x3_precision.hpp"
7 | #include "./ext/matrix_float2x3.hpp"
8 | #include "./ext/matrix_float2x3_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat2x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat2x4.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double2x4.hpp"
6 | #include "./ext/matrix_double2x4_precision.hpp"
7 | #include "./ext/matrix_float2x4.hpp"
8 | #include "./ext/matrix_float2x4_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat3x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat3x2.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double3x2.hpp"
6 | #include "./ext/matrix_double3x2_precision.hpp"
7 | #include "./ext/matrix_float3x2.hpp"
8 | #include "./ext/matrix_float3x2_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat3x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat3x3.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double3x3.hpp"
6 | #include "./ext/matrix_double3x3_precision.hpp"
7 | #include "./ext/matrix_float3x3.hpp"
8 | #include "./ext/matrix_float3x3_precision.hpp"
9 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat3x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat3x4.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double3x4.hpp"
6 | #include "./ext/matrix_double3x4_precision.hpp"
7 | #include "./ext/matrix_float3x4.hpp"
8 | #include "./ext/matrix_float3x4_precision.hpp"
9 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat4x2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat4x2.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double4x2.hpp"
6 | #include "./ext/matrix_double4x2_precision.hpp"
7 | #include "./ext/matrix_float4x2.hpp"
8 | #include "./ext/matrix_float4x2_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat4x3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat4x3.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double4x3.hpp"
6 | #include "./ext/matrix_double4x3_precision.hpp"
7 | #include "./ext/matrix_float4x3.hpp"
8 | #include "./ext/matrix_float4x3_precision.hpp"
9 |
--------------------------------------------------------------------------------
/third_party/glm/glm/mat4x4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/mat4x4.hpp
3 |
4 | #pragma once
5 | #include "./ext/matrix_double4x4.hpp"
6 | #include "./ext/matrix_double4x4_precision.hpp"
7 | #include "./ext/matrix_float4x4.hpp"
8 | #include "./ext/matrix_float4x4_precision.hpp"
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/simd/exponential.h:
--------------------------------------------------------------------------------
1 | /// @ref simd
2 | /// @file glm/simd/experimental.h
3 |
4 | #pragma once
5 |
6 | #include "platform.h"
7 |
8 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
9 |
10 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec1_sqrt_lowp(glm_f32vec4 x)
11 | {
12 | return _mm_mul_ss(_mm_rsqrt_ss(x), x);
13 | }
14 |
15 | GLM_FUNC_QUALIFIER glm_f32vec4 glm_vec4_sqrt_lowp(glm_f32vec4 x)
16 | {
17 | return _mm_mul_ps(_mm_rsqrt_ps(x), x);
18 | }
19 |
20 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
21 |
--------------------------------------------------------------------------------
/third_party/glm/glm/simd/packing.h:
--------------------------------------------------------------------------------
1 | /// @ref simd
2 | /// @file glm/simd/packing.h
3 |
4 | #pragma once
5 |
6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
7 |
8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
9 |
--------------------------------------------------------------------------------
/third_party/glm/glm/simd/trigonometric.h:
--------------------------------------------------------------------------------
1 | /// @ref simd
2 | /// @file glm/simd/trigonometric.h
3 |
4 | #pragma once
5 |
6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
7 |
8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
9 |
10 |
--------------------------------------------------------------------------------
/third_party/glm/glm/simd/vector_relational.h:
--------------------------------------------------------------------------------
1 | /// @ref simd
2 | /// @file glm/simd/vector_relational.h
3 |
4 | #pragma once
5 |
6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT
7 |
8 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
9 |
--------------------------------------------------------------------------------
/third_party/glm/glm/vec2.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/vec2.hpp
3 |
4 | #pragma once
5 | #include "./ext/vector_bool2.hpp"
6 | #include "./ext/vector_bool2_precision.hpp"
7 | #include "./ext/vector_float2.hpp"
8 | #include "./ext/vector_float2_precision.hpp"
9 | #include "./ext/vector_double2.hpp"
10 | #include "./ext/vector_double2_precision.hpp"
11 | #include "./ext/vector_int2.hpp"
12 | #include "./ext/vector_int2_precision.hpp"
13 | #include "./ext/vector_uint2.hpp"
14 | #include "./ext/vector_uint2_precision.hpp"
15 |
--------------------------------------------------------------------------------
/third_party/glm/glm/vec3.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/vec3.hpp
3 |
4 | #pragma once
5 | #include "./ext/vector_bool3.hpp"
6 | #include "./ext/vector_bool3_precision.hpp"
7 | #include "./ext/vector_float3.hpp"
8 | #include "./ext/vector_float3_precision.hpp"
9 | #include "./ext/vector_double3.hpp"
10 | #include "./ext/vector_double3_precision.hpp"
11 | #include "./ext/vector_int3.hpp"
12 | #include "./ext/vector_int3_precision.hpp"
13 | #include "./ext/vector_uint3.hpp"
14 | #include "./ext/vector_uint3_precision.hpp"
15 |
--------------------------------------------------------------------------------
/third_party/glm/glm/vec4.hpp:
--------------------------------------------------------------------------------
1 | /// @ref core
2 | /// @file glm/vec4.hpp
3 |
4 | #pragma once
5 | #include "./ext/vector_bool4.hpp"
6 | #include "./ext/vector_bool4_precision.hpp"
7 | #include "./ext/vector_float4.hpp"
8 | #include "./ext/vector_float4_precision.hpp"
9 | #include "./ext/vector_double4.hpp"
10 | #include "./ext/vector_double4_precision.hpp"
11 | #include "./ext/vector_int4.hpp"
12 | #include "./ext/vector_int4_precision.hpp"
13 | #include "./ext/vector_uint4.hpp"
14 | #include "./ext/vector_uint4_precision.hpp"
15 |
16 |
--------------------------------------------------------------------------------