mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
left and right cull
This commit is contained in:
1 parent
144723a120
commit
b129273914
2 files changed
+29
-2
No files matched your search
+13
-2
@@ -46,9 +46,20 @@ pub struct CommandArgs {
|
||||
pub wide: bool,
|
||||
|
||||
/// Set the depth culling point
|
||||
/// A good value for my office with a NFOV camera approximately located
|
||||
/// parallel to where my desktop computer is located would be "3000"
|
||||
#[clap(long, default_value = "0")]
|
||||
pub depth_cull: i32,
|
||||
|
||||
/// Cull everything to the right of this point
|
||||
/// "Right" is when the camera is inverted
|
||||
/// A value of "500" is reasonable
|
||||
#[clap(long, default_value = "0")]
|
||||
pub right_cull: i32,
|
||||
|
||||
#[clap(long, default_value = "0")]
|
||||
pub left_cull: i32,
|
||||
|
||||
/// X offset.
|
||||
#[clap(long, default_value = "0", allow_hyphen_values = true)]
|
||||
pub xoff: i32,
|
||||
@@ -142,7 +153,7 @@ fn main() -> AnyhowResult<()> {
|
||||
points = match maybe_points {
|
||||
Err(e) => {
|
||||
println!("Error: {:?}", e);
|
||||
thread::sleep(Duration::from_millis(1000));
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
continue;
|
||||
},
|
||||
Ok(points) => points,
|
||||
@@ -166,7 +177,7 @@ fn main() -> AnyhowResult<()> {
|
||||
},
|
||||
MessagingState::Sending_PointDataBegin => {
|
||||
if frame_number == 1 || frame_number % 10 == 0 {
|
||||
println!("Sending frame number: {}", frame_number);
|
||||
println!("Sending frame number: {} (points: {})", frame_number, points.len());
|
||||
}
|
||||
|
||||
let message = encode_point_data(&mut points, true);
|
||||
|
||||
@@ -142,6 +142,22 @@ pub fn calculate_point_cloud3(
|
||||
|
||||
let color = (*color_data.offset(i)) as ColorCameraPoint;
|
||||
|
||||
// The z-direction moves directly towards and away from the camera
|
||||
if command_args.depth_cull != 0
|
||||
&& z > command_args.depth_cull as f32 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if command_args.left_cull != 0
|
||||
&& x > command_args.left_cull as f32 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if command_args.right_cull != 0
|
||||
&& x < command_args.right_cull as f32 {
|
||||
continue;
|
||||
}
|
||||
|
||||
if command_args.xoff != 0 {
|
||||
x += command_args.xoff as f32;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user