pub struct CameraConfig { /* private fields */ }
Expand description
Camera configuration struct implementing the builder pattern.
Implementations§
Source§impl CameraConfig
impl CameraConfig
Sourcepub fn new(radius: Float, alpha: Float, beta: Float) -> Self
pub fn new(radius: Float, alpha: Float, beta: Float) -> Self
Creates a new CameraConfig
.
§Arguments
r
is the distance from the camera to the origin.alfa
is camera’s angle along the xy plane.beta
is camera’s angle along z axis.
Sourcepub fn default() -> Self
pub fn default() -> Self
Creates a new CameraConfig
using default values.
Examples found in repository?
examples/texture_from_file.rs (line 10)
3fn main() {
4 // use config builder to create a new globe struct
5 let globe = GlobeConfig::new()
6 // specify path to the texture file
7 .with_texture_at("textures/earth.txt", None)
8 // for built-in textures try using a template
9 //.use_template(GlobeTemplate::Earth)
10 .with_camera(CameraConfig::default())
11 .build();
12
13 // create a new canvas
14 let mut canvas = Canvas::new(250, 250, None);
15
16 // render the globe onto the canvas
17 globe.render_on(&mut canvas);
18
19 // print out the canvas
20 let (size_x, size_y) = canvas.get_size();
21 for i in 0..size_y / 8 {
22 for j in 0..size_x / 4 {
23 print!("{}", canvas.matrix[i][j]);
24 }
25 println!();
26 }
27}
Auto Trait Implementations§
impl Freeze for CameraConfig
impl RefUnwindSafe for CameraConfig
impl Send for CameraConfig
impl Sync for CameraConfig
impl Unpin for CameraConfig
impl UnwindSafe for CameraConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more