Skip to content
Snippets Groups Projects
Commit bb2f8d13 authored by Artur Wasmut's avatar Artur Wasmut
Browse files

WIP: pbrMaterial skeleton class.

parent 4d60a22a
No related branches found
No related tags found
1 merge request!44Resolve "Material (Modul)"
Pipeline #25507 failed
...@@ -22,7 +22,8 @@ namespace vkcv { ...@@ -22,7 +22,8 @@ namespace vkcv {
TESS_EVAL, TESS_EVAL,
GEOMETRY, GEOMETRY,
FRAGMENT, FRAGMENT,
COMPUTE COMPUTE,
ALL
}; };
struct Shader struct Shader
......
...@@ -12,6 +12,8 @@ set(vkcv_material_include ${PROJECT_SOURCE_DIR}/include) ...@@ -12,6 +12,8 @@ set(vkcv_material_include ${PROJECT_SOURCE_DIR}/include)
set(vkcv_material_sources set(vkcv_material_sources
${vkcv_material_include}/vkcv/material/Material.hpp ${vkcv_material_include}/vkcv/material/Material.hpp
${vkcv_material_source}/vkcv/material/Material.cpp ${vkcv_material_source}/vkcv/material/Material.cpp
${vkcv_material_include}/vkcv/material/pbrMetallicRoughness.hpp
${vkcv_material_source}/vkcv/material/pbrMetallicRoughness.cpp
) )
# adding source files to the module # adding source files to the module
......
#pragma once
#include <vector>
#include "Material.hpp"
#include "vkcv/Handles.hpp"
#include "vkcv/DescriptorConfig.hpp"
namespace vkcv
{
class pbrMaterial : Material
{
public:
pbrMaterial() = delete;
pbrMaterial(const ImageHandle &colorImg,
const SamplerHandle &colorSmp,
const ImageHandle &normalImg,
const SamplerHandle &normalSmp,
const ImageHandle &metRoughImg,
const SamplerHandle &metRoughSmp,
const DescriptorSetHandle &setHandle) noexcept;
const ImageHandle m_ColorTexture;
const SamplerHandle m_ColorSampler;
const ImageHandle m_NormalTexture;
const SamplerHandle m_NormalSampler;
const ImageHandle m_MetRoughTexture;
const SamplerHandle m_MetRoughSampler;
// ImageHandle m_OcclusionTexture;
// SamplerHandle m_EmissiveTexture;
const DescriptorSetHandle m_DescriptorSetHandle;
/*
* Returns the material's necessary descriptor bindings which serves as its descriptor layout
* The binding is in the following order:
* 0 - diffuse texture
* 1 - diffuse sampler
* 2 - normal texture
* 3 - normal sampler
* 4 - metallic roughness texture
* 5 - metallic roughness sampler
*/
static std::vector<DescriptorBinding> getDescriptorBindings() noexcept;
};
}
\ No newline at end of file
#include "vkcv/material/pbrMetallicRoughness.hpp"
namespace vkcv
{
pbrMaterial::pbrMaterial(const ImageHandle &colorImg,
const SamplerHandle &colorSmp,
const ImageHandle &normalImg,
const SamplerHandle &normalSmp,
const ImageHandle &metRoughImg,
const SamplerHandle &metRoughSmp,
const DescriptorSetHandle &setHandle) noexcept :
m_ColorTexture(colorImg),
m_ColorSampler(colorSmp),
m_NormalTexture(normalImg),
m_NormalSampler(normalSmp),
m_MetRoughTexture(metRoughImg),
m_MetRoughSampler(metRoughSmp),
m_DescriptorSetHandle(setHandle)
{}
std::vector<DescriptorBinding> pbrMaterial::getDescriptorBindings() noexcept
{
return {{DescriptorType::IMAGE_SAMPLED, 1, ShaderStage::FRAGMENT},
{DescriptorType::SAMPLER , 1, ShaderStage::FRAGMENT},
{DescriptorType::IMAGE_SAMPLED, 1, ShaderStage::FRAGMENT},
{DescriptorType::SAMPLER , 1, ShaderStage::FRAGMENT},
{DescriptorType::IMAGE_SAMPLED, 1, ShaderStage::FRAGMENT},
{DescriptorType::SAMPLER , 1, ShaderStage::FRAGMENT}};
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment