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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- multibody/RobotScene : early return if pipeline is nullptr (https://github.com/Simple-Robotics/candlewick/pull/58)
- multibody/RobotScene : reorganize pipelines (accomodate for transparent PBR shader)
- shaders : refactor basic PBR shader (move some functions to new `pbr_lighting.glsl`) (https://github.com/Simple-Robotics/candlewick/pull/58)
- interleave debug scene render between robot render system opaque and transparent passes
- interleave debug scene render between robot render system opaque and transparent passes (https://github.com/Simple-Robotics/candlewick/pull/59)
- revamp depth and shadow map pass classes (https://github.com/Simple-Robotics/candlewick/pull/60)
- core/Texture : do not store pointer to `Device` but raw `SDL_GPUDevice *` handle (https://github.com/Simple-Robotics/candlewick/pull/60)

## [0.0.6] - 2025-05-14

Expand Down
7 changes: 6 additions & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ endif(GENERATE_PYTHON_STUBS)

find_package(eigenpy 3.2.0 REQUIRED)

set(pycandlewick_SOURCES src/expose-renderer.cpp src/module.cpp)
set(
pycandlewick_SOURCES
src/expose-mesh-data.cpp
src/expose-renderer.cpp
src/module.cpp
)

set(PYLIB_INSTALL_DIR ${PYTHON_SITELIB}/${PROJECT_NAME})

Expand Down
22 changes: 22 additions & 0 deletions bindings/python/src/expose-mesh-data.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "fwd.hpp"
#include "candlewick/utils/MeshData.h"

using namespace candlewick;

void exposeMeshData() {

bp::class_<MeshLayout>("MeshLayout", bp::no_init);

bp::class_<MeshData, boost::noncopyable>("MeshData", bp::no_init)
.def_readonly("layout", &MeshData::layout)
.add_property("numVertices", &MeshData::numVertices,
"Number of vertices.")
.add_property("vertexSize", &MeshData::vertexSize)
.add_property("vertexBytes", &MeshData::vertexBytes,
"Number of bytes in the vertex data.")
.add_property("numIndices", &MeshData::numIndices, "Number of indices.")
.add_property("isIndexed", &MeshData::isIndexed,
"Whether the mesh is indexed.")

;
}
30 changes: 14 additions & 16 deletions bindings/python/src/expose-visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,32 @@

using namespace candlewick::multibody;

#define DEF_PROP_PROXY(name) \
add_property(#name, bp::make_function( \
+[](Visualizer &v) -> auto & { return v.name(); }, \
bp::return_internal_reference<>()))

void exposeVisualizer() {
eigenpy::OptionalConverter<ConstVectorRef, std::optional>::registration();
bp::class_<Visualizer::Config>("VisualizerConfig", bp::init<>())
.def_readwrite("width", &Visualizer::Config::width)
.def_readwrite("height", &Visualizer::Config::height);

auto cl =
bp::class_<Visualizer, boost::noncopyable>("Visualizer", bp::no_init)
.def(bp::init<Visualizer::Config, const pin::Model &,
const pin::GeometryModel &>(
("self"_a, "config", "model", "geomModel")))
.def(pinocchio::python::VisualizerPythonVisitor<Visualizer>{})
.def_readonly("renderer", &Visualizer::renderer)
.add_property("shouldExit", &Visualizer::shouldExit);

bp::class_<Visualizer, boost::noncopyable>("Visualizer", bp::no_init)
.def(bp::init<Visualizer::Config, const pin::Model &,
const pin::GeometryModel &>(
("self"_a, "config", "model", "geomModel")))
.def(pinocchio::python::VisualizerPythonVisitor<Visualizer>{})
.def_readonly("renderer", &Visualizer::renderer)
// fix for Pinocchio 3.5.0
#if PINOCCHIO_VERSION_AT_MOST(3, 5, 0)
#define DEF_PROP_PROXY(name) \
add_property(#name, bp::make_function( \
+[](Visualizer &v) -> auto & { return v.name(); }, \
bp::return_internal_reference<>()))
cl //
.DEF_PROP_PROXY(model)
.DEF_PROP_PROXY(visualModel)
.DEF_PROP_PROXY(collisionModel)
.DEF_PROP_PROXY(data)
.DEF_PROP_PROXY(visualData)
.DEF_PROP_PROXY(collisionData);
#undef DEF_PROP_PROXY
.DEF_PROP_PROXY(collisionData)
#endif
.add_property("shouldExit", &Visualizer::shouldExit);
}
#undef DEF_PROP_PROXY
4 changes: 3 additions & 1 deletion bindings/python/src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

using namespace candlewick;

void exposeMeshData();
void exposeRenderer();
#ifdef CANDLEWICK_PYTHON_PINOCCHIO_SUPPORT
void exposeVisualizer();
#endif
void exposeRenderer();

BOOST_PYTHON_MODULE(pycandlewick) {
bp::import("eigenpy");
Expand All @@ -26,6 +27,7 @@ BOOST_PYTHON_MODULE(pycandlewick) {
// Register SDL_Quit() as a function to call when interpreter exits.
Py_AtExit(SDL_Quit);

exposeMeshData();
exposeRenderer();
#ifdef CANDLEWICK_PYTHON_PINOCCHIO_SUPPORT
{
Expand Down
12 changes: 6 additions & 6 deletions examples/Ur5WithSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ int main(int argc, char **argv) {
robot_debug.addFrameTriad(debug_scene, ee_frame_id);
robot_debug.addFrameVelocityArrow(debug_scene, ee_frame_id);

auto depthPassInfo =
DepthPassInfo::create(renderer, plane_obj.mesh.layout(), NULL,
{SDL_GPU_CULLMODE_NONE, 0.05f, 0.f, true, false});
DepthPass depthPass(renderer.device, plane_obj.mesh.layout(),
renderer.depth_texture,
{SDL_GPU_CULLMODE_NONE, 0.05f, 0.f, true, false});
auto &shadowPassInfo = robot_scene.shadowPass;
auto shadowDebugPass =
DepthDebugPass::create(renderer, shadowPassInfo.depthTexture);
DepthDebugPass::create(renderer, shadowPassInfo.shadowMap);

auto depthDebugPass =
DepthDebugPass::create(renderer, renderer.depth_texture);
Expand Down Expand Up @@ -464,7 +464,7 @@ int main(int argc, char **argv) {
auto &castables = robot_scene.castables();
renderShadowPassFromAABB(command_buffer, shadowPassInfo, sceneLight,
castables, worldSpaceBounds);
renderDepthOnlyPass(command_buffer, depthPassInfo, viewProj, castables);
depthPass.render(command_buffer, viewProj, castables);
switch (g_showDebugViz) {
case FULL_RENDER:
robot_scene.renderOpaque(command_buffer, g_camera);
Expand Down Expand Up @@ -501,7 +501,7 @@ int main(int argc, char **argv) {

SDL_WaitForGPUIdle(renderer.device);
frustumBoundsDebug.release();
depthPassInfo.release();
depthPass.release();
shadowDebugPass.release(renderer.device);
depthDebugPass.release(renderer.device);
robot_scene.release();
Expand Down
2 changes: 1 addition & 1 deletion src/candlewick/core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace candlewick {
struct Camera;
class CommandBuffer;
struct Device;
struct Texture;
class Texture;
class Mesh;
class MeshView;
class MeshLayout;
Expand Down
Loading