use super::TableEntry;
use crate::types::{Handle, Vector3};
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct View {
pub handle: Handle,
pub name: String,
pub center: Vector3,
pub height: f64,
pub width: f64,
pub direction: Vector3,
pub target: Vector3,
pub lens_length: f64,
pub front_clip: f64,
pub back_clip: f64,
pub twist_angle: f64,
}
impl View {
pub fn new(name: impl Into<String>) -> Self {
View {
handle: Handle::NULL,
name: name.into(),
center: Vector3::ZERO,
height: 1.0,
width: 1.0,
direction: Vector3::UNIT_Z,
target: Vector3::ZERO,
lens_length: 50.0,
front_clip: 0.0,
back_clip: 0.0,
twist_angle: 0.0,
}
}
}
impl TableEntry for View {
fn handle(&self) -> Handle {
self.handle
}
fn set_handle(&mut self, handle: Handle) {
self.handle = handle;
}
fn name(&self) -> &str {
&self.name
}
fn set_name(&mut self, name: String) {
self.name = name;
}
}