HatchitGraphics
ht_vkmaterial.h
1 
26 #pragma once
27 
28 #include <ht_material.h>
29 #include <ht_material_base.h>
30 #include <ht_vkrenderpass.h>
31 #include <ht_vkpipeline.h>
32 #include <ht_vktexture.h>
33 #include <ht_material_resource.h>
34 #include <ht_refcounted.h>
35 
36 namespace Hatchit {
37 
38  namespace Graphics {
39 
40  namespace Vulkan {
41 
42  class HT_API VKMaterial : public MaterialBase
43  {
44  public:
45  VKMaterial();
46  ~VKMaterial();
47 
48  //Required function for RefCounted class
49  bool Initialize(Resource::MaterialHandle handle, const VkDevice& device, const VkDescriptorPool& descriptorPool);
50 
51  bool VBindTexture(std::string name, TextureHandle texture) override;
52  bool VUnbindTexture(std::string name, TextureHandle texture) override;
53 
54  bool VUpdate() override;
55 
56  const void BindMaterial(const VkCommandBuffer& commandBuffer, const VkPipelineLayout& pipelineLayout) const;
57 
58  PipelineHandle const VGetPipeline() const override;
59  const VKPipeline* GetVKPipeline() const;
60 
61  private:
62  const VkDevice* m_device;
63  const VkDescriptorPool* m_descriptorPool;
64 
65  bool setupDescriptorSet();
66 
67  PipelineHandle m_pipelineHandle;
68  VKPipeline* m_pipeline;
69 
70  std::vector<VkDescriptorSetLayout> m_descriptorSetLayouts;
71  std::vector<VkDescriptorSetLayout> m_materialLayouts;
72  std::vector<VkDescriptorSet> m_materialSets;
73 
74  std::map<std::string, Graphics::TextureHandle> m_textureHandles;
75 
76  UniformBlock_vk m_uniformVSBuffer;
77  //UniformBlock m_uniformFSBuffer;
78  std::vector<UniformBlock_vk> m_fragmentTextures;
79 
80  std::vector<LayoutLocation> m_textureLocations;
81  std::vector<VKTexture*> m_textures;
82  };
83  }
84  }
85 }
Definition: ht_vkpipeline.h:42
Definition: ht_material_base.h:51
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_color.h:19
Definition: ht_vkmaterial.h:42