Skip to content

Commit a1066be

Browse files
committed
fix: gate 3D-only state and doc links so the 2D crates build without warnings
1 parent a6a63ac commit a1066be

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎src/state.rs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub type MultibodySlots = (
128128
);
129129

130130
/// Failure of [`NexusState::set_multibody_joint_positions`].
131+
#[cfg(feature = "dim3")]
131132
#[derive(Debug)]
132133
pub enum JointPositionsError {
133134
/// The GPU write failed.
@@ -136,12 +137,14 @@ pub enum JointPositionsError {
136137
DofMismatch { expected: usize, got: usize },
137138
}
138139

140+
#[cfg(feature = "dim3")]
139141
impl From<GpuBackendError> for JointPositionsError {
140142
fn from(e: GpuBackendError) -> Self {
141143
JointPositionsError::Gpu(e)
142144
}
143145
}
144146

147+
#[cfg(feature = "dim3")]
145148
impl core::fmt::Display for JointPositionsError {
146149
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
147150
match self {
@@ -216,9 +219,11 @@ pub struct NexusState {
216219
/// into the mass matrix (refreshed every substep) or applies them
217220
/// explicitly (mass matrix refreshed once per step). Applied at
218221
/// [`Self::finalize`] and by [`Self::set_rbd_implicit_coriolis`].
222+
#[cfg(feature = "dim3")]
219223
rbd_implicit_coriolis: bool,
220224
/// Multibody refresh cadence `(every substep, light)`; see
221225
/// [`Self::set_rbd_substep_refresh`].
226+
#[cfg(feature = "dim3")]
222227
rbd_substep_refresh: (bool, bool),
223228
/// Set whenever the rapier worlds change; consumed by [`Self::finalize`] to
224229
/// decide whether the GPU [`RbdState`] needs rebuilding.
@@ -257,7 +262,9 @@ impl NexusState {
257262
run_stats: RunStats::default(),
258263
rbd_envs: vec![PhysicsWorld::default()],
259264
rbd_sim_params: vec![RbdSimParams::tgs_soft()],
265+
#[cfg(feature = "dim3")]
260266
rbd_implicit_coriolis: true,
267+
#[cfg(feature = "dim3")]
261268
rbd_substep_refresh: (true, false),
262269
rbd_dirty: false,
263270
rbd_steps_per_frame: 1,
@@ -696,7 +703,7 @@ impl NexusState {
696703
// --- rigid-body and multibody state access (between steps) -------------
697704

698705
/// GPU pose slot of `handle` in environment `env`: the index into
699-
/// [`Self::read_rigid_body_poses`] and [`Self::read_rigid_body_velocities`].
706+
/// [`Self::read_rigid_body_poses`] (and, in 3D, `read_rigid_body_velocities`).
700707
/// `None` before `finalize` or for a handle this state does not know.
701708
pub fn rigid_body_gpu_index(&self, env: usize, handle: RigidBodyHandle) -> Option<u32> {
702709
self.rbd2gpu
@@ -757,7 +764,7 @@ impl NexusState {
757764
/// Teleports a free rigid body: overwrites its world-origin pose on the GPU.
758765
/// Valid between steps, after `finalize`. A multibody link's pose is
759766
/// re-derived from its joint coordinates every step, so links go through
760-
/// [`Self::set_multibody_joint_positions`] instead. Unknown handles are
767+
/// `set_multibody_joint_positions` (3D) instead. Unknown handles are
761768
/// ignored.
762769
pub fn set_rigid_body_pose(
763770
&mut self,

‎src_viewer/viewer.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,14 +909,14 @@ impl NexusViewer {
909909
}
910910

911911
/// Shadow map resolution and atlas layer count of the main window's render
912-
/// (see [`Self::set_sensor_shadow_resolution`]).
912+
/// (see `set_sensor_shadow_resolution`, the 3D sensor-camera counterpart).
913913
pub fn set_shadow_resolution(&mut self, resolution: u32, layers: u32) {
914914
self.window.set_shadow_atlas_layers(layers.max(1));
915915
self.window.set_shadow_resolution(resolution.max(1));
916916
}
917917

918918
/// Directional-shadow cascade layout of the main window's render (see
919-
/// [`Self::set_sensor_shadow_range`]).
919+
/// `set_sensor_shadow_range`, the 3D sensor-camera counterpart).
920920
pub fn set_shadow_range(&mut self, first_cascade_far_bound: f32, shadow_distance: f32) {
921921
self.window
922922
.set_first_cascade_far_bound(first_cascade_far_bound.max(0.01));

0 commit comments

Comments
 (0)