2021-05-02 22:04:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "build.h"
|
|
|
|
|
2021-12-15 11:01:14 +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-05-02 22:04:36 +00:00
|
|
|
struct SectionLine
|
|
|
|
{
|
2021-12-05 20:18:55 +00:00
|
|
|
int section;
|
|
|
|
int partnersection;
|
|
|
|
int startpoint;
|
|
|
|
int endpoint;
|
|
|
|
int wall;
|
|
|
|
int partner;
|
|
|
|
int point2index;
|
2021-12-15 10:07:46 +00:00
|
|
|
|
|
|
|
vec2_t v1() const { return ::wall[startpoint].pos; }
|
|
|
|
vec2_t v2() const { return ::wall[endpoint].pos; }
|
|
|
|
walltype* wallp() const { return &::wall[wall]; }
|
|
|
|
SectionLine* partnerLine() const;
|
|
|
|
|
2021-05-02 22:04:36 +00:00
|
|
|
};
|
2021-12-15 10:07:46 +00:00
|
|
|
extern TArray<SectionLine> sectionLines;
|
|
|
|
|
|
|
|
inline SectionLine* SectionLine::partnerLine() const
|
|
|
|
{
|
|
|
|
return partner == -1 ? nullptr : §ionLines[partner];
|
|
|
|
}
|
2021-05-02 22:04:36 +00:00
|
|
|
|
2021-12-15 11:01:14 +00:00
|
|
|
struct Section2Loop
|
|
|
|
{
|
|
|
|
TArrayView<int> walls;
|
|
|
|
};
|
|
|
|
|
2021-05-02 22:04:36 +00:00
|
|
|
struct Section
|
|
|
|
{
|
2021-12-15 11:01:14 +00:00
|
|
|
uint8_t flags;
|
|
|
|
uint8_t dirty;
|
|
|
|
uint8_t geomflags;
|
|
|
|
unsigned index;
|
2021-05-02 22:04:36 +00:00
|
|
|
int sector;
|
2021-12-15 11:01:14 +00:00
|
|
|
// this uses a memory arena for storage, so use TArrayView instead of TArray
|
|
|
|
TArrayView<int> lines;
|
|
|
|
TArrayView<Section2Loop> loops;
|
2021-05-02 22:04:36 +00:00
|
|
|
};
|
|
|
|
|
2021-12-15 12:05:13 +00:00
|
|
|
extern TArray<Section> sections2;
|
|
|
|
extern TArrayView<TArrayView<Section*>> sections2PerSector;
|
2021-05-02 22:04:36 +00:00
|
|
|
|
2021-12-15 12:05:13 +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(Section* section);
|
2021-05-02 22:04:36 +00:00
|
|
|
|
2021-05-03 15:48:35 +00:00
|
|
|
void hw_SetSplitSector(int sector, int startpos, int endpos);
|
2021-05-23 15:06:47 +00:00
|
|
|
void hw_ClearSplitSector();
|