Remove usages of CoordinateFrame
This commit is contained in:
@@ -149,11 +149,8 @@ namespace J3ML::Geometry
|
||||
is because the Frustum class implements a caching mechanism where world, projection and viewProj matrices are recomputed on demand, which does not work nicely together
|
||||
if the defaults were uninitialized. */
|
||||
Frustum();
|
||||
|
||||
static Frustum CreateFrustumFromCamera(const CoordinateFrame& cam, float aspect, float fovY, float zNear, float zFar);
|
||||
public:
|
||||
|
||||
|
||||
/// Quickly returns an arbitrary point inside this Frustum. Used in GJK intersection test.
|
||||
[[nodiscard]] Vector3 AnyPointFast() const { return CornerPoint(0); }
|
||||
|
||||
|
@@ -19,6 +19,5 @@
|
||||
#include "J3ML/LinearAlgebra/Matrix3x3.hpp"
|
||||
#include "J3ML/LinearAlgebra/Matrix4x4.hpp"
|
||||
#include "J3ML/LinearAlgebra/Transform2D.hpp"
|
||||
#include "J3ML/LinearAlgebra/CoordinateFrame.hpp"
|
||||
|
||||
using namespace J3ML::LinearAlgebra;
|
||||
|
9
main.cpp
9
main.cpp
@@ -20,19 +20,14 @@
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
Matrix3x3 matrix_rep = {
|
||||
0.9902160, 0.0000000, 0.1395431,
|
||||
0.9902160, 0.0000000, 0.1395431,
|
||||
0.1273699, 0.4084874, -0.9038334,
|
||||
-0.0570016, 0.9127640, 0.4044908};
|
||||
-0.0570016, 0.9127640, 0.4044908};
|
||||
|
||||
Quaternion quat_rep = {0.5425029, 0.0586955, 0.0380374, 0.8371371};
|
||||
|
||||
AxisAngle aa_rep = { {0.9917912, 0.1073057, 0.069539}, 1.1575362};
|
||||
|
||||
EulerAngleXYZ euler_rep = {1.15, 0.14,0};
|
||||
|
||||
Quaternion q_from_matrix = Quaternion(matrix_rep);
|
||||
assert(quat_rep.Equals(q_from_matrix));
|
||||
|
||||
|
||||
using namespace J3ML::Math;
|
||||
|
||||
|
@@ -129,23 +129,6 @@ namespace J3ML::Geometry
|
||||
return mostExtreme;
|
||||
}
|
||||
|
||||
Frustum Frustum::CreateFrustumFromCamera(const CoordinateFrame &cam, float aspect, float fovY, float zNear, float zFar) {
|
||||
Frustum frustum;
|
||||
const float halfVSide = zFar * tanf(fovY * 0.5f);
|
||||
const float halfHSide = halfVSide * aspect;
|
||||
|
||||
const Vector3 frontMultFar = cam.Front * zFar;
|
||||
|
||||
// frustum.NearFace = Plane{cam.Position + cam.Front * zNear, cam.Front};
|
||||
// frustum.FarFace = Plane{cam.Position + frontMultFar, -cam.Front};
|
||||
// frustum.RightFace = Plane{cam.Position, Vector3::Cross(frontMultFar - cam.Right * halfHSide, cam.Up)};
|
||||
// frustum.LeftFace = Plane{cam.Position, Vector3::Cross(cam.Up, frontMultFar+cam.Right*halfHSide)};
|
||||
// frustum.TopFace = Plane{cam.Position, Vector3::Cross(cam.Right, frontMultFar - cam.Up * halfVSide)};
|
||||
// frustum.BottomFace = Plane{cam.Position, Vector3::Cross(frontMultFar + cam.Up * halfVSide, cam.Right)};
|
||||
return frustum;
|
||||
}
|
||||
|
||||
|
||||
PBVolume<6> Frustum::ToPBVolume() const {
|
||||
PBVolume<6> frustumVolume;
|
||||
frustumVolume.p[0] = NearPlane();
|
||||
|
Reference in New Issue
Block a user