2021-12-08 18:17:45 +00:00
|
|
|
|
|
|
|
struct Section2;
|
|
|
|
|
2021-12-09 19:44:04 +00:00
|
|
|
enum ESEctionFlag
|
|
|
|
{
|
|
|
|
Unclosed = 1, // at least one unclosed loop
|
|
|
|
Dumped = 2, // builder was unable to properly construct, so content may not be usable for triangulator.
|
|
|
|
BadWinding = 4,
|
|
|
|
};
|
|
|
|
|
2021-12-08 18:17:45 +00:00
|
|
|
struct Section2Wall
|
|
|
|
{
|
|
|
|
// references to game data
|
2021-12-09 19:44:04 +00:00
|
|
|
vec2_t* v1; // points to start vertex in wall[]
|
|
|
|
vec2_t* v2; // points to end vertex in wall[]
|
2021-12-08 18:17:45 +00:00
|
|
|
walltype* wall; // points to the actual wall this belongs to - this is NOT necessarily the same as v1 and can be null.
|
|
|
|
|
|
|
|
// references to section data
|
|
|
|
Section2Wall* backside; // points to this wall's back side
|
|
|
|
Section2* frontsection;
|
|
|
|
Section2* backsection; // if this is null the wall is one-sided
|
|
|
|
};
|
|
|
|
|
2021-12-09 19:44:04 +00:00
|
|
|
struct Section2Loop
|
2021-12-08 18:17:45 +00:00
|
|
|
{
|
|
|
|
TArrayView<Section2Wall*> walls;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Section2
|
|
|
|
{
|
2021-12-14 16:40:03 +00:00
|
|
|
uint8_t flags;
|
|
|
|
uint8_t dirty;
|
|
|
|
uint8_t geomflags;
|
2021-12-11 22:00:38 +00:00
|
|
|
unsigned index;
|
2021-12-08 18:17:45 +00:00
|
|
|
sectortype* sector;
|
|
|
|
// this uses a memory arena for storage, so use TArrayView instead of TArray
|
|
|
|
TArrayView<Section2Wall*> walls;
|
2021-12-09 19:44:04 +00:00
|
|
|
TArrayView<Section2Loop> loops;
|
2021-12-08 18:17:45 +00:00
|
|
|
};
|
|
|
|
|
2021-12-09 19:44:04 +00:00
|
|
|
extern TArray<Section2*> sections2;
|
|
|
|
extern TArrayView<TArrayView<Section2*>> sections2PerSector;
|
|
|
|
|
2021-12-11 22:00:38 +00:00
|
|
|
void hw_CreateSections2();
|
|
|
|
using Outline = TArray<TArray<vec2_t>>;
|
|
|
|
using Point = std::pair<float, float>;
|
|
|
|
using FOutline = std::vector<std::vector<Point>> ; // Data type was chosen so it can be passed directly into Earcut.
|
|
|
|
Outline BuildOutline(Section2* section);
|