#pragma once #include "../utils/common.h" class View { public: View(glm::vec3 t, glm::mat3 r) : _t(t), _r(r) {} glm::vec3 t() const { return _t; } glm::mat3 r() const { return _r; } void transPoints(sptr> results, sptr> points, sptr> indices = nullptr, bool inverse = false); void transVectors(sptr> results, sptr> vectors, sptr> indices = nullptr, bool inverse = false); private: glm::vec3 _t; glm::mat3 _r; }; class Camera { public: Camera(float fov, glm::vec2 c, glm::uvec2 res); bool loadMaskData(std::string filepath); sptr> localRays(); void getRays(sptr> o_rays, View &view); void restoreImage(sptr> o_imgData, sptr> colors); glm::vec2 f() const { return _f; } glm::vec2 c() const { return _c; } glm::uvec2 res() const { return _res; } unsigned int nPixels() const { return _res.x * _res.y; } unsigned int nRays() const { return _subsetIndices == nullptr ? nPixels() : _subsetIndices->n(); } sptr> subsetIndices() const { return _subsetIndices; }; sptr> subsetInverseIndices() const { return _subsetInverseIndices; } private: glm::vec2 _f; glm::vec2 _c; glm::uvec2 _res; sptr> _localRays; sptr> _subsetIndices; sptr> _subsetInverseIndices; void _genLocalRays(bool norm); };