50 bool mReadRequested =
false;
57 std::shared_ptr<DrawableObjectVector> mDrawList =
58 std::make_shared<DrawableObjectVector>();
75 void setDrawableObjectVector(
const std::shared_ptr<DrawableObjectVector>& v)
79 for (
auto obj : *mDrawList) {
87 mDrawList->pushBack(
obj);
88 mDrawList->back()->init();
89 return mDrawList->size() - 1;
94 mDrawList->pushBack(std::move(
obj));
95 mDrawList->back()->init();
96 return mDrawList->size() - 1;
104 Box3d bb = mDrawList->boundingBox();
114 virtual void toggleAxisVisibility() = 0;
116 virtual void toggleTrackBallVisibility() = 0;
119 void onInit(uint)
override
121 DerivedRenderApp::DRW::setCanvasDefaultClearColor(
122 derived(), Color::White);
125 void onResize(
unsigned int width,
unsigned int height)
override
127 DTB::resizeViewer(width, height);
136 std::cout <<
"(" << DTB::camera().eye() <<
") "
137 <<
"(" << DTB::camera().center() <<
") "
138 <<
"(" << DTB::camera().up() <<
")\n";
139 std::cout << std::flush;
142 case Key::A: toggleAxisVisibility();
break;
146 DerivedRenderApp::DRW::screenshot(
147 derived(),
"viewer_screenshot.png");
150 case Key::T: toggleTrackBallVisibility();
break;
161 DTB::keyRelease(key);
167 DTB::moveMouse(x, y);
177 DTB::moveMouse(x, y);
188 DTB::moveMouse(x, y);
189 DTB::releaseMouse(
button);
207 using ReadData = ReadBufferTypes::ReadData;
208 using FloatData = ReadBufferTypes::FloatData;
217 const auto proj = DTB::projectionMatrix();
218 const auto view = DTB::viewMatrix();
220 auto size = DerivedRenderApp::DRW::canvasSize(derived());
224 auto callback = [=,
this](
const ReadData&
dt) {
225 mReadRequested =
false;
227 const auto& data = std::get<FloatData>(
dt);
229 const float depth = data[0];
244 mReadRequested = DerivedRenderApp::DRW::readDepth(
253 const auto* derived()
const