changed simplerenderer so that using the post processing is happening in main and not in any random methods
This commit is contained in:
parent
ce1fe4dd9a
commit
128581d469
2 changed files with 10 additions and 12 deletions
13
ex4.cpp
13
ex4.cpp
|
@ -11,7 +11,6 @@
|
|||
#include "primitive/sphere.h"
|
||||
|
||||
#include "shader/brdfshader.h"
|
||||
|
||||
#include "shader/lambertshader.h"
|
||||
#include "shader/mirrorshader.h"
|
||||
#include "shader/phongshader.h"
|
||||
|
@ -22,6 +21,8 @@
|
|||
#include "light/pointlight.h"
|
||||
#include "light/spotlight.h"
|
||||
|
||||
#include "post_processing/bloom.h"
|
||||
|
||||
int main() {
|
||||
// Let's create a simple scene...
|
||||
SimpleScene scene;
|
||||
|
@ -84,11 +85,17 @@ int main() {
|
|||
// focalLength = the area which is in focus
|
||||
DOFRenderer renderer(0.2, 100, 10.0f);
|
||||
|
||||
// Use DOFRenderer to raytrace
|
||||
// Use DOFRenderer to raytrace !!! careful more pixels lead to insane rendering times
|
||||
Texture image = renderer.renderImage(scene, camera, 1024, 1024);
|
||||
|
||||
// save image
|
||||
// Use post-processing Bloom effect
|
||||
Bloom bloomEffect = Bloom(image.getImage());
|
||||
Texture imageWithBloom = image;
|
||||
imageWithBloom.setTexture(bloomEffect.bloom(0.55f, 5, 10.0f, 0.06f));
|
||||
|
||||
// save images
|
||||
image.save("result.png");
|
||||
image.save("resultWithBloom");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include "post_processing/bloom.h"
|
||||
|
||||
void SimpleRenderer::renderThread(const Scene *scene, Camera const *camera, Texture *image, int width, int widthStep, int widthOffset, int height, int heightStep, int heightOffset, std::atomic<int> *k, int const stepSize) {
|
||||
float const aspectRatio = static_cast<float>(height) / width;
|
||||
|
@ -74,13 +73,5 @@ Texture SimpleRenderer::renderImage(Scene const &scene, Camera const &camera, in
|
|||
std::cout << "Paths: " << rays << std::endl;
|
||||
std::cout << "Paths per second: " << std::fixed << std::setprecision(0) << rays / seconds << std::endl;
|
||||
|
||||
// Post-processing
|
||||
// Bloom shader
|
||||
|
||||
image.save("original.png");
|
||||
|
||||
Bloom bloomEffect = Bloom(image.getImage());
|
||||
image.setTexture(bloomEffect.bloom(0.55f, 5, 10.0f, 0.06f));
|
||||
|
||||
return image;
|
||||
}
|
Loading…
Reference in a new issue