-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add C++ point3d_ui_radius demo & C++ radius extensions
- Loading branch information
Showing
10 changed files
with
205 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
// Log some very simple points. | ||
// Log some points with ui points & scene unit radii. | ||
|
||
#include <rerun.hpp> | ||
|
||
int main() { | ||
const auto rec = rerun::RecordingStream("rerun_example_points3d_ui_radius"); | ||
rec.spawn().exit_on_failure(); | ||
|
||
rec.log("points", rerun::Points3D({{0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f}})); | ||
} | ||
// Two blue points with scene unit radii of 0.1 and 0.3. | ||
rec.log( | ||
"scene_unit_points", | ||
rerun::Points3D({{0.0f, 1.0f, 0.0f}, {1.0f, 1.0f, 1.0f}}) | ||
// By default, radii are interpreted as world-space units. | ||
.with_radii({0.1f, 0.3f}) | ||
.with_colors(rerun::Color(0, 0, 255)) | ||
); | ||
|
||
// TODO: unfinished | ||
// Two red points with ui point radii of 40 and 60. | ||
// Ui points are independent of zooming in Views, but are sensitive to the application ui scaling. | ||
// For 100% ui scaling, ui points are equal to pixels. | ||
rec.log( | ||
"ui_points_points", | ||
rerun::Points3D({{0.0f, 0.0f, 0.0}, {1.0f, 0.0f, 1.0f}}) | ||
// rerun::Radius::ui_points produces radii that the viewer interprets as given in ui points. | ||
.with_radii({ | ||
rerun::Radius::ui_points(40.0f), | ||
rerun::Radius::ui_points(60.0f), | ||
}) | ||
.with_colors(rerun::Color(255, 0, 0)) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//#define EDIT_EXTENSION | ||
#if EDIT_EXTENSION | ||
|
||
#include "radius.hpp" | ||
|
||
// Uncomment for better auto-complete while editing the extension. | ||
|
||
namespace rerun { | ||
namespace components { | ||
// <CODEGEN_COPY_TO_HEADER> | ||
|
||
/// Creates a new radius in scene units. | ||
/// | ||
/// Values passed must be finite positive. | ||
static Radius scene_units(float radius_in_scene_units) { | ||
return Radius(radius_in_scene_units); | ||
} | ||
|
||
/// Creates a new radius in ui points. | ||
/// | ||
/// Values passed must be finite positive. | ||
static Radius ui_points(float radius_in_ui_points) { | ||
return Radius(-radius_in_ui_points); | ||
} | ||
|
||
// </CODEGEN_COPY_TO_HEADER> | ||
} // namespace components | ||
} // namespace rerun | ||
|
||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.