-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DebugLineRender utility #1349
Changes from 4 commits
473bb7f
ce39983
3cb7729
7e1f726
2204df6
8dbd74e
8efc781
fc3540e
6ba198a
2dfbdbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ | |||||
#include "python/corrade/EnumOperators.h" | ||||||
|
||||||
#include "esp/assets/ResourceManager.h" | ||||||
#include "esp/gfx/DebugLineRender.h" | ||||||
#include "esp/gfx/LightSetup.h" | ||||||
#include "esp/gfx/RenderCamera.h" | ||||||
#include "esp/gfx/RenderTarget.h" | ||||||
|
@@ -205,6 +206,43 @@ void initGfxBindings(py::module& m) { | |||||
.def(py::self == py::self) | ||||||
.def(py::self != py::self); | ||||||
|
||||||
py::class_<DebugLineRender, std::shared_ptr<DebugLineRender>>( | ||||||
m, "DebugLineRender") | ||||||
.def("set_line_width", &DebugLineRender::setLineWidth, | ||||||
R"(See push_transform.)") | ||||||
.def( | ||||||
"push_transform", &DebugLineRender::pushTransform, | ||||||
R"(Push (multiply) a transform onto the transform stack, affecting all line-drawing until popped. Must be paired with popTransform().)") | ||||||
.def("pop_transform", &DebugLineRender::popTransform, | ||||||
R"(See push_transform.)") | ||||||
.def("draw_box", &DebugLineRender::drawBox, | ||||||
R"(Draw a box in world-space or local-space (see pushTransform).)") | ||||||
Comment on lines
+219
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No color for box bindings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. draw_box takes two Vector3 and a color. This binding here just takes all the C++ function parameters as-is without explicitly declaring them all here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this just makes it harder for python only user seeing the doc-string API reference to know the parameters. Also, does implicit conversion allow keyword (named) arguments? |
||||||
.def( | ||||||
"draw_circle", &DebugLineRender::drawCircle, "translation"_a, | ||||||
"radius"_a, "color"_a, "num_segments"_a = 24, | ||||||
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0}, | ||||||
R"(Draw a circle in world-space or local-space (see pushTransform). The circle is an approximation; see numSegments.)") | ||||||
.def( | ||||||
"draw_transformed_line", | ||||||
py::overload_cast<const Magnum::Vector3&, const Magnum::Vector3&, | ||||||
const Magnum::Color4&, const Magnum::Color4&>( | ||||||
&DebugLineRender::drawTransformedLine), | ||||||
"from"_a, "to"_a, "from_color"_a, "to_color"_a, | ||||||
R"(Draw a line segment in world-space or local-space (see pushTransform).)") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
.def( | ||||||
"draw_transformed_line", | ||||||
py::overload_cast<const Magnum::Vector3&, const Magnum::Vector3&, | ||||||
const Magnum::Color4&>( | ||||||
&DebugLineRender::drawTransformedLine), | ||||||
"from"_a, "to"_a, "color"_a, | ||||||
R"(Draw a line segment in world-space or local-space (see pushTransform).)") | ||||||
.def( | ||||||
"draw_path_with_endpoint_circles", | ||||||
&DebugLineRender::drawPathWithEndpointCircles, "points"_a, "radius"_a, | ||||||
"color"_a, "num_segments"_a = 24, | ||||||
"normal"_a = Magnum::Vector3{0.0, 1.0, 0.0}, | ||||||
R"(Draw a sequence of line segments with circles at the two endpoints. In world-space or local-space (see pushTransform).)"); | ||||||
|
||||||
m.attr("DEFAULT_LIGHTING_KEY") = DEFAULT_LIGHTING_KEY; | ||||||
m.attr("NO_LIGHT_KEY") = NO_LIGHT_KEY; | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this doc? I assume it applied to lines following the command?