40 lines
1.6 KiB
C++
40 lines
1.6 KiB
C++
//
|
|
// Created by dawsh on 1/25/24.
|
|
//
|
|
#pragma once
|
|
|
|
#include "Plane.h"
|
|
#include <J3ML/LinearAlgebra/CoordinateFrame.h>
|
|
|
|
namespace Geometry
|
|
{
|
|
|
|
enum class FrustumType
|
|
{
|
|
Invalid,
|
|
/// Set the Frustum type to this value to define the orthographic projection formula. In orthographic projection,
|
|
/// 3D images are projected onto a 2D plane essentially by flattening the object along one direction (the plane normal).
|
|
/// The size of the projected images appear the same independent of their distance to the camera, and distant objects will
|
|
/// not appear smaller. The shape of the Frustum is identical to an oriented bounding box (OBB).
|
|
Orthographic,
|
|
/// Set the Frustum type to this value to use the perspective projection formula. With perspective projection, the 2D
|
|
/// image is formed by projecting 3D points towards a single point (the eye point/tip) of the Frustum, and computing the
|
|
/// point of intersection of the line of the projection and the near plane of the Frustum.
|
|
/// This corresponds to the optics in the real-world, and objects become smaller as they move to the distance.
|
|
/// The shape of the Frustum is a rectangular pyramid capped from the tip.
|
|
Perspective
|
|
};
|
|
|
|
class Frustum {
|
|
public:
|
|
Plane TopFace;
|
|
Plane BottomFace;
|
|
Plane RightFace;
|
|
Plane LeftFace;
|
|
Plane FarFace;
|
|
Plane NearFace;
|
|
static Frustum CreateFrustumFromCamera(const CoordinateFrame& cam, float aspect, float fovY, float zNear, float zFar);
|
|
};
|
|
|
|
|
|
} |