Files
cuber/cbt/opengl/descriptor.cpp
T
portersky 40ae94788e style: fix include ordering across all source files
- C++ std headers first, then third-party, then local
- Apply consistently in cbt/ and scenes/
2026-05-05 22:40:51 +02:00

33 lines
726 B
C++

#include "glad/glad.h"
#include "cbt/opengl/descriptor.hpp"
namespace cbt::opengl {
descriptor_set::descriptor_set() {}
auto descriptor_set::add_texture(texture tex, GLuint unit) -> void {
m_bindings.push_back({unit, std::move(tex), std::nullopt});
}
auto descriptor_set::add_buffer(buffer buf, GLuint unit) -> void {
m_bindings.push_back({unit, std::nullopt, std::move(buf)});
}
auto descriptor_set::bind_all() -> void {
for (auto& binding : m_bindings) {
if (binding.tex) {
binding.tex->bind(binding.texture_unit);
}
if (binding.buf) {
binding.buf->bind();
}
}
}
auto descriptor_set::count() const -> size_t {
return m_bindings.size();
}
}