osci-render/Source/obj/Frustum.h

25 wiersze
699 B
C
Czysty Zwykły widok Historia

2024-01-21 22:22:03 +00:00
// FROM https://cgvr.cs.uni-bremen.de/teaching/cg_literatur/lighthouse3d_view_frustum_culling/index.html
#pragma once
#include "../mathter/Matrix.hpp"
#include <cmath>
using Vec3 = mathter::Vector<float, 3, false>;
2024-01-21 22:22:03 +00:00
class Frustum {
public:
float ratio, nearDistance, farDistance, width, height, tang, focalLength;
2024-01-21 22:22:03 +00:00
Frustum(float focalLength, float ratio, float nearDistance, float farDistance) {
setCameraInternals(focalLength, ratio, nearDistance, farDistance);
2024-01-21 22:22:03 +00:00
}
~Frustum() {};
void setCameraInternals(float focalLength, float ratio, float nearD, float farD);
void clipToFrustum(Vec3 &p);
float getFocalLength() {
return focalLength;
}
2024-01-21 22:22:03 +00:00
};