Skip to content
Snippets Groups Projects
Select Git revision
  • 990347a228a53eac27b57a770950f2aab7444b26
  • master default protected
2 results

PopulationUpgrade.cs

Blame
  • Forked from Erno Lokkila / Game_jam19
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    camera.cpp 27.19 KiB
    #include "camera.hpp"
    #include "pose_window.hpp"
    #include "screen.hpp"
    #include <nanogui/glutil.h>
    
    #include <ftl/profiler.hpp>
    
    #include <opencv2/imgproc.hpp>
    #include <opencv2/imgcodecs.hpp>
    #include <opencv2/cudaarithm.hpp>
    
    #include <ftl/operators/antialiasing.hpp>
    #include <ftl/cuda/normals.hpp>
    #include <ftl/render/colouriser.hpp>
    #include <ftl/cuda/transform.hpp>
    #include <ftl/operators/gt_analysis.hpp>
    #include <ftl/operators/poser.hpp>
    #include <ftl/cuda/colour_cuda.hpp>
    
    #include <ftl/render/overlay.hpp>
    #include "statsimage.hpp"
    
    #define LOGURU_REPLACE_GLOG 1
    #include <loguru.hpp>
    
    #include <fstream>
    
    #ifdef HAVE_OPENVR
    #include "vr.hpp"
    #endif
    
    using ftl::rgbd::isValidDepth;
    using ftl::gui::GLTexture;
    using ftl::gui::PoseWindow;
    using ftl::codecs::Channel;
    using ftl::codecs::Channels;
    using cv::cuda::GpuMat;
    
    
    static int vcamcount = 0;
    
    static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) {
    	Eigen::Affine3d rx =
    		Eigen::Affine3d(Eigen::AngleAxisd(ax, Eigen::Vector3d(1, 0, 0)));
    	Eigen::Affine3d ry =
    		Eigen::Affine3d(Eigen::AngleAxisd(ay, Eigen::Vector3d(0, 1, 0)));
    	Eigen::Affine3d rz =
    		Eigen::Affine3d(Eigen::AngleAxisd(az, Eigen::Vector3d(0, 0, 1)));
    	return rz * rx * ry;
    }
    
    ftl::gui::Camera::Camera(ftl::gui::Screen *screen, int fsmask, int fid, ftl::codecs::Channel c)
    		: screen_(screen), fsmask_(fsmask), fid_(fid), texture1_(GLTexture::Type::BGRA), texture2_(GLTexture::Type::BGRA), depth1_(GLTexture::Type::Float), channel_(c),channels_(0u) {
    
    	eye_ = Eigen::Vector3d::Zero();
    	neye_ = Eigen::Vector4d::Zero();
    	rotmat_.setIdentity();
    
    	//up_ = Eigen::Vector3f(0,1.0f,0);
    	lerpSpeed_ = 0.999f;
    	sdepth_ = false;
    	ftime_ = (float)glfwGetTime();
    	pause_ = false;
    
    #ifdef HAVE_OPENVR
    	vr_mode_ = false;
    #endif
    
    	//channel_ = Channel::Left;