12#pragma comment(linker, "/subsystem:windows")
16#include <ShellScalingAPI.h>
17#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
18#include <android/native_activity.h>
19#include <android/asset_manager.h>
20#include <android_native_app_glue.h>
21#include <sys/system_properties.h>
39#define GLM_FORCE_RADIANS
40#define GLM_FORCE_DEPTH_ZERO_TO_ONE
41#define GLM_ENABLE_EXPERIMENTAL
43#include <glm/gtc/matrix_transform.hpp>
44#include <glm/gtc/matrix_inverse.hpp>
45#include <glm/gtc/type_ptr.hpp>
50#include "vulkan/vulkan.h"
97 std::chrono::time_point<std::chrono::high_resolution_clock>
lastTimestamp;
169 static std::vector<const char*>
args;
181 std::string
title =
"Vulkan Example";
182 std::string
name =
"vulkanExample";
205 HINSTANCE windowInstance;
206#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
208 bool focused =
false;
213 bool touchDown =
false;
214 double touchTimer = 0.0;
215 int64_t lastTapTime = 0;
218 VkApp(
bool enableValidation =
false);
224 void setupConsole(std::string
title);
225 void setupDPIAwareness();
226 HWND setupWindow(HINSTANCE hinstance, WNDPROC wndproc);
227 void handleMessages(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
228#elif defined(VK_USE_PLATFORM_ANDROID_KHR)
229 static int32_t handleAppInput(
struct android_app* app, AInputEvent* event);
230 static void handleAppCommand(android_app* app, int32_t cmd);
239 virtual void mouseMoved(
double x,
double y,
bool &handled);
257 VkPipelineShaderStageCreateInfo
loadShader(std::string fileName, VkShaderStageFlagBits stage);
263 void drawUI(
const VkCommandBuffer commandBuffer);
void drawUI(const VkCommandBuffer commandBuffer)
Adds the drawing commands for the ImGui overlay to the given command buffer.
std::string getWindowTitle()
VkDescriptorPool descriptorPool
void destroyCommandBuffers()
void buildCustomCommandBuffer(VkCommandBuffer commandBuffer)
virtual void mouseMoved(double x, double y, bool &handled)
(Virtual) Called after the mouse cursor moved and before internal events (like camera rotation) is ha...
virtual void buildCommandBuffers()
(Virtual) Called when resources have been recreated that require a rebuild of the command buffers (e....
virtual void getEnabledFeatures()
(Virtual) Called after the physical device features have been read, can be used to set features to en...
std::vector< const char * > enabledDeviceExtensions
Set of device extensions to be enabled for this example (must be set in the derived constructor)
virtual void setupFrameBuffer()
(Virtual) Setup default framebuffers for all requested swapchain images
std::string getShadersPath() const
std::vector< const char * > enabledInstanceExtensions
VkPipelineShaderStageCreateInfo loadShader(std::string fileName, VkShaderStageFlagBits stage)
Loads a SPIR-V shader file for the given shader stage.
void * deviceCreatepNextChain
Optional pNext structure for passing extension structures to device creation.
virtual void renderFrame()
(Virtual) Default image acquire + submission and command buffer submission function
virtual void viewChanged()
(Virtual) Called when the camera view has changed
void setWindowTitle(std::string name)
virtual void keyPressed(uint32_t)
(Virtual) Called after a key was pressed, can be used to do custom key handling
float frameTimer
Last frame time measured using a high performance timer (if available)
void submitFrame()
Presents the current image to the swap chain.
VkClearColorValue defaultClearColor
void handleMouseMove(int32_t x, int32_t y)
VkPipelineStageFlags submitPipelineStages
Pipeline stages used to wait at for graphics queue submissions.
virtual void setupDepthStencil()
(Virtual) Setup default depth and stencil views
void renderLoop()
Entry point for the main render loop.
std::vector< VkFence > waitFences
void createSynchronizationPrimitives()
VkApp(bool enableValidation=false)
virtual void windowResized()
(Virtual) Called when the window has been resized, can be used by the sample application to recreate ...
struct VkApp::@035006017256177105240376270267042317070052055111 depthStencil
std::chrono::time_point< std::chrono::high_resolution_clock > lastTimestamp
virtual void prepare()
Prepares all Vulkan resources and functions required to run the sample.
VkFormat depthFormat
Logical device, application's view of the physical device (GPU)
std::vector< VkFramebuffer > frameBuffers
static std::vector< const char * > args
std::vector< VkCommandBuffer > drawCmdBuffers
virtual void render()
(Pure virtual) Render function to be implemented by the sample application
VkSemaphore renderComplete
VulkanSwapChain swapChain
void setSceneGraph(std::shared_ptr< dyno::SceneGraph > scn)
struct VkApp::@024362050273107367271176263277065044127044370222 semaphores
struct VkApp::@236151146162240273010117313013267214200120303363 gamePadState
void createCommandBuffers()
virtual void setupRenderPass()
(Virtual) Setup a default renderpass
VkSemaphore presentComplete
struct VkApp::Settings settings
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
(Virtual) Called when the UI overlay is updating, can be used to add custom elements to the overlay
bool initVulkan()
Setup the vulkan instance, enable required extensions and connect to the physical device (GPU)
struct VkApp::@033204162100256106143271256032327056257013175042 mouseButtons
std::vector< VkShaderModule > shaderModules
This is an implementation of AdditiveCCD based on peridyno.
Example settings that can be changed e.g. by command line arguments.
bool fullscreen
Set to true if fullscreen mode has been requested via command line.
bool overlay
Enable UI overlay.
bool validation
Activates validation layers (and message output) when set to true.
bool vsync
Set to true if v-sync will be forced for the swapchain.