From 9d7bf1e1170dbfb793fa46642ba72cfacaca3c75 Mon Sep 17 00:00:00 2001 From: Lukas Werner <lukaswerner@lukass-imac.local> Date: Thu, 25 Jan 2018 14:49:40 +0100 Subject: [PATCH] Changed some naming of some Raytracer member variables --- src/pe/raytracing/Raytracer.cpp | 20 ++++++++++---------- src/pe/raytracing/Raytracer.h | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp index 98102186f..3e309ac1d 100644 --- a/src/pe/raytracing/Raytracer.cpp +++ b/src/pe/raytracing/Raytracer.cpp @@ -98,19 +98,19 @@ Raytracer::Raytracer(const shared_ptr<BlockStorage> forest, BlockDataID storageI */ void Raytracer::setupView_() { // eye coordinate system setup - n = (cameraPosition_ - lookAtPoint_).getNormalized(); - u = (upVector_ % n).getNormalized(); - v = n % u; + n_ = (cameraPosition_ - lookAtPoint_).getNormalized(); + u_ = (upVector_ % n_).getNormalized(); + v_ = n_ % u_; // viewing plane setup - d = (cameraPosition_ - lookAtPoint_).length(); - aspectRatio = real_t(pixelsHorizontal_) / real_t(pixelsVertical_); - viewingPlaneHeight = tan(deg2rad(fov_vertical_)/real_t(2.)) * real_t(2.) * d; - viewingPlaneWidth = viewingPlaneHeight * aspectRatio; - viewingPlaneOrigin = lookAtPoint_ - u*viewingPlaneWidth/real_t(2.) - v*viewingPlaneHeight/real_t(2.); + d_ = (cameraPosition_ - lookAtPoint_).length(); + aspectRatio_ = real_t(pixelsHorizontal_) / real_t(pixelsVertical_); + viewingPlaneHeight_ = tan(deg2rad(fov_vertical_)/real_t(2.)) * real_t(2.) * d_; + viewingPlaneWidth_ = viewingPlaneHeight_ * aspectRatio_; + viewingPlaneOrigin_ = lookAtPoint_ - u_*viewingPlaneWidth_/real_t(2.) - v_*viewingPlaneHeight_/real_t(2.); - pixelWidth = viewingPlaneWidth / real_c(pixelsHorizontal_); - pixelHeight = viewingPlaneHeight / real_c(pixelsVertical_); + pixelWidth_ = viewingPlaneWidth_ / real_c(pixelsHorizontal_); + pixelHeight_ = viewingPlaneHeight_ / real_c(pixelsVertical_); } /*!\brief Writes the tBuffer to a file in the tBuffer output directory. diff --git a/src/pe/raytracing/Raytracer.h b/src/pe/raytracing/Raytracer.h index f67cd0eda..82e30a452 100644 --- a/src/pe/raytracing/Raytracer.h +++ b/src/pe/raytracing/Raytracer.h @@ -99,16 +99,16 @@ private: std::string tBufferOutputDirectory_; //!< Path to the tbuffer output directory //@} - Vec3 n; // normal vector of viewing plane - Vec3 u; // u and ... - Vec3 v; // ... v span the viewing plane - real_t d; // distance from camera to viewing plane - real_t aspectRatio; // aspect ratio of the generated image and viewing plane - real_t viewingPlaneHeight; // viewing plane height - real_t viewingPlaneWidth; // viewing plane width - Vec3 viewingPlaneOrigin; // origin of the viewing plane - real_t pixelWidth; // width of a pixel of the generated image in the viewing plane - real_t pixelHeight; // height of a pixel of the generated image in the viewing plane + Vec3 n_; //!< The normal vector of viewing plane. + Vec3 u_; //!< The vector spanning the viewing plane in the "right direction". + Vec3 v_; //!< The vector spanning the viewing plane in the "up direction". + real_t d_; //!< The the distance from camera to viewing plane. + real_t aspectRatio_; //!< The aspect ratio of the generated image and viewing plane. + real_t viewingPlaneHeight_; //!< The viewing plane height in the world frame. + real_t viewingPlaneWidth_; //!< The viewing plane width in the world frame. + Vec3 viewingPlaneOrigin_; //!< The origin of the viewing plane. + real_t pixelWidth_; //!< The width of a pixel of the generated image in the viewing plane. + real_t pixelHeight_; //!< The height of a pixel of the generated image in the viewing plane. public: /*!\name Get functions */ @@ -256,7 +256,7 @@ void Raytracer::rayTrace(const size_t timestep) const { for (size_t x = 0; x < pixelsHorizontal_; x++) { for (size_t y = 0; y < pixelsVertical_; y++) { //WALBERLA_LOG_INFO(x << "/" << y); - Vec3 pixelLocation = viewingPlaneOrigin + u*(real_c(x)+real_t(0.5))*pixelWidth + v*(real_c(y)+real_t(0.5))*pixelHeight; + Vec3 pixelLocation = viewingPlaneOrigin_ + u_*(real_c(x)+real_t(0.5))*pixelWidth_ + v_*(real_c(y)+real_t(0.5))*pixelHeight_; Vec3 direction = (pixelLocation - cameraPosition_).getNormalized(); ray.setDirection(direction); -- GitLab