2013-11-06 22:52:00 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by Dan Andersson 2013
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2013-11-10 02:27:16 +01:00
|
|
|
#ifndef OYSTER_COLLISION_3D_FRUSTRUM_H
|
|
|
|
#define OYSTER_COLLISION_3D_FRUSTRUM_H
|
2013-11-06 22:52:00 +01:00
|
|
|
|
|
|
|
#include "OysterMath.h"
|
|
|
|
#include "ICollideable.h"
|
|
|
|
#include "Plane.h"
|
|
|
|
|
2013-11-10 02:27:16 +01:00
|
|
|
namespace Oyster { namespace Collision3D
|
2013-11-06 22:52:00 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
class Frustrum : public ICollideable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct{ class Plane plane[6]; };
|
|
|
|
struct
|
|
|
|
{ class Plane leftPlane, rightPlane, bottomPlane, topPlane, nearPlane, farPlane; };
|
|
|
|
};
|
|
|
|
|
2013-11-11 21:14:52 +01:00
|
|
|
Frustrum();
|
2013-11-06 22:52:00 +01:00
|
|
|
Frustrum( const ::Oyster::Math::Float4x4 &viewProjection );
|
2013-11-11 21:14:52 +01:00
|
|
|
virtual ~Frustrum();
|
2013-11-06 22:52:00 +01:00
|
|
|
|
|
|
|
Frustrum & operator = ( const Frustrum &frustrum );
|
|
|
|
Frustrum & operator = ( const ::Oyster::Math::Float4x4 &viewProjection );
|
|
|
|
|
2013-11-10 13:34:35 +01:00
|
|
|
void Split( unsigned int numX, unsigned int numY, unsigned int numZ, Frustrum targetList[] ) const;
|
|
|
|
void WriteToByte( unsigned int &nextIndex, unsigned char targetMem[] ) const;
|
|
|
|
|
|
|
|
void Split( Frustrum targetList[], unsigned int numX, unsigned int numY = 1U, unsigned int numZ = 1u ) const; /// DEPRECATED
|
|
|
|
void WriteToByte( unsigned char targetMem[], unsigned int &nextIndex ) const; /// DEPRECATED
|
2013-11-06 22:52:00 +01:00
|
|
|
|
2013-11-13 14:50:08 +01:00
|
|
|
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
2013-11-25 14:22:38 +01:00
|
|
|
bool Intersects( const ICollideable &target ) const;
|
2013-12-16 09:36:41 +01:00
|
|
|
bool Intersects( const ICollideable &target, Oyster::Math::Float3 &worldPointOfContact ) const;
|
2013-11-25 14:22:38 +01:00
|
|
|
bool Contains( const ICollideable &target ) const;
|
2013-11-06 22:52:00 +01:00
|
|
|
};
|
2013-11-10 13:34:35 +01:00
|
|
|
|
|
|
|
// INLINE IMPLEMENTATIONS ///////////////////////////////////////
|
|
|
|
|
|
|
|
inline void Frustrum::Split( Frustrum targetList[], unsigned int numX, unsigned int numY, unsigned int numZ ) const /// DEPRECATED
|
|
|
|
{ this->Split( numX, numY, numZ, targetList ); }
|
|
|
|
|
|
|
|
inline void Frustrum::WriteToByte( unsigned char targetMem[], unsigned int &nextIndex ) const /// DEPRECATED
|
|
|
|
{ this->WriteToByte( nextIndex, targetMem ); }
|
2013-11-06 22:52:00 +01:00
|
|
|
} }
|
|
|
|
|
|
|
|
#endif
|