| Crates.io | sm_3d_camera_control |
| lib.rs | sm_3d_camera_control |
| version | 68.0.10 |
| created_at | 2026-01-15 10:06:40.715518+00 |
| updated_at | 2026-01-15 10:06:40.715518+00 |
| description | High-quality integration for https://supermaker.ai/blog/qwen-image-multiple-angles-3d-camera-alibabas-breakthrough-in-ai-camera-control/ |
| homepage | https://supermaker.ai/blog/qwen-image-multiple-angles-3d-camera-alibabas-breakthrough-in-ai-camera-control/ |
| repository | https://github.com/qy-upup/sm-3d-camera-control |
| max_upload_size | |
| id | 2045116 |
| size | 12,400 |
A Rust crate providing a convenient and efficient interface for controlling virtual 3D cameras, enabling precise manipulation of camera parameters for rendering and simulation purposes. This crate simplifies the process of setting up and adjusting camera perspectives, making it ideal for applications like game development, 3D modeling, and scientific visualization.
To use sm-3d-camera-control in your Rust project, add the following to your Cargo.toml file:
toml
[dependencies]
sm-3d-camera-control = "0.1.0" # Replace with the latest version
Here are a few examples demonstrating how to use the sm-3d-camera-control crate:
1. Basic Camera Setup: rust use sm_3d_camera_control::Camera; use sm_3d_camera_control::Vector3;
fn main() { // Create a new camera with a specific position and target. let mut camera = Camera::new( Vector3::new(0.0, 0.0, 5.0), // Position Vector3::new(0.0, 0.0, 0.0), // Target Vector3::new(0.0, 1.0, 0.0), // Up vector 45.0, // Field of view (degrees) 1.0, // Aspect ratio 0.1, // Near clipping plane 100.0, // Far clipping plane );
// Print the camera's view matrix.
println!("View matrix: {:?}", camera.get_view_matrix());
}
2. Moving the Camera: rust use sm_3d_camera_control::Camera; use sm_3d_camera_control::Vector3;
fn main() { let mut camera = Camera::new( Vector3::new(0.0, 0.0, 5.0), Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 1.0, 0.0), 45.0, 1.0, 0.1, 100.0, );
// Move the camera along the X-axis.
camera.translate(Vector3::new(1.0, 0.0, 0.0));
// Print the updated camera position.
println!("New camera position: {:?}", camera.position);
}
3. Rotating the Camera: rust use sm_3d_camera_control::Camera; use sm_3d_camera_control::Vector3;
fn main() { let mut camera = Camera::new( Vector3::new(0.0, 0.0, 5.0), Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 1.0, 0.0), 45.0, 1.0, 0.1, 100.0, );
// Rotate the camera around the Y-axis by 30 degrees.
camera.rotate_y(30.0);
// Print the updated view matrix.
println!("Updated view matrix: {:?}", camera.get_view_matrix());
}
4. Adjusting the Field of View: rust use sm_3d_camera_control::Camera; use sm_3d_camera_control::Vector3;
fn main() { let mut camera = Camera::new( Vector3::new(0.0, 0.0, 5.0), Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 1.0, 0.0), 45.0, 1.0, 0.1, 100.0, );
// Adjust the field of view.
camera.set_field_of_view(60.0);
// Print the new field of view.
println!("New field of view: {}", camera.field_of_view);
}
5. Zooming with the Camera: rust use sm_3d_camera_control::Camera; use sm_3d_camera_control::Vector3;
fn main() { let mut camera = Camera::new( Vector3::new(0.0, 0.0, 5.0), Vector3::new(0.0, 0.0, 0.0), Vector3::new(0.0, 1.0, 0.0), 45.0, 1.0, 0.1, 100.0, );
// Zoom in by moving the camera closer to the target.
camera.zoom(1.0);
// Print the updated camera position.
println!("New camera position: {:?}", camera.position);
}
MIT
This crate is part of the sm-3d-camera-control ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/blog/qwen-image-multiple-angles-3d-camera-alibabas-breakthrough-in-ai-camera-control/