Skip to content
Snippets Groups Projects
Commit 9d7bf1e1 authored by Lukas Werner's avatar Lukas Werner Committed by Lukas Werner
Browse files

Changed some naming of some Raytracer member variables

parent 8e8f3faa
Branches
Tags
No related merge requests found
......@@ -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.
......
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment