mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add post-effect-slot resource & add gfx.posteffects library
This commit is contained in:
parent
c3bc084e76
commit
64039f0e43
11 changed files with 182 additions and 12 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue