diff --git a/components/renderers/cpp/include/ftl/render/overlay.hpp b/components/renderers/cpp/include/ftl/render/overlay.hpp index bef452f0936c49807d4b722675c054ae5ce1ca80..7674cf0b45aa3fb72b19bb6aabd83b4611a4ce7d 100644 --- a/components/renderers/cpp/include/ftl/render/overlay.hpp +++ b/components/renderers/cpp/include/ftl/render/overlay.hpp @@ -12,7 +12,7 @@ namespace overlay { enum class Shape { BOX, CAMERA, - PLANE, + XZPLANE, GRID }; diff --git a/components/renderers/cpp/src/overlay.cpp b/components/renderers/cpp/src/overlay.cpp index 368569a1d309d1f3d136ae583e12f48dbacae5d5..f759988b9cc34a07f4724bffe0003a45035ff8e4 100644 --- a/components/renderers/cpp/src/overlay.cpp +++ b/components/renderers/cpp/src/overlay.cpp @@ -70,13 +70,21 @@ void Overlay::_createShapes() { {-0.5, 0.28, 0.5}, {-0.5, -0.28, 0.5}, - // Plane Y simple - {-1.0, 0.0, -1.0}, - {1.0, 0.0, -1.0}, - {1.0, 0.0, 1.0}, - {-1.0, 0.0, 1.0} + // Plane XZ big + {-10.0, 0.0, -10.0}, // 13 + {10.0, 0.0, -10.0}, + {10.0, 0.0, 10.0}, + {-10.0, 0.0, 10.0} }; + // Generate a big plane + for (int x=-9; x<=9; ++x) { + shape_verts_.push_back({float(x), 0.0, -10.0}); + shape_verts_.push_back({float(x), 0.0, 10.0}); + shape_verts_.push_back({-10.0, 0.0, float(x)}); + shape_verts_.push_back({10.0, 0.0, float(x)}); + } + shape_tri_indices_ = { // Box 0, 1, 2, @@ -118,11 +126,24 @@ void Overlay::_createShapes() { 9, 10, 11, 12, 9, 11, - 10, 12 + 10, 12, + + // Big XZ Plane + 13, 14, 15, // 82 + 15, 16, 13 }; + int i = 17; + for (int x=-10; x<=10; ++x) { + shape_tri_indices_.push_back(i++); + shape_tri_indices_.push_back(i++); + shape_tri_indices_.push_back(i++); + shape_tri_indices_.push_back(i++); + } + shapes_[Shape::BOX] = {0,30, 30, 12*2}; shapes_[Shape::CAMERA] = {54, 4*3, 66, 8*2}; + shapes_[Shape::XZPLANE] = {82, 2*3, 88, 40*2}; oShader.uploadAttrib("vertex", sizeof(float3)*shape_verts_.size(), 3, sizeof(float), GL_FLOAT, false, shape_verts_.data()); oShader.uploadAttrib ("indices", sizeof(int)*shape_tri_indices_.size(), 1, sizeof(int), GL_UNSIGNED_INT, true, shape_tri_indices_.data()); @@ -229,6 +250,10 @@ void Overlay::draw(ftl::rgbd::FrameSet &fs, ftl::rgbd::FrameState &state, const } } + if (value("show_xz_plane", true)) { + _drawOutlinedShape(Shape::XZPLANE, state.getPose().inverse(), Eigen::Vector3f(1.0f,1.0f,1.0f), make_uchar4(200,200,200,50), make_uchar4(255,255,255,100)); + } + if (value("show_shapes", false)) { if (fs.hasChannel(Channel::Shapes3D)) { std::vector<ftl::codecs::Shape3D> shapes;