From 0df3c3235af8edfc0b83a625d3be2ed685ce04a9 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 22 Feb 2020 12:07:10 +0200 Subject: [PATCH] Minor code tidy --- applications/gui/src/camera.cpp | 107 -------------------- components/renderers/cpp/src/colour_util.cu | 4 +- 2 files changed, 2 insertions(+), 109 deletions(-) diff --git a/applications/gui/src/camera.cpp b/applications/gui/src/camera.cpp index 1fc023a1f..8895db1b2 100644 --- a/applications/gui/src/camera.cpp +++ b/applications/gui/src/camera.cpp @@ -81,26 +81,6 @@ ftl::gui::Camera::Camera(ftl::gui::Screen *screen, int fsmask, int fid, ftl::cod colouriser_ = ftl::create<ftl::render::Colouriser>(screen->root(), "colouriser"); - /*src->setCallback([this](int64_t ts, ftl::rgbd::Frame &frame) { - UNIQUE_LOCK(mutex_, lk); - - auto &channel1 = frame.get<GpuMat>(Channel::Colour); - im1_.create(channel1.size(), channel1.type()); - channel1.download(im1_); - - // OpenGL (0,0) bottom left - cv::flip(im1_, im1_, 0); - - if (channel_ != Channel::Colour && channel_ != Channel::None && frame.hasChannel(channel_)) { - auto &channel2 = frame.get<GpuMat>(channel_); - im2_.create(channel2.size(), channel2.type()); - channel2.download(im2_); - cv::flip(im2_, im2_, 0); - } - });*/ - - //auto *host = screen->root(); - // Is virtual camera? if (fid == 255) { renderer_ = ftl::create<ftl::render::CUDARender>(screen_->root(), std::string("vcam")+std::to_string(vcamcount++)); @@ -125,90 +105,6 @@ ftl::gui::Camera::Camera(ftl::gui::Screen *screen, int fsmask, int fid, ftl::cod } } -/*template<class T> -static Eigen::Matrix<T,4,4> lookAt -( - Eigen::Matrix<T,3,1> const & eye, - Eigen::Matrix<T,3,1> const & center, - Eigen::Matrix<T,3,1> const & up -) -{ - typedef Eigen::Matrix<T,4,4> Matrix4; - typedef Eigen::Matrix<T,3,1> Vector3; - - Vector3 f = (center - eye).normalized(); - Vector3 u = up.normalized(); - Vector3 s = f.cross(u).normalized(); - u = s.cross(f); - - Matrix4 res; - res << s.x(),s.y(),s.z(),-s.dot(eye), - u.x(),u.y(),u.z(),-u.dot(eye), - -f.x(),-f.y(),-f.z(),f.dot(eye), - 0,0,0,1; - - return res; -}*/ - -/*static float4 screenProjection( - const Eigen::Vector3f &pa, // Screen corner 1 - const Eigen::Vector3f &pb, // Screen corner 2 - const Eigen::Vector3f &pc, // Screen corner 3 - const Eigen::Vector3f &pe // Eye position - ) { - - Eigen::Vector3f va, vb, vc; - Eigen::Vector3f vr, vu, vn; - - float l, r, b, t, d; - - // Compute an orthonormal basis for the screen. - - //subtract(vr, pb, pa); - //subtract(vu, pc, pa); - vr = pb - pa; - vu = pc - pa; - - //normalize(vr); - //normalize(vu); - //cross_product(vn, vr, vu); - //normalize(vn); - vr.normalize(); - vu.normalize(); - vn = vr.cross(vu); - vn.normalize(); - - // Compute the screen corner vectors. - - //subtract(va, pa, pe); - //subtract(vb, pb, pe); - //subtract(vc, pc, pe); - va = pa - pe; - vb = pb - pe; - vc = pc - pe; - - // Find the distance from the eye to screen plane. - - //d = -dot_product(va, vn); - d = -va.dot(vn); - - // Find the extent of the perpendicular projection. - - //l = dot_product(vr, va) * n / d; - //r = dot_product(vr, vb) * n / d; - //b = dot_product(vu, va) * n / d; - //t = dot_product(vu, vc) * n / d; - - float n = d; - l = vr.dot(va) * n / d; - r = vr.dot(vb) * n / d; - b = vu.dot(va) * n / d; - t = vu.dot(vc) * n / d; - - //return nanogui::frustum(l,r,b,t,n,f); - return make_float4(l,r,b,t); -}*/ - ftl::gui::Camera::~Camera() { //delete writer_; //delete fileout_; @@ -370,9 +266,6 @@ void ftl::gui::Camera::_draw(std::vector<ftl::rgbd::FrameSet*> &fss) { for (auto *fs : fss) { if (!usesFrameset(fs->id)) continue; - // FIXME: Should perhaps remain locked until after end is called? - // Definitely: causes flashing if not. - //UNIQUE_LOCK(fs->mtx,lk); fs->mtx.lock(); renderer_->submit(fs, ftl::codecs::Channels<0>(Channel::Colour), transforms_[fs->id]); if (isStereo()) renderer2_->submit(fs, ftl::codecs::Channels<0>(Channel::Colour), transforms_[fs->id]); diff --git a/components/renderers/cpp/src/colour_util.cu b/components/renderers/cpp/src/colour_util.cu index e4af5156a..ae3d72f8c 100644 --- a/components/renderers/cpp/src/colour_util.cu +++ b/components/renderers/cpp/src/colour_util.cu @@ -69,7 +69,7 @@ __global__ void blend_alpha_kernel( uchar4* __restrict__ out, int out_pitch, int width, int height, - float alpha, float beta) { + float alpha) { for (STRIDE_Y(y, height)) { for (STRIDE_X(x, width)) { @@ -104,6 +104,6 @@ void ftl::cuda::blend_alpha( blend_alpha_kernel<<<gridSize, blockSize, 0, stream>>>( in.devicePtr(), in.pixelPitch(), out.devicePtr(), out.pixelPitch(), - out.width(), out.height(), alpha, beta); + out.width(), out.height(), alpha); cudaSafeCall( cudaGetLastError() ); } -- GitLab