Skip to content
Snippets Groups Projects
Commit 5ab94a66 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add 360 render capability

parent f56a0397
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
......@@ -76,11 +76,14 @@ void Camera::update(double delta) {
if (caps.count(Capability::TOUCH)) jmeta["Touch"] = nlohmann::json{{"icon", ENTYPO_ICON_MOUSE_POINTER},{"value", true}};
else jmeta.erase("Touch");
if (caps.count(Capability::MOVABLE)) jmeta["Movable"] = nlohmann::json{{"icon", ENTYPO_ICON_COMPASS},{"value", true}};
if (caps.count(Capability::MOVABLE)) jmeta["Movable"] = nlohmann::json{{"icon", ENTYPO_ICON_DIRECTION},{"value", true}};
else jmeta.erase("Movable");
if (caps.count(Capability::VR)) jmeta["VR"] = nlohmann::json{{"value", true}};
else jmeta.erase("VR");
if (caps.count(Capability::EQUI_RECT)) jmeta["360"] = nlohmann::json{{"icon", ENTYPO_ICON_COMPASS},{"value", true}};
else jmeta.erase("360");
}
std::map<ftl::data::Message,std::string> messages;
......
......@@ -22,7 +22,9 @@ enum class Capability : int {
VR, // Is a VR device, so provides own active pose etc
LIVE, // Live, not recorded (removed from ftl file sources)
FUSED, // Reconstruction has been performed
STREAMED // Means it came from a stream and not device
STREAMED, // Means it came from a stream and not device
EQUI_RECT, // 360 rendered (Equirectangular Render)
STEREO // Side-by-side stereo render
};
std::string capabilityName(Capability);
......
......@@ -105,6 +105,8 @@ class Frame : public ftl::data::Frame {
inline bool isMovable() const { return hasCapability(ftl::rgbd::Capability::MOVABLE); }
inline bool isTouchable() const { return hasCapability(ftl::rgbd::Capability::TOUCH); }
inline bool isVR() const { return hasCapability(ftl::rgbd::Capability::VR); }
inline bool is360() const { return hasCapability(ftl::rgbd::Capability::EQUI_RECT); }
inline bool isSideBySideStereo() const { return hasCapability(ftl::rgbd::Capability::STEREO); }
void upload(ftl::codecs::Channel c);
......
......@@ -33,10 +33,14 @@ ScreenRender::ScreenRender(ftl::render::Source *host, ftl::stream::Feed *feed)
);
intrinsics_ = ftl::create<ftl::Configurable>(host_, "intrinsics");
refresh_calibration_ = false;
intrinsics_->onAny({"focal","width","height"}, [this]() {
refresh_calibration_ = true;
calibration_uptodate_.clear();
});
renderer_->value("projection", 0);
renderer_->onAny({"projection"}, [this]() {
calibration_uptodate_.clear();
});
filter_ = nullptr;
......@@ -85,18 +89,17 @@ bool ScreenRender::retrieve(ftl::data::Frame &frame_out) {
if (sets.size() > 0) {
ftl::rgbd::Frame &rgbdframe = frame_out.cast<ftl::rgbd::Frame>();
if (!frame_out.has(Channel::Calibration) || refresh_calibration_) {
refresh_calibration_ = false;
if (!frame_out.has(Channel::Calibration) || calibration_uptodate_.test_and_set()) {
rgbdframe.setLeft() = ftl::rgbd::Camera::from(intrinsics_);
if (!frame_out.has(Channel::Capabilities)) {
auto &cap = frame_out.create<std::unordered_set<Capability>>(Channel::Capabilities);
cap.clear();
cap.emplace(Capability::VIDEO);
cap.emplace(Capability::MOVABLE);
cap.emplace(Capability::ADJUSTABLE);
cap.emplace(Capability::VIRTUAL);
cap.emplace(Capability::LIVE);
}
if (renderer_->value("projection", 0) == int(ftl::rgbd::Projection::EQUIRECTANGULAR)) cap.emplace(Capability::EQUI_RECT);
auto &meta = frame_out.create<std::map<std::string,std::string>>(Channel::MetaData);
meta["name"] = host_->value("name", host_->getID());
......
......@@ -34,7 +34,7 @@ class ScreenRender : public ftl::render::BaseSourceImpl {
ftl::Configurable *intrinsics_;
uint32_t my_id_;
ftl::operators::Graph *post_pipe_;
bool refresh_calibration_;
std::atomic_flag calibration_uptodate_;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment