/// <summary> /// Initializes a new instance of the <see cref="Orbit"/> class. /// </summary> /// <param name="distance">The distance to the target.</param> /// <param name="azimuth">The azimuth or heading.</param> /// <param name="elevation">The elevation or tilt.</param> public Orbit(float distance = 1f, float azimuth = 0f, float elevation = 0f) { cachedMatrixView = new CachedCalculatedValue <Matrix4x4>(CalcViewMatrix); PropertyChanged += (s, a) => cachedMatrixView.Invalidate(); Azimuth = azimuth; Distance = distance; Elevation = elevation; }
/// <summary> /// Initializes a new instance of the <see cref="FirstPerson"/> class. /// </summary> /// <param name="position">The position of the camera.</param> /// <param name="heading">The heading.</param> /// <param name="tilt">The tilt.</param> public FirstPerson(Vector3 position, float heading = 0f, float tilt = 0f) { cachedMatrixView = new CachedCalculatedValue <Matrix4x4>(CalcViewMatrix); PropertyChanged += (s, a) => cachedMatrixView.Invalidate(); Position = position; Heading = heading; Tilt = tilt; }
/// <summary> /// Initializes a new instance of the <see cref="Perspective"/> class. /// </summary> /// <param name="fieldOfViewY">The field-of-view in y-direction.</param> /// <param name="aspect">The aspect ratio.</param> /// <param name="nearClip">The near clip plane distance.</param> /// <param name="farClip">The far clip plane distance.</param> public Perspective(float fieldOfViewY = 90f, float nearClip = 0.1f, float farClip = 1f, float aspect = 1f) { cachedMatrix = new CachedCalculatedValue <Matrix4x4>(CalculateProjectionMatrix); PropertyChanged += (s, a) => cachedMatrix.Invalidate(); Aspect = aspect; FarClip = farClip; FieldOfViewY = fieldOfViewY; NearClip = nearClip; }
/// <summary> /// Initializes a new instance of the <see cref="Camera{VIEW, PROJECTION}"/> class. /// </summary> /// <param name="view">The view.</param> /// <param name="projection">The projection.</param> public Camera(VIEW view, PROJECTION projection) { View = view; Projection = projection; cachedMatrix = new CachedCalculatedValue <Matrix4x4>(CalcCombinedTransform); View.PropertyChanged += (s, e) => OnPropertyChanged(this, nameof(View)); Projection.PropertyChanged += (s, e) => OnPropertyChanged(this, nameof(Projection)); }
/// <summary> /// Initializes a new instance of the <see cref="Node"/> class. /// </summary> /// <param name="parent">The parent node.</param> public Node(Node parent) { globalTransform = new CachedCalculatedValue <Transformation>(CalcGlobalTransformation); LocalTransformation = Transformation.Identity; Parent = parent; }
/// <summary> /// Initializes a new instance of the <see cref="TransformationHierarchyNode"/> class. /// </summary> /// <param name="localTransformation">The node transformation.</param> /// <param name="parent">The parent transformation hierarchy node.</param> public TransformationHierarchyNode(Transformation localTransformation, TransformationHierarchyNode parent) { globalTransform = new CachedCalculatedValue <Transformation>(CalcGlobalTransformation); LocalTransformation = localTransformation; Parent = parent; }