Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- utils : add `FileDialogGui.h` (https://github.com/Simple-Robotics/candlewick/pull/61)
- core : add `guiAddFileDialog` (https://github.com/Simple-Robotics/candlewick/pull/61)
- utils : refactor `VideoRecorder` ctor, add `open()` member function (https://github.com/Simple-Robotics/candlewick/pull/62)
- multibody/Visualizer add screenshot button in visualizer's GUI (https://github.com/Simple-Robotics/candlewick/pull/62)

### Changed

- utils : avoid public inclusion of `libavutil/pixfmt` header for video recorder (https://github.com/Simple-Robotics/candlewick/pull/61)
- core : `errors.h`: make terminate_with_message a template (with formatting arguments, etc) (https://github.com/Simple-Robotics/candlewick/pull/61)
- utils: add VideoRecorder::close() API (to manually close recorder) (https://github.com/Simple-Robotics/candlewick/pull/61)
- multibody/RobotDebug.cpp : fix velocity arrow direction (https://github.com/Simple-Robotics/candlewick/pull/61)
- utils : make `writeTextureToVideoFrame` a member function (https://github.com/Simple-Robotics/candlewick/pull/62)
- utils : rename `writeToFile` to `saveTextureToFile` (https://github.com/Simple-Robotics/candlewick/pull/62)

### Fixed

- core : fix `CommandBuffer::submitAndAcquireFence()` not setting the internal pointer to null
- Fix all calls to `terminate_with_message()` (format string with `%`) (https://github.com/Simple-Robotics/candlewick/pull/62)

## [0.0.7] - 2025-05-17

Expand Down
41 changes: 21 additions & 20 deletions examples/Ur5WithSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "candlewick/multibody/RobotScene.h"
#include "candlewick/multibody/RobotDebug.h"
#include "candlewick/primitives/Primitives.h"
#include "candlewick/utils/FileDialogGui.h"
#include "candlewick/utils/VideoRecorder.h"
#include "candlewick/utils/WriteTextureToImage.h"

#include <imgui.h>
Expand Down Expand Up @@ -93,16 +93,16 @@ static void updateOrtho(float zoom) {
}

static std::shared_ptr<coal::ConvexBase>
loadConvexMeshFromFile(const std::string &filename) {
loadConvexMeshFromFile(std::string_view filename) {
coal::NODE_TYPE bv_type = coal::BV_AABB;
coal::MeshLoader load{bv_type};
coal::BVHModelPtr_t bvh = load.load(filename);
coal::BVHModelPtr_t bvh = load.load(std::string{filename});
bvh->buildConvexHull(true, "Qt");
return bvh->convex;
}

static pin::GeometryObject
loadGeomObjFromFile(const char *name, const std::string &filename,
loadGeomObjFromFile(const char *name, std::string_view filename,
pin::SE3 pl = pin::SE3::Identity()) {
auto convex = loadConvexMeshFromFile(filename);
Eigen::Vector3d scale;
Expand Down Expand Up @@ -193,9 +193,9 @@ static void screenshot_button_callback(Renderer &renderer,
renderer.waitAndAcquireSwapchain(command_buffer);

SDL_Log("Saving screenshot at %s", filename);
media::writeToFile(command_buffer, device, pool, renderer.swapchain,
renderer.getSwapchainTextureFormat(), wWidth, wHeight,
filename);
media::saveTextureToFile(command_buffer, device, pool, renderer.swapchain,
renderer.getSwapchainTextureFormat(), wWidth,
wHeight, filename);
}

int main(int argc, char **argv) {
Expand Down Expand Up @@ -331,10 +331,13 @@ int main(int argc, char **argv) {

static bool demo_window_open = true;
static bool show_about_window = false;
static bool show_imgui_window = false;
static bool show_plane_vis = true;

if (show_about_window)
showCandlewickAboutWindow(&show_about_window);
if (show_imgui_window)
ImGui::ShowAboutWindow(&show_imgui_window);

ImGuiWindowFlags window_flags = 0;
window_flags |= ImGuiWindowFlags_AlwaysAutoResize;
Expand All @@ -343,6 +346,7 @@ int main(int argc, char **argv) {
ImGui::Begin("Renderer info & controls", nullptr, window_flags);

if (ImGui::BeginMenuBar()) {
ImGui::MenuItem("About Dear ImGui", NULL, &show_imgui_window);
ImGui::MenuItem("About Candlewick", NULL, &show_about_window);
ImGui::EndMenuBar();
}
Expand Down Expand Up @@ -404,10 +408,10 @@ int main(int argc, char **argv) {
}

ImGui::SeparatorText("Screenshots");
static GuiFileSaveDialog scr_dialog;
scr_dialog.addFileDialog(renderer.window);
static std::string scr_filename;
guiAddFileDialog(renderer.window, DialogFileType::IMAGES, scr_filename);
if (ImGui::Button("Take screenshot")) {
screenshot_filename = scr_dialog.filename.c_str();
screenshot_filename = scr_filename.c_str();
}

ImGui::SeparatorText("Robot model");
Expand Down Expand Up @@ -440,13 +444,10 @@ int main(int argc, char **argv) {
#ifdef CANDLEWICK_WITH_FFMPEG_SUPPORT
media::VideoRecorder recorder{NoInit};
media::TransferBufferPool transfer_buffer_pool{renderer.device};
if (performRecording)
recorder = media::VideoRecorder{wWidth,
wHeight,
"ur5.mp4",
{
.fps = 50,
}};
if (performRecording) {
recorder.settings.fps = 50;
recorder.open(wWidth, wHeight, "ur5.mp4");
}
#endif

AABB &worldSpaceBounds = robot_scene.worldSpaceBounds;
Expand Down Expand Up @@ -515,9 +516,9 @@ int main(int argc, char **argv) {
#ifdef CANDLEWICK_WITH_FFMPEG_SUPPORT
CommandBuffer command_buffer = renderer.acquireCommandBuffer();
auto swapchain_format = renderer.getSwapchainTextureFormat();
media::videoWriteTextureToFrame(
command_buffer, renderer.device, transfer_buffer_pool, recorder,
renderer.swapchain, swapchain_format, wWidth, wHeight);
recorder.writeTextureToVideoFrame(command_buffer, renderer.device,
transfer_buffer_pool,
renderer.swapchain, swapchain_format);
#endif
}
if (screenshot_filename) {
Expand Down
Loading