-
Notifications
You must be signed in to change notification settings - Fork 451
Make the near clipping plane editable in 2D views #8348
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
Changes from 8 commits
23ece01
59fc206
ef114e0
beaeea3
3f5162c
0841c0c
89a74cb
1a0fc86
2a6a68a
ff3366a
0b502d3
ab8e901
e24f5f2
f4dc194
b8a538a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace rerun.blueprint.components; | ||
|
||
// --- | ||
|
||
/// Distance to the near clipping plane in used for `Spatial2DView`. | ||
struct ClippingPlane ( | ||
"attr.rerun.scope": "blueprint", | ||
"attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable", | ||
"attr.rust.repr": "transparent", | ||
"attr.docs.unreleased" | ||
) { | ||
/// Z distance to the near clipping plane | ||
clipping_plane: rerun.datatypes.Float32 (order: 100); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/rust/api.rs | ||
// Based on "crates/store/re_types/definitions/rerun/blueprint/components/clipping_plane.fbs". | ||
|
||
#![allow(unused_imports)] | ||
#![allow(unused_parens)] | ||
#![allow(clippy::clone_on_copy)] | ||
#![allow(clippy::cloned_instead_of_copied)] | ||
#![allow(clippy::map_flatten)] | ||
#![allow(clippy::needless_question_mark)] | ||
#![allow(clippy::new_without_default)] | ||
#![allow(clippy::redundant_closure)] | ||
#![allow(clippy::too_many_arguments)] | ||
#![allow(clippy::too_many_lines)] | ||
|
||
use ::re_types_core::external::arrow2; | ||
use ::re_types_core::ComponentName; | ||
use ::re_types_core::SerializationResult; | ||
use ::re_types_core::{ComponentBatch, MaybeOwnedComponentBatch}; | ||
use ::re_types_core::{DeserializationError, DeserializationResult}; | ||
|
||
/// **Component**: Distance to the near clipping plane in used for `Spatial2DView`. | ||
#[derive(Clone, Debug, Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable)] | ||
#[repr(transparent)] | ||
pub struct ClippingPlane( | ||
/// Z distance to the near clipping plane | ||
pub crate::datatypes::Float32, | ||
); | ||
|
||
impl ::re_types_core::SizeBytes for ClippingPlane { | ||
#[inline] | ||
fn heap_size_bytes(&self) -> u64 { | ||
self.0.heap_size_bytes() | ||
} | ||
|
||
#[inline] | ||
fn is_pod() -> bool { | ||
<crate::datatypes::Float32>::is_pod() | ||
} | ||
} | ||
|
||
impl<T: Into<crate::datatypes::Float32>> From<T> for ClippingPlane { | ||
fn from(v: T) -> Self { | ||
Self(v.into()) | ||
} | ||
} | ||
|
||
impl std::borrow::Borrow<crate::datatypes::Float32> for ClippingPlane { | ||
#[inline] | ||
fn borrow(&self) -> &crate::datatypes::Float32 { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl std::ops::Deref for ClippingPlane { | ||
type Target = crate::datatypes::Float32; | ||
|
||
#[inline] | ||
fn deref(&self) -> &crate::datatypes::Float32 { | ||
&self.0 | ||
} | ||
} | ||
|
||
impl std::ops::DerefMut for ClippingPlane { | ||
#[inline] | ||
fn deref_mut(&mut self) -> &mut crate::datatypes::Float32 { | ||
&mut self.0 | ||
} | ||
} | ||
|
||
::re_types_core::macros::impl_into_cow!(ClippingPlane); | ||
|
||
impl ::re_types_core::Loggable for ClippingPlane { | ||
#[inline] | ||
fn arrow_datatype() -> arrow::datatypes::DataType { | ||
crate::datatypes::Float32::arrow_datatype() | ||
} | ||
|
||
fn to_arrow_opt<'a>( | ||
data: impl IntoIterator<Item = Option<impl Into<::std::borrow::Cow<'a, Self>>>>, | ||
) -> SerializationResult<arrow::array::ArrayRef> | ||
where | ||
Self: Clone + 'a, | ||
{ | ||
crate::datatypes::Float32::to_arrow_opt(data.into_iter().map(|datum| { | ||
datum.map(|datum| match datum.into() { | ||
::std::borrow::Cow::Borrowed(datum) => ::std::borrow::Cow::Borrowed(&datum.0), | ||
::std::borrow::Cow::Owned(datum) => ::std::borrow::Cow::Owned(datum.0), | ||
}) | ||
})) | ||
} | ||
|
||
fn from_arrow2_opt( | ||
arrow_data: &dyn arrow2::array::Array, | ||
) -> DeserializationResult<Vec<Option<Self>>> | ||
where | ||
Self: Sized, | ||
{ | ||
crate::datatypes::Float32::from_arrow2_opt(arrow_data) | ||
.map(|v| v.into_iter().map(|v| v.map(Self)).collect()) | ||
} | ||
|
||
#[inline] | ||
fn from_arrow2(arrow_data: &dyn arrow2::array::Array) -> DeserializationResult<Vec<Self>> | ||
where | ||
Self: Sized, | ||
{ | ||
crate::datatypes::Float32::from_arrow2(arrow_data).map(bytemuck::cast_vec) | ||
} | ||
} | ||
|
||
impl ::re_types_core::Component for ClippingPlane { | ||
#[inline] | ||
fn name() -> ComponentName { | ||
"rerun.blueprint.components.ClippingPlane".into() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use re_types_core::datatypes::Float32; | ||
|
||
use super::ClippingPlane; | ||
|
||
impl Default for ClippingPlane { | ||
#[inline] | ||
fn default() -> Self { | ||
// Default clipping plane set at a reasonable distance for common cameras | ||
Self(Float32(0.1)) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
maybe better to call the field
near_clip_plane
-near
for descriptiveness,clip
for brevity (and the type thenClipPlane
)(?)