add post-effect-slot resource & add gfx.posteffects library

This commit is contained in:
MihailRis
2025-04-06 12:47:25 +03:00
parent c3bc084e76
commit 64039f0e43
11 changed files with 182 additions and 12 deletions
+10 -1
View File
@@ -9,7 +9,8 @@
#include <stdexcept>
PostProcessing::PostProcessing() {
PostProcessing::PostProcessing(size_t effectSlotsCount)
: effectSlots(effectSlotsCount) {
// Fullscreen quad mesh bulding
float vertices[] {
-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f,
@@ -77,6 +78,14 @@ void PostProcessing::render(
}
}
void PostProcessing::setEffect(size_t slot, std::shared_ptr<PostEffect> effect) {
effectSlots.at(slot) = std::move(effect);
}
PostEffect* PostProcessing::getEffect(size_t slot) {
return effectSlots.at(slot).get();
}
std::unique_ptr<ImageData> PostProcessing::toImage() {
return fbo->getTexture()->readData();
}