| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

Cubemap.h
Go to the documentation of this file.
1 #pragma once
2
3 #include "Model.h"
4 #include "Texture.h"
5 #include "FlingVulkan.h"
6 #include "Buffer.h"
7 #include "FlingTypes.h"
8 #include "FlingMath.h"
9 #include "File.h"
10 #include "LogicalDevice.h"
11 #include "UniformBufferObject.h"
12 #include "Camera.h"
13 #include "GraphicsPipeline.h"
14 #include "MultiSampler.h"
15
16 namespace Fling
17 {
18 class LogicalDevice;
19
20 class Cubemap
21 {
22 public:
23 Cubemap(
24 Guid t_PosX_ID,
25 Guid t_NegX_ID,
26 Guid t_PosY_ID,
27 Guid t_NegY_ID,
28 Guid t_PosZ_ID,
29 Guid t_NegZ_ID,
30 Guid t_VertexShader,
31 Guid t_FragShader,
32 VkRenderPass t_RenderPass,
33 LogicalDevice* t_LogicalDevice);
34
35 Cubemap(
36 Guid t_CubeMap_ID,
37 VkRenderPass t_Renderpass,
38 VkDevice t_LogicalDevice);
39
40 ~Cubemap();
41
42 void Init(Camera* t_Camera, UINT32 t_CurrentImage, size_t t_NumeFramesInFlight, Multisampler* t_Sampler);
43
44 void UpdateUniformBuffer(UINT32 t_CurrentImage, const glm::mat4& t_ProjectionMatrix, const glm::mat4& t_ViewMatrix);
45
46 void BindCmdBuffer(VkCommandBuffer& t_CommandBuffer);
47
48 std::unique_ptr<GraphicsPipeline> GetGraphicsPipeline() const { return std::unique_ptr<GraphicsPipeline>(m_GraphicsPipeline); }
49
55 VkDescriptorSet& GetDescriptorSet() { return m_DescriptorSet; }
56
62 Buffer* GetVertexBuffer() const { return m_Cube->GetVertexBuffer(); }
63
69 Buffer* GetIndexBuffer() const { return m_Cube->GetIndexBuffer(); }
70
76 UINT32 GetIndexCount() const { return m_Cube->GetIndexCount(); }
77
78 VkIndexType GetIndexType() const { return m_Cube->GetIndexType(); }
79
80 VkImage GetImage() const { return m_Image; }
81 VkDeviceMemory GetImageMemory() const{ return m_ImageMemory; }
82 VkDescriptorImageInfo& GetImageInfo() { return m_DescriptorImageInfo; }
83
84 private:
85
86 void PreparePipeline(Multisampler* t_Sampler);
87
89 void LoadCubeMapImage(Guid t_CubeMap_ID);
90
91 void LoadCubemapImages(
92 Guid t_PosX_ID,
93 Guid t_NegX_ID,
94 Guid t_PosY_ID,
95 Guid t_NegY_ID,
96 Guid t_PosZ_ID,
97 Guid t_NegZ_ID);
98
99 void SetupDescriptors();
100
101 std::vector<Texture> m_cubeMapImages;
102 std::vector<std::shared_ptr<class Buffer>> m_UniformBuffers;
103
104 VkImage m_Image;
105 VkImageView m_Imageview;
106 VkImageLayout m_ImageLayout;
107 VkDeviceMemory m_ImageMemory;
108 VkSampler m_Sampler;
109
110 VkDescriptorSetLayout m_DescriptorSetLayout;
111 VkDescriptorImageInfo m_DescriptorImageInfo;
112 VkDescriptorSet m_DescriptorSet;
113 VkDescriptorPool m_DescriptorPool;
114 VkRenderPass m_RenderPass;
115 LogicalDevice* m_Device;
116 VkDescriptorBufferInfo m_UniformBufferDescriptor;
117
118 VkDeviceSize m_ImageSize;
119 VkDeviceSize m_LayerSize;
120 VkFormat m_Format;
121 UINT32 m_NumChannels;
122 UINT32 m_MipLevels;
123 size_t m_numsFrameInFlight;
124
125 UboSkyboxVS m_UboVS;
126 std::shared_ptr<Model> m_Cube;
127 GraphicsPipeline* m_GraphicsPipeline;
128
129 Guid m_FragShader;
130 Guid m_VertexShader;
131 };
132 }
Fling::Cubemap::m_numsFrameInFlight
size_t m_numsFrameInFlight
Definition: Cubemap.h:123
Fling::Cubemap::GetIndexType
VkIndexType GetIndexType() const
Definition: Cubemap.h:78
FlingVulkan.h
Fling::Cubemap::GetGraphicsPipeline
std::unique_ptr< GraphicsPipeline > GetGraphicsPipeline() const
Definition: Cubemap.h:48
Fling::Cubemap::Init
void Init(Camera *t_Camera, UINT32 t_CurrentImage, size_t t_NumeFramesInFlight, Multisampler *t_Sampler)
Definition: Cubemap.cpp:66
Texture.h
Camera.h
Fling::Cubemap::m_GraphicsPipeline
GraphicsPipeline * m_GraphicsPipeline
Definition: Cubemap.h:127
Fling::Camera
Base class for camera, meant to be overridden.
Definition: Camera.h:10
Fling::Cubemap::m_DescriptorImageInfo
VkDescriptorImageInfo m_DescriptorImageInfo
Definition: Cubemap.h:111
Fling::Cubemap::m_NumChannels
UINT32 m_NumChannels
Definition: Cubemap.h:121
Fling::UboSkyboxVS
Definition: UniformBufferObject.h:20
Fling::Cubemap::m_ImageMemory
VkDeviceMemory m_ImageMemory
Definition: Cubemap.h:107
Fling::Cubemap::BindCmdBuffer
void BindCmdBuffer(VkCommandBuffer &t_CommandBuffer)
Definition: Cubemap.cpp:507
Fling::GraphicsPipeline
Definition: GraphicsPipeline.h:9
Fling::Cubemap::UpdateUniformBuffer
void UpdateUniformBuffer(UINT32 t_CurrentImage, const glm::mat4 &t_ProjectionMatrix, const glm::mat4 &t_ViewMatrix)
Definition: Cubemap.cpp:494
Model.h
UniformBufferObject.h
Fling::LogicalDevice
A logical device represents the application view of the device.
Definition: LogicalDevice.h:13
FlingMath.h
Fling::Cubemap::LoadCubeMapImage
void LoadCubeMapImage(Guid t_CubeMap_ID)
Loads cubemaps with file format .hdr for ibl.
Definition: Cubemap.cpp:106
Fling::Cubemap::SetupDescriptors
void SetupDescriptors()
Definition: Cubemap.cpp:407
MultiSampler.h
Fling::Multisampler
A multi-sampler will allow us to enable MSAA.
Definition: MultiSampler.h:14
Fling::Cubemap::m_Device
LogicalDevice * m_Device
Definition: Cubemap.h:115
File.h
Fling::Cubemap::GetIndexCount
UINT32 GetIndexCount() const
Get the Index Count object.
Definition: Cubemap.h:76
Fling::Cubemap::m_DescriptorSet
VkDescriptorSet m_DescriptorSet
Definition: Cubemap.h:112
GraphicsPipeline.h
Fling::Cubemap::m_UniformBuffers
std::vector< std::shared_ptr< class Buffer > > m_UniformBuffers
Definition: Cubemap.h:102
Fling::Cubemap::m_MipLevels
UINT32 m_MipLevels
Definition: Cubemap.h:122
Fling::Cubemap::m_UniformBufferDescriptor
VkDescriptorBufferInfo m_UniformBufferDescriptor
Definition: Cubemap.h:116
Fling::Cubemap::m_Image
VkImage m_Image
Definition: Cubemap.h:104
Fling::Cubemap::m_FragShader
Guid m_FragShader
Definition: Cubemap.h:129
Fling::Cubemap::GetImageInfo
VkDescriptorImageInfo & GetImageInfo()
Definition: Cubemap.h:82
Fling::Cubemap::m_Imageview
VkImageView m_Imageview
Definition: Cubemap.h:105
Fling::Cubemap::GetVertexBuffer
Buffer * GetVertexBuffer() const
Get the Vertex Buffer object.
Definition: Cubemap.h:62
Fling::Guid
entt::hashed_string Guid
Definition: FlingTypes.h:26
Fling::Cubemap::~Cubemap
~Cubemap()
Definition: Cubemap.cpp:45
Fling::Cubemap::m_Sampler
VkSampler m_Sampler
Definition: Cubemap.h:108
Fling::Cubemap::m_DescriptorSetLayout
VkDescriptorSetLayout m_DescriptorSetLayout
Definition: Cubemap.h:110
Fling::Cubemap::m_UboVS
UboSkyboxVS m_UboVS
Definition: Cubemap.h:125
Fling::Cubemap::m_DescriptorPool
VkDescriptorPool m_DescriptorPool
Definition: Cubemap.h:113
Fling::Cubemap::m_cubeMapImages
std::vector< Texture > m_cubeMapImages
Definition: Cubemap.h:101
LogicalDevice.h
Fling::Cubemap::GetImage
VkImage GetImage() const
Definition: Cubemap.h:80
Fling::Cubemap::GetIndexBuffer
Buffer * GetIndexBuffer() const
Get the Index Buffer object.
Definition: Cubemap.h:69
Fling::Cubemap::GetImageMemory
VkDeviceMemory GetImageMemory() const
Definition: Cubemap.h:81
Fling::Cubemap::PreparePipeline
void PreparePipeline(Multisampler *t_Sampler)
Definition: Cubemap.cpp:86
Fling::Buffer
A Buffer represents a Vulkan buffer with a size, buffer pointer, and buffer memory.
Definition: Buffer.h:11
UINT32
uint32_t UINT32
Definition: FlingTypes.h:13
Fling::Cubemap::m_LayerSize
VkDeviceSize m_LayerSize
Definition: Cubemap.h:119
Fling::Cubemap::m_RenderPass
VkRenderPass m_RenderPass
Definition: Cubemap.h:114
Buffer.h
Fling
Definition: Engine.h:29
Fling::Cubemap::Cubemap
Cubemap(Guid t_PosX_ID, Guid t_NegX_ID, Guid t_PosY_ID, Guid t_NegY_ID, Guid t_PosZ_ID, Guid t_NegZ_ID, Guid t_VertexShader, Guid t_FragShader, VkRenderPass t_RenderPass, LogicalDevice *t_LogicalDevice)
Definition: Cubemap.cpp:11
Fling::Cubemap
Definition: Cubemap.h:20
Fling::Cubemap::GetDescriptorSet
VkDescriptorSet & GetDescriptorSet()
Get the Descriptor Sets object.
Definition: Cubemap.h:55
Fling::Cubemap::m_VertexShader
Guid m_VertexShader
Definition: Cubemap.h:130
FlingTypes.h
Fling::Cubemap::LoadCubemapImages
void LoadCubemapImages(Guid t_PosX_ID, Guid t_NegX_ID, Guid t_PosY_ID, Guid t_NegY_ID, Guid t_PosZ_ID, Guid t_NegZ_ID)
Definition: Cubemap.cpp:248
Fling::Cubemap::m_Cube
std::shared_ptr< Model > m_Cube
Definition: Cubemap.h:126
Fling::Cubemap::m_ImageSize
VkDeviceSize m_ImageSize
Definition: Cubemap.h:118
Fling::Cubemap::m_Format
VkFormat m_Format
Definition: Cubemap.h:120
Fling::Cubemap::m_ImageLayout
VkImageLayout m_ImageLayout
Definition: Cubemap.h:106