The Joe Engine
Joe's engine programming playground
Common.h File Reference
#include <string>
#include <functional>
#include "GLFW/glfw3.h"
#include "vulkan/vulkan.h"
#include "../Rendering/VulkanQueue.h"
#include "glm/glm.hpp"

Namespaces

 JoeEngine
 

Macros

#define GLFW_INCLUDE_VULKAN
 Tell GLFW to use Vulkan (https://www.glfw.org/docs/latest/vulkan_guide.html). More...
 
#define GLM_FORCE_RADIANS
 Force GLM to use radians. More...
 
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
 Force GLM to keep depth values on the range [0, 1]. More...
 
#define GLM_ENABLE_EXPERIMENTAL
 Enable experimental features of GLM. More...
 
#define GLM_FORCE_LEFT_HANDED
 Force GLM to use left-handed coordinate systems. More...
 

Typedefs

typedef enum JoeEngine::JE_RENDERER_SETTINGS_TYPE JoeEngine::RendererSettings
 Engine renderer settings bit flag. More...
 
using JoeEngine::JECallbackFunction = std::function< void()>
 Simple typedef for std::function. More...
 

Enumerations

enum  JoeEngine::JE_RENDERER_SETTINGS_TYPE : uint32_t { JoeEngine::JE_RENDERER_SETTINGS_TYPE::Default = 0x0, JoeEngine::JE_RENDERER_SETTINGS_TYPE::EnableDeferred = 0x1, JoeEngine::JE_RENDERER_SETTINGS_TYPE::EnableOIT = 0x2, JoeEngine::JE_RENDERER_SETTINGS_TYPE::AllSettings = 0xFFFFFFFF }
 Engine renderer settings bit flag. More...
 

Functions

bool JoeEngine::operator& (RendererSettings a, RendererSettings b)
 &-operator for Renderer Settings. More...
 
RendererSettings JoeEngine::operator| (RendererSettings a, RendererSettings b)
 |- operator for Renderer Settings. More...
 
VkCommandBuffer JoeEngine::BeginSingleTimeCommands (VkDevice device, VkCommandPool commandPool)
 Begin single time command buffer recording. More...
 
void JoeEngine::EndSingleTimeCommands (VkDevice device, VkCommandBuffer commandBuffer, const JEVulkanQueue &graphicsQueue, VkCommandPool commandPool)
 End single time command buffer recording. More...
 
bool JoeEngine::HasStencilComponent (VkFormat format)
 Check if a depth format has a stencil component. More...
 
uint32_t JoeEngine::FindMemoryType (VkPhysicalDevice physicalDevice, uint32_t typeFilter, VkMemoryPropertyFlags properties)
 Get memory for an allocation. More...
 
void JoeEngine::CreateBuffer (VkPhysicalDevice physicalDevice, VkDevice device, VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VkDeviceMemory &bufferMemory)
 Create buffer on the GPU. More...
 
void JoeEngine::CopyBuffer (VkDevice device, VkCommandPool commandPool, const JEVulkanQueue &graphicsQueue, VkBuffer srcBuffer, VkBuffer dstBuffer, VkDeviceSize size)
 Copy buffer CPU to GPU. More...
 
void JoeEngine::CreateImage (VkPhysicalDevice physicalDevice, VkDevice device, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage &image, VkDeviceMemory &imageMemory)
 Create image. More...
 
VkImageView JoeEngine::CreateImageView (VkDevice device, VkImage image, VkFormat format, VkImageAspectFlags aspectFlags)
 Create image view. More...
 
void JoeEngine::TransitionImageLayout (VkDevice device, VkCommandPool commandPool, const JEVulkanQueue &graphicsQueue, VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout)
 Transition image from initial to final layout. More...
 
VkFormat JoeEngine::FindSupportedFormat (VkPhysicalDevice physicalDevice, const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
 Check if several candidate formats are supported. More...
 
VkFormat JoeEngine::FindDepthFormat (VkPhysicalDevice physicalDevice)
 Find a supported format among several candidate depth formats. More...
 

Variables

constexpr int JoeEngine::JE_DEFAULT_SCREEN_WIDTH = 1280
 Default screen resolution width. More...
 
constexpr int JoeEngine::JE_DEFAULT_SCREEN_HEIGHT = 720
 Default screen resolution height. More...
 
constexpr uint32_t JoeEngine::JE_DEFAULT_MAX_FRAMES_IN_FLIGHT = 2
 Default maximum number of frames in flight on the GPU. More...
 
constexpr int JoeEngine::JE_NUM_ENTITIES = 10000
 Maximum number of entities in any given scene. More...
 
constexpr uint16_t JoeEngine::JE_NUM_OIT_FRAGSPP = 16
 Maximum number of fragments per pixel for OIT. More...
 
constexpr int JoeEngine::JE_DEFAULT_SHADOW_MAP_WIDTH = 4000
 Default shadow map resolution width. More...
 
constexpr int JoeEngine::JE_DEFAULT_SHADOW_MAP_HEIGHT = 4000
 Default shadow map resolution height. More...
 
constexpr float JoeEngine::JE_DEFAULT_SHADOW_MAP_DEPTH_BIAS_SLOPE = 1.5f
 Default shadow map depth bias - slope. More...
 
constexpr float JoeEngine::JE_DEFAULT_SHADOW_MAP_DEPTH_BIAS_CONSTANT = 0.0f
 Default shadow map depth bias - constant. More...
 
const glm::vec3 JoeEngine::JE_WORLD_UP = glm::vec3(0.0f, 1.0f, 0.0f)
 World up vector (Y is up). More...
 
constexpr float JoeEngine::JE_SCENE_VIEW_NEAR_PLANE = 0.1f
 Scene camera near clip plane value. More...
 
constexpr float JoeEngine::JE_SCENE_VIEW_FAR_PLANE = 200.0f
 Scene camera far clip plane value. More...
 
constexpr float JoeEngine::JE_SHADOW_VIEW_NEAR_PLANE = 0.1f
 Shadow camera near clip plane value. More...
 
constexpr float JoeEngine::JE_SHADOW_VIEW_FAR_PLANE = 200.0f
 Shadow camera far clip plane value. More...
 
const float JoeEngine::JE_FOVY = glm::radians(22.5f)
 Scene camera FOV value. More...
 
const std::string JoeEngine::JE_PROJECT_PATH
 Project path string. More...
 
const std::string JoeEngine::JE_SHADER_DIR
 Shader directory path string. More...
 
const std::string JoeEngine::JE_MODELS_OBJ_DIR
 OBJ models path string. More...
 
const std::string JoeEngine::JE_TEXTURES_DIR
 Textures directory path string. More...
 
const int JoeEngine::JE_KEY_W = GLFW_KEY_W
 Keypress - W. More...
 
const int JoeEngine::JE_KEY_A = GLFW_KEY_A
 Keypress - A. More...
 
const int JoeEngine::JE_KEY_S = GLFW_KEY_S
 Keypress - S. More...
 
const int JoeEngine::JE_KEY_D = GLFW_KEY_D
 Keypress - D. More...
 
const int JoeEngine::JE_KEY_Q = GLFW_KEY_Q
 Keypress - Q. More...
 
const int JoeEngine::JE_KEY_E = GLFW_KEY_E
 Keypress - E. More...
 
const int JoeEngine::JE_KEY_UP = GLFW_KEY_UP
 Keypress - Up arrow. More...
 
const int JoeEngine::JE_KEY_LEFT = GLFW_KEY_LEFT
 Keypress - Left arrow. More...
 
const int JoeEngine::JE_KEY_DOWN = GLFW_KEY_DOWN
 Keypress - Down arrow. More...
 
const int JoeEngine::JE_KEY_RIGHT = GLFW_KEY_RIGHT
 Keypress - Right arrow. More...
 
const int JoeEngine::JE_KEY_0 = GLFW_KEY_0
 Keypress - 0. More...
 
const int JoeEngine::JE_KEY_1 = GLFW_KEY_1
 Keypress - 1. More...
 
const int JoeEngine::JE_KEY_2 = GLFW_KEY_2
 Keypress - 2. More...
 
const int JoeEngine::JE_KEY_3 = GLFW_KEY_3
 Keypress - 3. More...
 
const int JoeEngine::JE_KEY_4 = GLFW_KEY_4
 Keypress - 4. More...
 
const int JoeEngine::JE_KEY_5 = GLFW_KEY_5
 Keypress - 5. More...
 
const int JoeEngine::JE_KEY_6 = GLFW_KEY_6
 Keypress - 6. More...
 
const int JoeEngine::JE_KEY_7 = GLFW_KEY_7
 Keypress - 7. More...
 
const int JoeEngine::JE_KEY_8 = GLFW_KEY_8
 Keypress - 8. More...
 
const int JoeEngine::JE_KEY_9 = GLFW_KEY_9
 Keypress - 9. More...
 

Macro Definition Documentation

◆ GLFW_INCLUDE_VULKAN

#define GLFW_INCLUDE_VULKAN

◆ GLM_ENABLE_EXPERIMENTAL

#define GLM_ENABLE_EXPERIMENTAL

Enable experimental features of GLM.

◆ GLM_FORCE_DEPTH_ZERO_TO_ONE

#define GLM_FORCE_DEPTH_ZERO_TO_ONE

Force GLM to keep depth values on the range [0, 1].

◆ GLM_FORCE_LEFT_HANDED

#define GLM_FORCE_LEFT_HANDED

Force GLM to use left-handed coordinate systems.

◆ GLM_FORCE_RADIANS

#define GLM_FORCE_RADIANS

Force GLM to use radians.