59 lines
982 B
C++
59 lines
982 B
C++
#pragma once
|
|
#ifndef BOX
|
|
#define BOX
|
|
|
|
#include "mesh.h"
|
|
#include "vector.h"
|
|
#include "plane.h"
|
|
|
|
class Xr_AABB
|
|
{
|
|
public:
|
|
Xr_AABB();
|
|
~Xr_AABB();
|
|
|
|
void setPos(float, float, float);
|
|
void genBox(Xr_Mesh*);
|
|
|
|
Xr_Vector3D getPos() const;
|
|
Xr_Vector3D* const getPoints() const;
|
|
|
|
private:
|
|
Xr_Vector3D A_pos;
|
|
Xr_Vector3D A_points[8];
|
|
};
|
|
|
|
#define FRUSTUM_PLANES_NUMBER 5
|
|
|
|
#define TOP 0
|
|
#define BOTTOM 1
|
|
#define RIGHT 2
|
|
#define LEFT 3
|
|
#define NEAR 4
|
|
|
|
#define MAX_DISTANCE_TEST 4
|
|
|
|
class Xr_FrustumBox
|
|
{
|
|
public:
|
|
Xr_FrustumBox();
|
|
~Xr_FrustumBox();
|
|
|
|
void setBoxSize(float, float, float, float);
|
|
void genBox(Xr_Vector3D const&, Xr_Vector3D const&, Xr_Vector3D const&, Xr_Vector3D const&, Xr_Vector3D const&, Xr_Vector3D const&);
|
|
|
|
bool testPoint(float, float, float);
|
|
bool testAABB(Xr_AABB*);
|
|
|
|
private:
|
|
float F_far;
|
|
float F_near;
|
|
float F_heightFar;
|
|
float F_heightNear;
|
|
float F_widthFar;
|
|
float F_widthNear;
|
|
Xr_Plane F_frustumPlanes[5];
|
|
};
|
|
|
|
#endif
|