From ded5d4414b16529341a4cf22dd32a55f467349c4 Mon Sep 17 00:00:00 2001
From: Lukas Werner <lks.werner@fau.de>
Date: Wed, 21 Mar 2018 10:00:02 +0100
Subject: [PATCH] Changed type of antiAliasFactor

---
 src/pe/raytracing/Raytracer.cpp | 4 ++--
 src/pe/raytracing/Raytracer.h   | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp
index 257f36964..cf660191d 100644
--- a/src/pe/raytracing/Raytracer.cpp
+++ b/src/pe/raytracing/Raytracer.cpp
@@ -69,7 +69,7 @@ Raytracer::Raytracer(const shared_ptr<BlockStorage> forest, const BlockDataID st
                      const shared_ptr<BodyStorage> globalBodyStorage,
                      const BlockDataID ccdID,
                      uint16_t pixelsHorizontal, uint16_t pixelsVertical,
-                     real_t fov_vertical, uint8_t antiAliasFactor,
+                     real_t fov_vertical, uint16_t antiAliasFactor,
                      const Vec3& cameraPosition, const Vec3& lookAtPoint, const Vec3& upVector,
                      const Lighting& lighting,
                      const Color& backgroundColor,
@@ -126,7 +126,7 @@ Raytracer::Raytracer(const shared_ptr<BlockStorage> forest, const BlockDataID st
    pixelsHorizontal_ = config.getParameter<uint16_t>("image_x");
    pixelsVertical_ = config.getParameter<uint16_t>("image_y");
    fov_vertical_ = config.getParameter<real_t>("fov_vertical");
-   antiAliasFactor_ = config.getParameter<uint8_t>("antiAliasFactor", 1);
+   antiAliasFactor_ = config.getParameter<uint16_t>("antiAliasFactor", 1);
    
    if (config.isDefined("tbuffer_output_directory")) {
       setTBufferOutputEnabled(true);
diff --git a/src/pe/raytracing/Raytracer.h b/src/pe/raytracing/Raytracer.h
index fef3b026e..8958fd91b 100644
--- a/src/pe/raytracing/Raytracer.h
+++ b/src/pe/raytracing/Raytracer.h
@@ -82,7 +82,7 @@ public:
                       const shared_ptr<BodyStorage> globalBodyStorage,
                       const BlockDataID ccdID,
                       uint16_t pixelsHorizontal, uint16_t pixelsVertical,
-                      real_t fov_vertical, uint8_t antiAliasFactor,
+                      real_t fov_vertical, uint16_t antiAliasFactor,
                       const Vec3& cameraPosition, const Vec3& lookAtPoint, const Vec3& upVector,
                       const Lighting& lighting,
                       const Color& backgroundColor = Color(real_t(0.1), real_t(0.1), real_t(0.1)),
@@ -106,7 +106,7 @@ private:
    uint16_t pixelsHorizontal_;  //!< The horizontal amount of pixels of the generated image.
    uint16_t pixelsVertical_;    //!< The vertical amount of pixels of the generated image.
    real_t fov_vertical_;      //!< The vertical field-of-view of the camera.
-   uint8_t antiAliasFactor_;  /*!< Factor used for oversampling. Should be between 1 (fast, but jagged edges)
+   uint16_t antiAliasFactor_; /*!< Factor used for oversampling. Should be between 1 (fast, but jagged edges)
                                * and 4 (16 times slower, very smooth edges).*/
    Vec3 cameraPosition_;      //!< The position of the camera in the global world frame.
    Vec3 lookAtPoint_;         /*!< The point the camera looks at in the global world frame,
@@ -557,7 +557,8 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) {
    
    std::vector<BodyIntersectionInfo> intersections;
    // contains for each pixel information about an intersection:
-   std::vector<BodyIntersectionInfo> intersectionsBuffer(pixelsVertical_*antiAliasFactor_ * pixelsHorizontal_*antiAliasFactor_);
+   size_t bufferSize = (pixelsVertical_*antiAliasFactor_)*(pixelsHorizontal_*antiAliasFactor_);
+   std::vector<BodyIntersectionInfo> intersectionsBuffer(bufferSize);
 
    if (raytracingAlgorithm_ == RAYTRACE_HASHGRIDS || raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH
       || raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH_STRICTLY) {
-- 
GitLab