Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
VulkanMaterial.hpp
Go to the documentation of this file.
1 #pragma once
3 #ifdef USING_VULKAN
4 
6 
7 #include <ThirdParty/Vulkan/Include/vulkan/vulkan.h>
8 
13 
14 #include <ThirdParty/EASTL-master/include/EASTL/vector.h>
15 
16 namespace Engine {
17 
18  class VulkanRenderer;
19 
20  class VulkanMaterial : public Material
21  {
22  public:
23 
29  static VkDescriptorSetLayout CreateMaterialDescriptorSetLayout(VulkanLogicalDevice* device);
30 
31  VulkanMaterial(const aiScene* scene, uint32_t materialIndex, eastl::string modelName);
32  ~VulkanMaterial();
33 
41  VkDescriptorSet CreateMaterialDescriptorSet(size_t threadID, size_t pipelineID, size_t set, VkDescriptorSetLayout layout);
42 
50  VkDescriptorSet GetMaterialDescriptorSet(size_t threadID, size_t pipelineID, size_t set);
51 
56  virtual void SetDiffuseTexture(eastl::shared_ptr<Texture> diffuseTexture);
57 
62  virtual void SetBumpMapTexture(eastl::shared_ptr<Texture> bumpMapTexture);
63 
68  virtual void SetSpecularTexture(eastl::shared_ptr<Texture> specularTexture);
69 
70  protected:
71  eastl::unique_ptr<VulkanBuffer> materialDataBuffer_;
72 
73  eastl::vector<eastl::vector<eastl::vector<VkDescriptorSet>>> materialDescriptorSets_;
74 
75  virtual void UpdateMaterialData();
76 
77  friend VulkanRenderer;
78 
79  static VulkanRenderer* renderer_;
80  static VulkanLogicalDevice* device_;
81  static VkCommandPool commandPool_;
82  static VmaAllocator allocator_;
83  static VulkanDescriptorPool* descriptorPool_;
84 
85  static void InitMaterialData(VulkanRenderer* renderer, VulkanLogicalDevice* device, VulkanDescriptorPool* descriptorPool, VmaAllocator allocator);
86  };
87 
88 } // namespace Engine
89 #endif // USING_VULKAN