mirror of
https://github.com/Relintai/godot-lportal.git
synced 2024-11-11 10:52:09 +01:00
29 lines
685 B
C++
29 lines
685 B
C++
#pragma once
|
|
|
|
#include "lvector.h"
|
|
#include "core/math/plane.h"
|
|
|
|
// The recursive visibility function needs to allocate lists of planes each time a room is traversed.
|
|
// Instead of doing this allocation on the fly we will use a pool which should be much faster and nearer
|
|
// constant time.
|
|
|
|
// Note this simple pool isn't super optimal but should be fine for now.
|
|
class LPlanesPool
|
|
{
|
|
public:
|
|
const static int POOL_MAX = 32;
|
|
|
|
void Reset();
|
|
|
|
unsigned int Request();
|
|
void Free(unsigned int ui);
|
|
|
|
LVector<Plane> &Get(unsigned int ui) {return m_Planes[ui];}
|
|
|
|
LPlanesPool();
|
|
private:
|
|
LVector<Plane> m_Planes[ POOL_MAX];
|
|
unsigned char m_ucTaken[POOL_MAX];
|
|
unsigned int m_uiCount;
|
|
};
|