engine/include/resources/material.h

40 lines
1.1 KiB
C
Raw Normal View History

2023-05-01 12:55:49 +00:00
#ifndef ENGINE_INCLUDE_RESOURCES_MATERIAL_H_
#define ENGINE_INCLUDE_RESOURCES_MATERIAL_H_
2022-12-20 23:51:04 +00:00
#include <memory>
2023-05-01 13:13:35 +00:00
#include "resources/shader.h"
#include "resources/texture.h"
2022-12-20 23:51:04 +00:00
2023-11-05 01:04:05 +00:00
// a material is just a shader with assigned textures/parameters
2023-05-01 12:55:49 +00:00
namespace engine {
2022-12-20 23:51:04 +00:00
2023-05-01 12:55:49 +00:00
// copyable
class Material {
2023-11-05 01:04:05 +00:00
public:
Material(Renderer* renderer, std::shared_ptr<engine::Shader> shader);
~Material();
Material& operator=(const Material&) = delete;
void SetAlbedoTexture(std::shared_ptr<Texture> texture);
void SetNormalTexture(std::shared_ptr<Texture> texture);
2024-03-19 11:32:51 +00:00
void SetOcclusionRoughnessMetallicTexture(std::shared_ptr<Texture> texture);
2023-11-05 01:04:05 +00:00
const gfx::DescriptorSet* GetDescriptorSet() { return material_set_; }
Shader* GetShader() { return shader_.get(); }
2022-12-20 23:51:04 +00:00
2023-11-05 01:04:05 +00:00
private:
const std::shared_ptr<Shader> shader_;
std::shared_ptr<Texture> texture_albedo_;
std::shared_ptr<Texture> texture_normal_;
2024-03-19 11:32:51 +00:00
std::shared_ptr<Texture> texture_occlusion_roughness_metallic_;
2022-12-20 23:51:04 +00:00
2023-11-05 01:04:05 +00:00
const gfx::DescriptorSet* material_set_ = nullptr;
2022-12-22 11:27:16 +00:00
2023-11-05 01:04:05 +00:00
Renderer* const renderer_;
2023-05-01 12:55:49 +00:00
};
2022-12-20 23:51:04 +00:00
2023-11-05 01:04:05 +00:00
} // namespace engine
2022-12-20 23:51:04 +00:00
2023-05-01 12:55:49 +00:00
#endif