SpiecsEngine
 
Loading...
Searching...
No Matches
ImguiInfoBar.h
Go to the documentation of this file.
1/**
2* @file ImguiInfoBar.h
3* @brief The ImguiInfoBar Class Definitions.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9#include "ImguiUtils.h"
10
11namespace Spices {
12
13 /**
14 * @brief Forward declare.
15 */
16 class SlateInfoBar;
17
18 /**
19 * @brief The ImguiInfoBar Class.
20 * This class defines how to render a Operation Panel.
21 */
22 class ImguiInfoBar : public ImguiSlate
23 {
24 public:
25
26 /**
27 * @brief Constructor Function.
28 * @param[in] panelName The Slate's name to show.
29 * @param[in] frameInfo The Frame Date that in use.
30 */
32 const std::string& panelName ,
33 FrameInfo& frameInfo
34 )
35 : ImguiSlate(panelName, frameInfo)
36 , m_SelectedInfoBar(nullptr)
37 {}
38
39 /**
40 * @brief Destructor Function.
41 */
42 virtual ~ImguiInfoBar() override = default;
43
44 /**
45 * @brief This interface is called On SlateSystem Update.
46 * @param[in] ts TimeStep.
47 */
48 virtual void OnUpdate(TimeStep& ts) override;
49
50 /**
51 * @brief This interface is called On SlateRenderer Render.
52 */
53 virtual void OnRender() override;
54
55 /**
56 * @brief This interface is called On Global Event Function Pointer is called.
57 */
58 virtual void OnEvent(Event& event) override {}
59
60 /**
61 * @brief Add a InfoBar instance to this.
62 * @param[in] instance InfoBar instance.
63 */
64 void Push(std::shared_ptr<SlateInfoBar> instance);
65
66 private:
67
68 /**
69 * @brief Selected InfoBar.
70 */
72
73 /**
74 * @brief InfoBar instances.
75 */
76 scl::linked_unordered_map<std::string, std::shared_ptr<SlateInfoBar>> m_InfoBars;
77 };
78}
#define EVENT_CLASS_TYPE(type)
Defines Event type.
Definition Event.h:74
#define EVENT_CLASS_CATEGORY(category)
Defines Event category.
Definition Event.h:82
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
#define SPICES_PROFILE_VK_ZONE(cmdbuf, name)
#define SPICES_PROFILE_FRAME
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
virtual ~Application()
Destructor Function.
Application()
Constructor Function.
static void Run()
Run Our World.
Application Class. Our Engine Start here.
Definition Application.h:20
Console Entity Class.
Definition Console.h:82
Entity Class. This class defines the specific behaves of Entity.
Definition Entity.h:20
This Class is the basic Event Class. Inherit from it and create specific event class.
Definition Event.h:96
uint32_t m_PickMaterial
Identify of selected material.
Definition FrameInfo.h:89
FrameInfo(const FrameInfo &)=delete
Copy Constructor Function.
uint32_t m_FrameIndex
FrameIndex, varying during 0 - (MaxFrameInFlight - 1). Used almost anywhere.
Definition FrameInfo.h:69
FrameInfo & operator=(const FrameInfo &)=delete
Copy Assignment Operation.
virtual ~FrameInfo()=default
Destructor Function.
static FrameInfo & Get()
Get FrameInfo.
Definition FrameInfo.cpp:14
std::shared_ptr< World > m_World
The shared pointer of specific world.
Definition FrameInfo.h:94
scl::linked_unordered_map< int, std::string > m_PickEntityID
Definition FrameInfo.h:82
RendererType m_RendererType
The renderer type of current world.
Definition FrameInfo.h:99
FrameInfo()=default
Constructor Function.
uint32_t m_ImageIndex
ImageIndex, varying during 0 - (MaxFrameInFlight - 1). Used in swapchain index and framebuffer index.
Definition FrameInfo.h:75
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.
The ImGuiH Class. This class defines helper function for slate render.
Definition ImguiHelper.h:61
std::shared_ptr< Console > m_Console
The shared pointer of Console.
virtual ~ImguiConsole() override=default
Destructor Function.
bool m_EnableCmdInput
The boolean of enable Cmd Input.
ImguiConsole(const std::string &panelName, FrameInfo &frameInfo, std::shared_ptr< Console > console)
Constructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImGuiTextFilter m_Filter
The Filter of console.
int m_Level
The information level that console show.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
static int TextEditCallbackStub(ImGuiInputTextCallbackData *data)
Input Text Call back function.
The ImguiConsole Class. This class defines how to render a Console.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImguiContentBrowser(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual ~ImguiContentBrowser() override=default
Destructor Function.
The ImguiContentBrowser Class. This class defines how to render a Content Browser.
The ImguiCreateEntity Class. This class defines how to render a Create.
The ImguiEdit Class. This class defines how to render a edit menu.
Definition ImguiEdit.h:23
The ImguiFile Class. This class defines how to render a file menu.
Definition ImguiFile.h:18
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
bool OnKeyPressed(KeyPressedEvent &e)
Event Dispatcher target. Registry on Key Resized.
virtual ~ImguiGizmos() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
Definition ImguiGizmos.h:45
int m_GizmoType
Gizmo Type, Transpose, rotate, scale, universal.
Definition ImguiGizmos.h:84
ImguiSlate * m_Owner
The owner, usually is a ImguiViewport class.
Definition ImguiGizmos.h:79
bool bEnableGizmo
Is Enable Gizmo.
Definition ImguiGizmos.h:89
ImguiGizmos(const std::string &panelName, FrameInfo &frameInfo, ImguiSlate *owner)
Constructor Function.
Definition ImguiGizmos.h:27
bool IsOver() const
Is mouse is over gizmo.
Definition ImguiGizmos.h:63
The ImguiGizmos Class. This class defines how to render a viewport gizmo.
Definition ImguiGizmos.h:18
The ImguiHelp Class. This class defines how to render a Help.
Definition ImguiHelp.h:23
ImguiInfoBar(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
scl::linked_unordered_map< std::string, std::shared_ptr< SlateInfoBar > > m_InfoBars
InfoBar instances.
std::shared_ptr< SlateInfoBar > m_SelectedInfoBar
Selected InfoBar.
void Push(std::shared_ptr< SlateInfoBar > instance)
Add a InfoBar instance to this.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual ~ImguiInfoBar() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
The ImguiInfoBar Class. This class defines how to render a Operation Panel.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
std::shared_ptr< ImguiCreateEntity > m_Create
std::shared_ptr< ImguiWindow > m_Window
std::shared_ptr< ImguiEdit > m_Edit
The shared pointer of ImguiEdit.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImguiMainMenu(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
std::shared_ptr< ImguiHelp > m_Help
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
std::shared_ptr< ImguiFile > m_File
The shared pointer of ImguiFile.
virtual ~ImguiMainMenu() override=default
Destructor Function.
The ImguiMainMenu Class. This class defines how to render a main menu.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual ~ImguiOperation() override=default
Destructor Function.
ImguiOperation(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
The ImguiOperation Class. This class defines how to render a Operation Panel.
static void DrawComponent(const std::string &name, Entity entity)
Draw Entity Component on Property Panel.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
ImguiProperty(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
virtual ~ImguiProperty() override=default
Destructor Function.
The ImguiProperty Class. This class defines how to render a Property.
bool m_IsHovered
True if Hovered.
Definition ImguiUtils.h:176
ImVec2 & GetPanelSize()
Get Panel Size.
Definition ImguiUtils.h:114
virtual ~ImguiSlate()=default
Destructor Function.
void Begin(float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate.
void SetWindowState(bool isSlateOn)
Set Slate is render able or not.
Definition ImguiUtils.h:106
void Begin(const std::string &panelName, float alpha=1.0f, ImGuiWindowFlags flags=0)
Begin a common slate with name.
virtual void OnUpdate(TimeStep &ts)=0
This interface is called on SlateSystem Update.
bool IsHovered() const
Get is IsHovered.
Definition ImguiUtils.h:132
ImVec2 m_PanelPos
This slate's position in desktop.
Definition ImguiUtils.h:156
FrameInfo & m_FrameInfo
The FrameData reference.
Definition ImguiUtils.h:166
void End()
End a slate.
ImVec2 & GetPanelPos()
Get Panel Pos.
Definition ImguiUtils.h:120
ImGuiWindowFlags m_WindowFlags
Flags of this window slate.
Definition ImguiUtils.h:191
ImVec2 m_PanelSize
This slate's size.
Definition ImguiUtils.h:151
virtual void QueryIsResizedThisFrame(const ImVec2 &thisFrameSize)
Query whether viewport is resized this frame.
bool IsResizedThisFrame() const
Get boolean of whether resized this frame.
Definition ImguiUtils.h:138
virtual void OnEvent(Event &event)=0
This interface is called on global event function pointer execute.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
virtual void OnRender()=0
This interface is called on SlateRenderer Render.
void LoadSlateIcon(ImTextureID &id, const std::string &iconFile)
Load a Texture from ResourcePool.
bool m_IsResized
Boolean of whether resized this frame.
Definition ImguiUtils.h:186
std::string m_PanelName
This slate's name.
Definition ImguiUtils.h:161
const std::string & GetName() const
Get this panel Name.
Definition ImguiUtils.h:144
bool IsFocused() const
Get is IsFocused.
Definition ImguiUtils.h:126
bool m_IsFocused
True if Focus.
Definition ImguiUtils.h:171
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
Definition ImguiUtils.h:27
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
Definition ImguiStage.h:50
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual ~ImguiStage() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
Definition ImguiStage.h:40
ImguiStage(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
The ImguiStage Class. This class defines how to render a Stage.
Definition ImguiStage.h:18
uint32_t m_Index
This viewport index.
std::shared_ptr< ImguiViewportToolBar > m_ToolBar
The shared pointer of ImguiGizmos.
std::shared_ptr< ImguiGizmos > m_Gizmos
The shared pointer of ImguiGizmos.
bool OnWindowResizeOver(WindowResizeOverEvent &event) const
Event Dispatcher target. Registry on Windows Resized.
virtual ~ImguiViewport() override=default
Destructor Function.
std::shared_ptr< scl::behave_state_list< void > > m_ToggleStateList
Toggle behave state list.
bool m_IsToggled
True if this slate toggled this frame.
void Toggle() const
Toggle viewport.
bool OnToggleSlate(KeyPressedEvent &event) const
Toggle focused slate.
ImguiViewport(const std::string &panelName, FrameInfo &frameInfo, uint32_t index=0)
Constructor Function.
bool OnSlateResize(SlateResizeEvent &event) const
Event Dispatcher target. Registry on Slate(Viewport) Resized.
virtual void QueryIsResizedThisFrame(const ImVec2 &thisFrameSize) override
Query whether viewport is resized this frame. Clamp min m_panelsize value to 1 here,...
virtual void OnRender() override
This interface is called On SlateRenderer Render.
std::shared_ptr< ImguiFloatingInfo > m_FloatingInfo
The shared pointer of ImguiFloatingInfo.
std::pair< uint32_t, uint32_t > GetMousePosInViewport() const
Get Mouse Position Relative Viewport(Might be negative value).
std::shared_ptr< ImguiGizmos > GetGizmo()
Get Gizmo Shared Pointer.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
std::shared_ptr< SlateImage > m_ViewportContext
SlateImage of SceneColor.
virtual void OnEvent(Event &event) override
This interface is called On Global Event Function Pointer is called.
The ImguiViewport Class. This class defines how to render a viewport.
The ImguiWindow Class. This class defines how to render a window menu.
Definition ImguiWindow.h:33
This Class is inherited from KeyEvent Class.
Definition KeyEvent.h:57
static void Init()
Init Log.
Definition Log.cpp:24
static void ShutDown()
Shutdown Log.
Definition Log.cpp:82
Material Class. This class contains a branch of parameter and shader, also descriptor.
Definition Material.h:62
virtual std::string ToString() const override
Serialize this Event Class to string.
Definition WorldEvent.h:60
MeshAddedWorldEvent()=default
Constructor Function.
virtual ~MeshAddedWorldEvent() override=default
Destructor Function.
This Class is inherited from Event Class.
Definition WorldEvent.h:43
NativeScriptSystem Class. This class defines the specific behaves of NativeScriptSystem.
ResourceSystem Class. This class defines the specific behaves of RenderSystem.
std::unordered_map< std::string, std::unique_ptr< RendererResource > > m_RendererResource
The hashmap of all RendererResource.
RendererResourcePool(const RendererResourcePool &)=delete
Copy Constructor Function.
VkDescriptorImageInfo * AccessResource(const RendererResourceCreateInfo &info=RendererResourceCreateInfo{}, uint32_t mipLevel=0)
Get Resource with specific name, create it if it have not been created.
void OnSlateResize(uint32_t width, uint32_t height) const
Event Called on Slate resize.
RendererResourcePool()=default
Constructor Function.
RendererResourcePool & operator=(const RendererResourcePool &)=delete
Copy Assignment Operation.
std::shared_ptr< VulkanImage > AccessRowResource(const std::string &name)
Get Row Resource with specific name.
virtual ~RendererResourcePool()=default
Destructor Function.
RendererResourcePool Class. This class is a pool of all framebuffer's attachment.
std::unique_ptr< Texture2D > m_Texture
The texture this class Wrapped.
RendererResourceCreateInfo m_Info
The information of this resource.
RendererResource(const RendererResourceCreateInfo &info)
Constructor Function. Init member variables.
std::unique_ptr< Texture2D > & GetTexture()
Get Texture this class wrapped.
bool IsResizeable() const
Get isResizeable variable.
void OnResized(uint32_t width, uint32_t height)
Called On SwapChain Resized. Event received from VulkanRenderBackEnd.
virtual ~RendererResource()=default
Destructor Function.
bool m_IsResizeable
True if this resource can resize.
RendererResource Class. This class is a wrapper of framebuffer attachment.
ResourceSystem Class. Handles resource load/unload event.
SlateImage(const std::string &textureName, const std::string &materialName)
Constructor Function.
void ReBuildMaterial()
Rebuild this Material.
std::shared_ptr< Material > m_Material
This Slate image draw material.
Definition SlateImage.h:65
virtual ~SlateImage()
Destructor Function.
std::string m_TextureName
Texture name.
Definition SlateImage.h:70
std::shared_ptr< Material > GetMaterial()
Get this Material.
Definition SlateImage.h:53
ImTextureID GetTextureID()
Get this TextureID.
Definition SlateImage.h:47
void ReBuildTextureID()
Rebuild this ImTextureID.
ImTextureID m_TextureID
ImTextureID.
Definition SlateImage.h:60
std::string m_MaterialName
Material name.
Definition SlateImage.h:75
Slate image draw context.
Definition SlateImage.h:18
This Class defines InfoBar instance.
std::shared_ptr< ImguiSlate > GetSlate(const std::string &name)
Get Slate by name.
std::unordered_map< std::string, std::shared_ptr< ImguiSlate > > m_SlatesRenderContainer
The container of all slate handle.
std::shared_ptr< ImguiViewport > GetViewPort()
virtual ~SlateRegister()=default
Destructor Function.
void OnEvent(Event &event)
This function will be called on global Event function pointer is called.
std::unordered_map< std::string, std::shared_ptr< ImguiSlate > > m_SlatesEventContainer
The container of all slate handle.
void OnRender() const
This function is called on SlateRenderer::Render.
void OnUpdate(TimeStep &ts) const
SlateRegister & operator=(const SlateRegister &)=delete
Copy Assignment Operation.
SlateRegister()=default
Constructor Function.
std::shared_ptr< T > Register(bool isPrimary, const std::string &panelName, Args &&... args)
This function registry slate instance.
SlateRegister(const SlateRegister &)=delete
Copy Constructor Function.
This Class is the manager of all slate, it keeps all slate handle.
This Class is inherited from Event Class. Called by Viewport Resize.
Definition SlateEvent.h:18
virtual ~SlateSystem() override
Destructor Function.
static std::shared_ptr< SlateRegister > m_SlateRegister
The slate register.
Definition SlateSystem.h:74
static std::shared_ptr< SlateRegister > GetRegister()
Get slate register.
Definition SlateSystem.h:67
virtual void OnSystemInitialize() override
This interface defines the behaves on specific system initialized. Called when system Pushed to Syste...
SlateSystem(const std::string &systemName)
Constructor Function. Init class variable. Usually call it.
Definition SlateSystem.h:30
virtual void OnSystemShutDown() override
This interface defines the behaves on specific system shutdown. Called when system popped from System...
virtual void OnEvent(Event &event) override
This interface defines the behaves on global event function pointer is called.
virtual void OnSystemUpdate(TimeStep &ts) override
This interface defines the behaves on specific system updated every frame.
SlateSystem Class. This class defines the specific behaves of SlateSystem.
Definition SlateSystem.h:21
SystemManager()
Constructor Function.
static SystemManager & Get()
Get Static SystemManager.
SystemManager & PopSystem(const std::string &systemName)
Push a system to this manager.
SystemManager Class. This class defines the behave of SystemManager.
System(const std::string &systemName)
Constructor Function. Init class variable. Usually call it.
System Class. This class defines the basic behaves of System. When we create an new System,...
Texture2DArray(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
virtual ~Texture2DArray() override=default
Destructor Function.
Texture2DArray(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
Texture2DArray()
Constructor Function.
Texture2D Class. This class defines the basic behaves of Texture2DArray.
virtual ~Texture2DCube() override=default
Destructor Function.
Texture2DCube(const RendererResourceCreateInfo &info)
Constructor Function. Used for create render resource.
Texture2DCube(const std::string &path)
Constructor Function. Init class variable, load date immediately. Usually call it.
Texture2DCube()
Constructor Function.
Texture2DCube Class. This class defines the basic behaves of Texture2DCube.
Texture2D Class. This class defines the basic behaves of texture2D.
Definition Texture2D.h:20
TextureLoader Class. This class only defines static function for load data from image file.
void Flush()
Refresh time in each engine loop.
Definition TimeStep.cpp:26
const uint64_t & fs() const
Get frames count.
Definition TimeStep.h:63
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
Transcoder of Texture Container format and Transform format and GPU compress format.
Definition Transcoder.h:17
virtual ~VulkanCommandBuffer() override=default
Destructor Function. VkCommandBuffer is created by VkCommandPool, we do not need destroy it here manu...
VulkanCommandBuffer(VulkanState &vulkanState)
Constructor Function. Create VkCommandBuffer.
static void CustomGraphicCmd(VulkanState &vulkanState, T func)
Create a new command buffer and record custom cmd, submit to graphic queue, execute it immediately.
VulkanCommandBuffer Class. This class defines the VulkanCommandBuffer behaves. This class is just a w...
int m_GraphicThreadId
Thread Unique Graphic ThreadId.
int m_ComputeThreadId
Thread Unique Compute ThreadId.
static VulkanCommandPoolThreadWrapper & GetInst()
Get this instance.
virtual ~VulkanCommandPoolThreadWrapper()
Destructor Function.
VulkanCommandPoolThreadWrapper()
Constructor Function.
Wrapper of Instance/Delete VkCommandPool in thread.
static std::vector< VkCommandPool > m_ThreadGraphicCommandPool
Thread Graphic VkCommandPool map.
static VkCommandPool & GetThreadComputeCommandPool()
Get Thread Compute VkCommandPool by thread id.
static bool m_IsPoolActive
True if this Pool is actived.
VulkanCommandPool(VulkanState &vulkanState)
Constructor Function. Create VkCommandPool.
virtual ~VulkanCommandPool() override
Destructor Function.
static std::mutex m_ComputeCommandPoolMutex
Mutex for GraphicCommandPool.
static VkCommandPool & GetThreadGraphicCommandPool()
Get Thread Graphic VkCommandPool by thread id.
static std::mutex m_GraphicCommandPoolMutex
Mutex for GraphicCommandPool.
static std::vector< VkCommandPool > m_ThreadComputeCommandPool
Thread Compute VkCommandPool map.
VulkanCommandPool Class. This class defines the VulkanCommandPool behaves. This class is just a wrapp...
VulkanDescriptorPool Class. This class is the wrapper of VkDescriptorPool.
VkSampleCountFlagBits GetMaxUsableSampleCount() const
Get device's max usable sample count.
bool IsQueueMeetDemand(const VkPhysicalDevice &device, const VkSurfaceKHR &surface)
Check all Queue we need meet;.
static SwapChainSupportDetails QuerySwapChainSupport(const VkPhysicalDevice &device, const VkSurfaceKHR &surface, GLFWwindow *window)
Query physical device's SwapChainSupport.
const SwapChainSupportDetails & GetSwapChainSupport()
Get SwapChain Utils.
static VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV & GetDGCProperties()
Get DeviceGeneratedCommandsPropertiesNV.
QueueHelper m_QueueHelper
QueueHelper.
static VkPhysicalDeviceFeatures m_DeviceFeatures
Selected Physical Device Features.
static VkPhysicalDeviceProperties & GetDeviceProperties()
Get VkPhysicalDeviceProperties.
virtual ~VulkanDevice() override
Destructor Function.
static VkPhysicalDeviceRayTracingPipelinePropertiesKHR m_RayTracingProperties
Device RayTracing Properties.
static VkPhysicalDeviceFeatures & GetDeviceFeatures()
Get VkPhysicalDeviceFeatures.
bool IsPropertyMeetDemand(const VkPhysicalDevice &device)
Check all Property we need meet.
static VkPhysicalDeviceRayTracingPipelinePropertiesKHR & GetRTPipelineProperties()
Get RayTracingPipelineProperties.
bool IsFeatureMeetDemand(const VkPhysicalDevice &device)
Check all Feature we need meet.
void GetExtensionRequirements()
Get all physical device extension requirements our engine needed. Source 1 : user Setting.
static VkPhysicalDeviceProperties m_DeviceProperties
Selected Physical Device Properties.
static VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV m_DGCProperties
Device DGC Properties.
VulkanDevice(VulkanState &vulkanState)
Constructor Function. Create vkDevice.
bool SelectPhysicalDevice(const VkInstance &instance, const VkSurfaceKHR &surface, GLFWwindow *window)
select a suitable physical device.
SwapChainSupportDetails m_SwapChainSupportDetails
SwapChainSupportDetails.
bool IsExtensionMeetDemand(const VkPhysicalDevice &device)
Check all Extension we need meet;.
std::vector< const char * > m_ExtensionProperties
Device Extension Properties.
void RequerySwapChainSupport()
Requery device's SwapChainSupportDetails. Mainly VkExtent2D.
const QueueHelper & GetQueueHelper() const
Get QueueHelper variable.
VulkanInstance Class. This class defines the VulkanDevice behave. This class is just a wrapper of vkd...
VkImage & GetImage()
Definition VulkanImage.h:86
VkImageType m_ImageType
Image Type.
void CopyImageToMemoryHost(const std::vector< VkImageToMemoryCopyEXT > &copies) const
int m_Width
Image width.
VkFormat m_Format
The image format.
bool IsHostCopyable() const
Check if this image format can copy from host to gpu directly.
static bool IsHostCopyable(VulkanState &state, VkFormat format)
Check if this image format can copy from host to gpu directly.
uint32_t GetWidth() const
Get this Width.
VkDescriptorSet & GetDescriptorSet()
Get VkDescriptorSet.
void CreateDescriptorSet(uint32_t binding)
Create DescriptorSet with single image.
VmaAllocation m_Alloc
VMA allocation.
void CopyImageToMemoryHost(void *data) const
VkDescriptorImageInfo * GetImageInfo(VkImageLayout imageLayout=VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, uint32_t mipLevel=0)
void CopyMemoryToImageHost(const void *data) const
Copy the Memory's data to this VkImage.
void CreateSampler()
Create a Sampler.
void CopyImageToBuffer(VkBuffer dstBuffer, const std::vector< VkBufferImageCopy > &regions)
void CopyImageTexelToBuffer(uint32_t x, uint32_t y, void *out_rgba)
VkDescriptorSetLayout m_DescriptorSetLayout
VkDescriptorSetLayout.
void CreateImage(VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
void DestroyDescriptorSetLayout() const
Destroy the DescriptorSetLayout if Created a DescriptorSet.
VkDeviceMemory m_ImageMemory
The image video memory.
void CopyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height, const std::vector< VkBufferImageCopy > &regions) const
Copy the Buffer's data to this VkImage. Used to create image data (include mipmaps),...
uint32_t GetMipLevels() const
Get this MipLevels.
void CopyMemoryToImageHost(const std::vector< VkMemoryToImageCopyEXT > &copies) const
Copy the Memory's data to this VkImage. Used to create image data (include mipmaps),...
VkSampler m_TextureSampler
The image sampler.
bool m_IsCreateSet
True if Called Create DescriptorSet.
virtual ~VulkanImage() override
Destructor Function.
VulkanImage(VulkanState &vulkanState, const std::string &name, VkImageType type, uint32_t width, uint32_t height, uint32_t layers, VkSampleCountFlagBits numSamples, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkMemoryPropertyFlags properties, uint32_t mipLevels)
uint32_t m_MipLevels
Image mipmaps num.
void CreateImageView(VkFormat format, VkImageViewType viewType, VkImageAspectFlags aspectFlags, bool isCreateMipmapView=false)
Create Image View.
int m_Height
Image height.
void Barrier(VkCommandBuffer commandBuffer, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t srcQueueFamilyIndex, uint32_t dstQueueFamilyIndex) const
Wrapper of Call vkCmdImageBarrier.
VkDescriptorImageInfo m_ImageInfo
VkDescriptorImageInfo.
VkDescriptorSet m_DescriptorSet
VkDescriptorSet.
void TransitionImageLayout(VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout)
void CopyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height) const
Copy the Buffer's data to this VkImage.
VkImageView & GetView(uint32_t mipLevel=0)
Definition VulkanImage.h:80
uint32_t GetLayers() const
Get this Layers.
Definition VulkanImage.h:92
std::vector< VkImageView > m_ImageViews
The image view.
VulkanImage(VulkanState &vulkanState)
Constructor Function. Init class variable. Init a empty VulkanImage, used in TextureLoad.
Definition VulkanImage.h:29
uint32_t GetHeight() const
Get this Height.
Definition VulkanImage.h:98
VkImage m_Image
The VkImage this Class Wrapped.
uint32_t m_Layers
Image layer(texture cube: 6).
VkFormat GetFormat() const
Get this Format.
void GenerateMipmaps(VkFormat imageFormat, int32_t texWidth, int32_t texHeight) const
Generate mipmaps with the VkImage.
void SetVulkanDebugCallbackFuncPointer()
Set Vulkan's debug message callback function pointer. Working with DEBUG mode.
virtual ~VulkanInstance() override
Destructor Function.
VkDebugUtilsMessengerCreateInfoEXT m_DebugMessengerCreateInfo
Debug Utils Messages used to execute message callback function. Also debug vkInstance create.
void CreateVulkanSurface() const
Create a Surface Object.
std::vector< const char * > m_LayerProperties
Instance Layer Properties.
VulkanInstance(VulkanState &vulkanState, const std::string &name, const std::string &engineName)
Constructor Function. Create vkInstance and vkSurface.
std::vector< const char * > m_ExtensionProperties
Instance Extension Properties.
bool CheckExtensionRequirementsSatisfied()
Iter all our extensions, check whether all satisfied or not.
VkDebugUtilsMessengerEXT m_DebugMessenger
Parameter for Create/Destroy DebugUtilsMessengerEXT.
void FillDebugMessengerCreateInfo()
Set m_DebugMessengerCreateInfo variable.
void GetExtensionRequirements()
Get all instance extension requirements our engine needed. Source 1 : glfw requirements....
bool ChecklayerRequirementsSatisfied()
Iter all our layers, check whether all satisfied or not.
void GetLayerRequirements()
Get all instance layer requirements our engine needed. Source 1 : user Setting.
VulkanInstance Class. This class defines the VulkanInstance behaves. This class is just a wrapper of ...
virtual ~VulkanMemoryAllocator() override
Destructor Function.
VulkanMemoryAllocator(VulkanState &vulkanState)
Constructor Function. Create Specific ThreadPool.
VulkanObject(VulkanState &vulkanState)
Constructor Function. Init member variables.
VulkanObject Class. This class defines the basic behaves of VulkanObject. When we create an new Vulka...
void EndFrame(FrameInfo &frameInfo)
End record the frame with vulkan render backend.
void RecreateSwapChain()
Called OnSlateResize.
std::shared_ptr< VulkanMemoryAllocator > m_VmaAllocator
VulkanMemoryAllocator.
std::unique_ptr< VulkanSwapChain > m_VulkanSwapChain
VulkanSwapChain.
virtual ~VulkanRenderBackend()
Destructor Function.
std::unique_ptr< VulkanCommandPool > m_VulkanCommandPool
VulkanCommandPool.
VulkanRenderBackend()
Constructor Function.
static std::shared_ptr< VulkanDescriptorPool > GetDescriptorPool()
Get DescriptorPool in use.
static VulkanState m_VulkanState
The VulkanState in use.
std::unique_ptr< VulkanCommandBuffer > m_VulkanCommandBuffer
VulkanCommandBuffer.
bool isWindowClosed()
Determine whether window is closed.
static std::shared_ptr< VulkanDescriptorPool > m_VulkanDescriptorPool
The VulkanDescriptorPool in use.
static std::shared_ptr< RendererResourcePool > m_RendererResourcePool
The RendererResourcePool in use.
static VulkanState & GetState()
Get VulkanState in use.
std::unique_ptr< VulkanWindows > m_VulkanWindows
VulkanWindows.
bool OnMeshAddedWorldEvent(WorldEvent &event)
This function is called on world mark query tick.
void RenderFrame(TimeStep &ts, FrameInfo &frameInfo)
Draw World.
void OnEvent(Event &event)
This function is called on global event function is called.
static std::shared_ptr< RendererResourcePool > GetRendererResourcePool()
Get RendererResourcePool in use.
void BeginFrame(FrameInfo &frameInfo)
Start record a new frame with vulkan render backend.
VulkanRenderBackend & operator=(const VulkanRenderBackend &)=delete
Copy Assignment Operation.
bool OnWindowResizeOver(WindowResizeOverEvent &event)
This function is called on window is resized over.
std::shared_ptr< VulkanDevice > m_VulkanDevice
VulkanDevice.
std::unique_ptr< VulkanInstance > m_VulkanInstance
VulkanInstance.
bool OnSlateResize(SlateResizeEvent &event)
This function is called on viewport is resized.
VulkanRenderBackend(const VulkanRenderBackend &)=delete
Copy Constructor Function.
This class defines the render backend behaves of Vulkan.
virtual ~VulkanRenderPass() override
Destructor Function.
VkRenderPass m_RenderPass
The RenderPass this class mainly manage.
VulkanRenderPass(VulkanState &vulkanState, const std::string &passName, std::shared_ptr< VulkanDevice > vulkanDevice, VkRenderPassCreateInfo &createInfo, std::vector< VkImageView > &imageViews, uint32_t layers, bool isUseSwapChianImage)
Constructor Function. Create VkRenderPass and VkFramebuffer.
VkFramebuffer & GetFramebuffer(uint32_t index)
Get Framebuffer by index.
std::array< VkFramebuffer, MaxFrameInFlight > m_SwapChainFramebuffers
The FrameBuffers.
std::shared_ptr< VulkanDevice > m_VulkanDevice
The shared pointer of VulkanDevice.
VkRenderPass & Get()
Get VkRenderPass.
VulkanRenderPass Class. This class defines the VulkanRenderPass behaves. This class is just a wrapper...
VulkanSwapChain(VulkanState &vulkanState, std::shared_ptr< VulkanDevice > vulkanDevice)
Constructor Function. Create vkInstance and vkSurface.
void DestroySyncObjects() const
Destroy Sync Objects.
static VkFormat FindDepthFormat(const VkPhysicalDevice &physicalDevice)
Check whether Depth Image's Format is supported by physical device.
void Destroy() const
Destroy this.
std::shared_ptr< VulkanDevice > m_VulkanDevice
The shared pointer of VulkanDevice.
void Create() const
Create this.
static VkFormat findSupportedFormat(const VkPhysicalDevice &physicalDevice, const std::vector< VkFormat > &candidates, VkImageTiling tiling, VkFormatFeatureFlags features)
Check whether specific formats is supported by physical device.
virtual ~VulkanSwapChain() override
Destructor Function.
void CreateSyncObjects() const
Create Sync Objects.
VulkanSwapChain Class. This class defines the VulkanSwapChain behaves. This class is just a wrapper o...
static void Destroy()
Destroy all ThreadQueue.
static scl::thread_queue< std::shared_ptr< VulkanThreadQueue > > m_ComputeQueues
Compute VulkanThreadQueue.
static void CreateGraphic(VulkanState &vulkanState, VkQueue queue)
Create Graphic VulkanThreadQueue.
VkQueue m_Queue
This Thread VkQueue.
void Submit(VkCommandBuffer commandBuffer) const
Submit the CommandBuffer in this Queue.
void Wait() const
Wait for queue execute.
static void PushToGraphic(std::shared_ptr< VulkanThreadQueue > &queue)
Push queue to Graphic ThreadQueue.
static std::shared_ptr< VulkanThreadQueue > FetchGraphicQueue()
Fetch valid Graphic Queue.
static std::shared_ptr< VulkanThreadQueue > FetchComputeQueue()
Fetch valid Compute Queue.
static void CreateCompute(VulkanState &vulkanState, VkQueue queue)
Create Compute VulkanThreadQueue.
virtual ~VulkanThreadQueue() override
Destructor Function.
static void PushToCompute(std::shared_ptr< VulkanThreadQueue > &queue)
Push queue to Compute ThreadQueue.
static scl::thread_queue< std::shared_ptr< VulkanThreadQueue > > m_GraphicQueues
Graphic VulkanThreadQueue.
VulkanThreadQueue(VulkanState &vulkanState, VkQueue queue)
Constructor Function.
VulkanThreadQueue Class. This class is a wrapper of Thread VkQueue.
VulkanWindows(VulkanState &vulkanState, const WindowInfo &initInfo)
Constructor Function. Create Windows.
bool m_WindowsResized
True if viewPort is resized.
virtual ~VulkanWindows() override
Destructor Function.
void SetInternalCallBack() const
Set all needed GLFW events call back.
void SetResized(bool isResized)
Set m_WindowsResized variable.
WindowInfo m_WindowInfo
Window's info. not viewport's info.
bool IsResized() const
Get m_WindowsResized variable.
VulkanWindows Class. This class defines the windows behaves.
virtual ~WorldEvent() override=default
Destructor Function.
WorldEvent()=default
Constructor Function.
This Class is inherited from Event Class. Inherit from it and create specific KeyEvent class....
Definition WorldEvent.h:20
World Class. This class defines the basic behaves of World. When we create an new world,...
Definition World.h:41
behave_state_node< Ret, Args... > * AddNode()
Add a empty node to this list.
virtual ~behave_state_list()=default
Destructor Function.
behave_state_list()
Constructor Function.
uint32_t m_CurrentState
current state.
void SetState(uint32_t state)
Set Current State.
std::vector< std::unique_ptr< behave_state_node< Ret, Args... > > > m_List
Linear Node list.
behave_state_node< Ret, Args... > * GetState() const
Get current state node.
void IncreateState()
Current State move forward.
void ResetState()
Current State move to start.
behave_state_list. wrapper of combing all state behaves.
std::unordered_map< std::string, std::function< Ret(Args...)> > m_Behavies
Function behaves map.
void ExecuteBehave(const std::string &name, Args... args)
Execute a behave in this state.
behave_state_node()=default
Constructor Function.
virtual ~behave_state_node()=default
Destructor Function.
void PushBehave(const std::string &name, const std::function< Ret(Args...)> &fn)
Push a behave to this state.
behave_state_list single node. defines behaves in single state.
The container combines hashmap and list together. Used in the case that we want iter a hashmap in ord...
void Push(T &&item)
Push a item to this queue.
Definition ThreadQueue.h:77
std::mutex m_Mutex
Mutex of this queue.
Definition ThreadQueue.h:58
thread_queue()
Constructor Function.
Definition ThreadQueue.h:23
T Pop()
Pop a item from this queue.
Definition ThreadQueue.h:88
void Clear()
Clear this queue.
std::atomic_int m_Count
Count of tasks.
Definition ThreadQueue.h:68
std::condition_variable m_NotEmpty
Not empty condition.
Definition ThreadQueue.h:63
bool IsEmpty() const
Is this queue is empty. @reutrn Returns true if empty.
Definition ThreadQueue.h:46
virtual ~thread_queue()=default
Destructor Function.
std::queue< T > m_Queue
This wrapped queue.
Definition ThreadQueue.h:73
Thread safe Queue.
Definition ThreadQueue.h:17
TextureType
The enum of all Texture Type.
Definition Texture.h:20
VMAMemoryPropertyFlagExtendBits
Map to VmaAllocationCreateFlagBits while use VMA for memory create.
@ VMA_MEMORY_PROPERTY_DEDICATED_MEMORY_BIT
VkMemoryPropertyFlagBits.
@ EventCategoryWorld
Definition Event.h:68
@ MeshAdded
World Event.
static constexpr int NThreadQueue
Thread Queue Count.
RendererType
Definition FrameInfo.h:22
std::optional< uint32_t > graphicqueuefamily
The graphic queue's in used identify.
std::optional< uint32_t > presentqueuefamily
The present queue's in used identify.
std::optional< uint32_t > transferqueuefamily
The transfer queue's in used identify.
std::optional< uint32_t > computequeuefamily
The compute queue's in used identify.
bool isComplete() const
Whether all queues that we need is valid.
This struct contains all queues's identify we need.
virtual ~RendererResourceCreateInfo()=default
Destructor Function.
uint32_t height
Texture' height..
uint32_t mipLevel
Texture's mipmap level.
RendererResourceCreateInfo()=default
Constructor Function.
uint32_t layer
Texture's layer(1 for Texture2D, 6 for TextureCube, any for TextureArray).
VkAttachmentDescription description
Texture's description info.
bool isDepthResource
True if this resource is a DepthResource.
TextureType type
Texture's Class Type.
RendererResourceCreateInfo(const std::string &name)
Constructor Function.
float sizeScale
Texture's size scale.
VkImageUsageFlagBits usage
Image Usage.
bool isResizeable
True if this resource needs resize(sync with viewport's size).
std::string name
Texture's name.
This struct defines the data used to create a texture2d. From render pass.
VkExtent2D surfaceSize
The VkSurface Size.
std::vector< VkSurfaceFormatKHR > formats
All supported VkSurfaceFormatKHR.
VkSurfaceFormatKHR format
The selected VkSurfaceFormatKHR.
VkSurfaceCapabilitiesKHR capabilities
VkSurfaceCapabilitiesKHR.
VkPresentModeKHR presentMode
The selected VkPresentModeKHR.
VkExtent2D viewPortSize
The ViewPort Size. Init value. Reset by resize event.
std::vector< VkPresentModeKHR > presentModes
All supported VkPresentModeKHR.
SwapChain Utils. Queried from device.
This struct contains all Vulkan object in used global.
Definition VulkanUtils.h:74
GLFWimage image
GLFWimage.
WindowIcon(const std::string &iconPath)
Constructor Function. Load the icon file immediately.
virtual ~WindowIcon()
Destructor Function.
This struct helps load the icon of window.
std::shared_ptr< WindowIcon > icon
Window's icon.
std::string name
Window's name.
int width
Window's width.
int height
Window's height.
This struct defines the basic information of window.