first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,76 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __NFRUSTRUM__
#define __NFRUSTRUM__
#include "geometry/plane.h"
class nMatrix4;
namespace GS {
struct Shape;
class MinMax;
/*!
@short Frustum.
@author Emmanuel Julien (ejulien@nworks.fr)
*/
class Frustum
{
public:
enum Visibility
{
Outside = 0,
Inside,
Clipped
};
enum VolumePlane
{
Top = 0,
Bottom,
Left,
Right,
Near,
Far
};
protected:
Vector4 vtx[8]; ///< Frustum vertices.
Plane plane[6]; ///< Frustum planes.
public:
inline const Vector4 *GetVertices() const { return vtx; }
/// Compute perspective frustum volume planes.
void SetPerspective(float fov, float near, float far, const Matrix4 *m = 0, float h_ar = 1, float v_ar = 1);
/// Compute orthographic frustum volume planes.
void SetOrthographic(float width, float height, float near, float far, const Matrix4 *m = 0, float h_ar = 1, float v_ar = 1);
/// Return the visibility flag of a vector set against this frustum.
Visibility ClassifySet(uint count, const Vector4 * const GSRESTRICT set, const float offset = 0) const;
/// Return the visibility flag of a frustum against this frustum.
Visibility ClassifyFrustrum(const Frustum &frustum) const;
/// Return the visibility flag of a sphere against this frustum.
Visibility ClassifySphere(const Vector4 &p, float r) const;
/// Return the visibility flag of a minmax against this frustum.
Visibility ClassifyMinMax(const MinMax &mm, const Matrix4 *m = 0) const;
/// Return the visibility flag of a shape against this frustum.
Visibility ClassifyShape(const Shape &s, const Matrix4 *m = 0) const;
};
} // GS
#endif // __NFRUSTRUM__