// examples/basic.rs

use sm_3d_camera_control::{Camera, CameraControl, CameraConfig, LookAtConfig};

fn main() {
    // Example 1: Initialize a camera with default configuration and move it.
    println!("Example 1: Basic Camera Movement");
    let mut camera = Camera::new(CameraConfig::default());
    println!("Initial camera position: {:?}", camera.position());

    camera.move_forward(1.0);
    println!("Camera position after moving forward: {:?}", camera.position());

    camera.move_right(0.5);
    println!("Camera position after moving right: {:?}", camera.position());

    // Example 2: Rotate the camera and look at a specific point.
    println!("\nExample 2: Camera Rotation and LookAt");
    let mut camera2 = Camera::new(CameraConfig::default());
    println!("Initial camera direction: {:?}", camera2.direction());

    camera2.rotate_yaw(45.0); // Rotate 45 degrees around the Y-axis
    camera2.rotate_pitch(15.0); // Rotate 15 degrees around the X-axis
    println!("Camera direction after rotation: {:?}", camera2.direction());

    let look_at_point = [2.0, 1.0, -1.0];
    camera2.look_at(look_at_point, LookAtConfig::default());
    println!("Camera direction after look_at: {:?}", camera2.direction());

    // Example 3: Modify camera configuration and update the camera.
    println!("\nExample 3: Camera Configuration Update");
    let mut camera3 = Camera::new(CameraConfig::default());
    println!("Initial camera FOV: {}", camera3.fov());

    let new_config = CameraConfig {
        fov: 60.0,
        aspect_ratio: 16.0 / 9.0,
        near_plane: 0.1,
        far_plane: 100.0,
    };
    camera3.update_config(new_config);
    println!("Camera FOV after config update: {}", camera3.fov());
    println!("Camera aspect ratio after config update: {}", camera3.aspect_ratio());

    // Example 4: Zoom in and out
    println!("\nExample 4: Camera Zooming");
    let mut camera4 = Camera::new(CameraConfig::default());
    println!("Initial camera position: {:?}", camera4.position());

    camera4.zoom(0.5); // Zoom in
    println!("Camera position after zooming in: {:?}", camera4.position());

    camera4.zoom(-0.2); // Zoom out a bit
    println!("Camera position after zooming out: {:?}", camera4.position());

    // Example 5: Strafe the camera
    println!("\nExample 5: Camera Strafing");
    let mut camera5 = Camera::new(CameraConfig::default());
    println!("Initial camera position: {:?}", camera5.position());

    camera5.strafe_left(0.3);
    println!("Camera position after strafing left: {:?}", camera5.position());

    camera5.strafe_right(0.1);
    println!("Camera position after strafing right: {:?}", camera5.position());


    println!("\nFor more advanced features and information on 3D camera control, visit: https://supermaker.ai/blog/qwen-image-multiple-angles-3d-camera-alibabas-breakthrough-in-ai-camera-control/");
}