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

Add xy overlay plane

parent db516d84
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ namespace overlay { ...@@ -12,7 +12,7 @@ namespace overlay {
enum class Shape { enum class Shape {
BOX, BOX,
CAMERA, CAMERA,
PLANE, XZPLANE,
GRID GRID
}; };
......
...@@ -70,13 +70,21 @@ void Overlay::_createShapes() { ...@@ -70,13 +70,21 @@ void Overlay::_createShapes() {
{-0.5, 0.28, 0.5}, {-0.5, 0.28, 0.5},
{-0.5, -0.28, 0.5}, {-0.5, -0.28, 0.5},
// Plane Y simple // Plane XZ big
{-1.0, 0.0, -1.0}, {-10.0, 0.0, -10.0}, // 13
{1.0, 0.0, -1.0}, {10.0, 0.0, -10.0},
{1.0, 0.0, 1.0}, {10.0, 0.0, 10.0},
{-1.0, 0.0, 1.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_ = { shape_tri_indices_ = {
// Box // Box
0, 1, 2, 0, 1, 2,
...@@ -118,11 +126,24 @@ void Overlay::_createShapes() { ...@@ -118,11 +126,24 @@ void Overlay::_createShapes() {
9, 10, 9, 10,
11, 12, 11, 12,
9, 11, 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::BOX] = {0,30, 30, 12*2};
shapes_[Shape::CAMERA] = {54, 4*3, 66, 8*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("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()); 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 ...@@ -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 (value("show_shapes", false)) {
if (fs.hasChannel(Channel::Shapes3D)) { if (fs.hasChannel(Channel::Shapes3D)) {
std::vector<ftl::codecs::Shape3D> shapes; std::vector<ftl::codecs::Shape3D> shapes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment