Lugdunum  0.1.0
Material.cpp
Go to the documentation of this file.
2 
7 
8 namespace lug {
9 namespace Graphics {
10 namespace Vulkan {
11 namespace Builder {
12 namespace Material {
13 
14 Resource::SharedPtr<::lug::Graphics::Render::Material> build(const ::lug::Graphics::Builder::Material& builder) {
15  // Constructor of Material is private, we can't use std::make_unique
16  std::unique_ptr<Resource> resource{new Vulkan::Render::Material(builder._name)};
17  Vulkan::Render::Material* material = static_cast<Vulkan::Render::Material*>(resource.get());
18 
19  material->_name = builder._name;
20  material->_constants = builder._constants;
21  material->_baseColorTexture = builder._baseColorTexture;
22  material->_metallicRoughnessTexture = builder._metallicRoughnessTexture;
23  material->_normalTexture = builder._normalTexture;
24  material->_occlusionTexture = builder._occlusionTexture;
25  material->_emissiveTexture = builder._emissiveTexture;
26 
29  material->_pipelineIdMaterialPart.normalInfo = material->_normalTexture.texture ? material->_normalTexture.texCoord : 0b11;
32 
33  return builder._renderer.getResourceManager()->add<::lug::Graphics::Render::Material>(std::move(resource));
34 }
35 
36 } // Material
37 } // Builder
38 } // Vulkan
39 } // Graphics
40 } // lug
uint32_t occlusionInfo
0b00 texture with UV0, 0b01 texture with UV1, 0b10 texture with UV2, 0b11 no texture.
Definition: Pipeline.hpp:67
uint32_t baseColorInfo
0b00 texture with UV0, 0b01 texture with UV1, 0b10 texture with UV2, 0b11 no texture.
Definition: Pipeline.hpp:64
Pipeline::Id::MaterialPart _pipelineIdMaterialPart
Definition: Material.hpp:44
Resource::SharedPtr< Texture > texture
Definition: Material.hpp:30
Dummy class for a shared pointer.
Definition: Resource.hpp:66
Resource::SharedPtr< lug::Graphics::Render::Material > build(const ::lug::Graphics::Builder::Material &builder)
Definition: Material.cpp:14
uint32_t emissiveInfo
0b00 texture with UV0, 0b01 texture with UV1, 0b10 texture with UV2, 0b11 no texture.
Definition: Pipeline.hpp:68
Class for Material. Is a Resource.
Definition: Material.hpp:25
uint32_t metallicRoughnessInfo
0b00 texture with UV0, 0b01 texture with UV1, 0b10 texture with UV2, 0b11 no texture.
Definition: Pipeline.hpp:65
TextureInfo _metallicRoughnessTexture
Definition: Material.hpp:77
uint32_t normalInfo
0b00 texture with UV0, 0b01 texture with UV1, 0b10 texture with UV2, 0b11 no texture.
Definition: Pipeline.hpp:66