2013-06-02 14:32:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* BoundingFrustum.h *
|
|
|
|
* *
|
2013-07-12 21:30:13 +02:00
|
|
|
* XFX::BoundingFrustum class definition file *
|
2013-06-02 14:32:43 +02:00
|
|
|
* Copyright (c) XFX Team. All Rights Reserved *
|
|
|
|
*****************************************************************************/
|
2013-05-05 18:18:41 +02:00
|
|
|
#ifndef _XFX_BOUNDINGFRUSTRUM_
|
|
|
|
#define _XFX_BOUNDINGFRUSTRUM_
|
|
|
|
|
|
|
|
#include "Enums.h"
|
|
|
|
#include "Matrix.h"
|
|
|
|
#include "Plane.h"
|
|
|
|
#include <System/Object.h>
|
|
|
|
#include <System/Types.h>
|
|
|
|
|
|
|
|
using namespace System;
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
{
|
|
|
|
struct BoundingBox;
|
|
|
|
struct BoundingSphere;
|
|
|
|
struct Ray;
|
|
|
|
struct Vector3;
|
|
|
|
|
2013-07-12 21:30:13 +02:00
|
|
|
/**
|
|
|
|
* Defines a frustum and helps determine whether shapes intersect with it.
|
|
|
|
*/
|
2013-05-05 18:18:41 +02:00
|
|
|
class BoundingFrustum : public IEquatable<BoundingFrustum>, public Object
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static const int BottomPlaneIndex;
|
|
|
|
Vector3 cornerArray[8];
|
|
|
|
static const int FarPlaneIndex;
|
|
|
|
static const int LeftPlaneIndex;
|
|
|
|
Matrix matrix;
|
|
|
|
static const int NearPlaneIndex;
|
|
|
|
static const int NumPlanes;
|
|
|
|
Plane planes[6];
|
|
|
|
static const int RightPlaneIndex;
|
|
|
|
static const int TopPlaneIndex;
|
|
|
|
|
|
|
|
static Vector3 ComputeIntersection(Plane plane, Ray ray);
|
|
|
|
static Ray ComputeIntersectionLine(Plane p1, Plane p2);
|
2013-06-02 14:32:43 +02:00
|
|
|
void SupportMapping(Vector3 v, out Vector3& result);
|
2013-05-05 18:18:41 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Plane Bottom();
|
|
|
|
static const int CornerCount;
|
|
|
|
Plane Far();
|
|
|
|
Plane Left();
|
|
|
|
Matrix getMatrix();
|
|
|
|
void setMatrix(Matrix value);
|
|
|
|
Plane Near();
|
|
|
|
Plane Right();
|
|
|
|
Plane Top();
|
|
|
|
|
|
|
|
BoundingFrustum();
|
|
|
|
BoundingFrustum(Matrix value);
|
|
|
|
BoundingFrustum(const BoundingFrustum &obj); // copy constructor
|
|
|
|
|
|
|
|
ContainmentType_t Contains(BoundingBox box);
|
|
|
|
ContainmentType_t Contains(BoundingFrustum frustrum);
|
|
|
|
ContainmentType_t Contains(BoundingSphere sphere);
|
|
|
|
ContainmentType_t Contains(Vector3 point);
|
2013-06-02 14:32:43 +02:00
|
|
|
void Contains(BoundingBox box, out ContainmentType_t& result);
|
|
|
|
void Contains(BoundingSphere sphere, out ContainmentType_t& result);
|
|
|
|
void Contains(Vector3 point, out ContainmentType_t& result);
|
2013-05-31 15:58:00 +02:00
|
|
|
bool Equals(Object const * const obj) const;
|
2013-05-05 18:18:41 +02:00
|
|
|
bool Equals(const BoundingFrustum other) const;
|
|
|
|
Vector3* GetCorners();
|
|
|
|
void GetCorners(Vector3 corners[]);
|
|
|
|
int GetHashCode() const;
|
2013-07-12 21:30:13 +02:00
|
|
|
static const Type& GetType();
|
2013-05-05 18:18:41 +02:00
|
|
|
bool Intersects(BoundingBox box);
|
|
|
|
bool Intersects(BoundingFrustum frustrum);
|
|
|
|
bool Intersects(BoundingSphere sphere);
|
|
|
|
PlaneIntersectionType_t Intersects(Plane plane);
|
|
|
|
float Intersects(Ray ray);
|
2013-06-02 14:32:43 +02:00
|
|
|
void Intersects(BoundingBox box, out bool& result);
|
|
|
|
void Intersects(BoundingSphere sphere, out bool& result);
|
|
|
|
void Intersects(Plane plane, out PlaneIntersectionType_t& result);
|
|
|
|
void Intersects(Ray ray, out float& result);
|
2013-07-11 20:00:07 +02:00
|
|
|
const String ToString() const;
|
2013-05-05 18:18:41 +02:00
|
|
|
|
|
|
|
bool operator==(const BoundingFrustum& other) const;
|
|
|
|
bool operator!=(const BoundingFrustum& other) const;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_XFX_BOUNDINGFRUSTRUM_
|