2021-03-19 22:11:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "vectors.h"
|
|
|
|
#include "build.h"
|
|
|
|
|
|
|
|
struct SectorGeometryPlane
|
|
|
|
{
|
|
|
|
TArray<FVector3> vertices;
|
|
|
|
TArray<FVector2> texcoords;
|
|
|
|
FVector3 normal{};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SectorGeometryData
|
|
|
|
{
|
|
|
|
SectorGeometryPlane planes[2];
|
2021-03-30 18:43:21 +00:00
|
|
|
sectortype compare[2] = {};
|
|
|
|
vec2_t poscompare[2] = {};
|
|
|
|
vec2_t poscompare2[2] = {};
|
2021-04-03 10:44:30 +00:00
|
|
|
bool degenerate = false;
|
2021-03-19 22:11:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SectorGeometry
|
|
|
|
{
|
|
|
|
TArray<SectorGeometryData> data;
|
|
|
|
|
2021-04-02 20:52:46 +00:00
|
|
|
void ValidateSector(unsigned sectnum, int plane, const FVector2& offset);
|
2021-04-03 10:44:30 +00:00
|
|
|
bool MakeVertices(unsigned sectnum, int plane, const FVector2& offset);
|
|
|
|
bool MakeVertices2(unsigned sectnum, int plane, const FVector2& offset);
|
2021-03-19 22:11:23 +00:00
|
|
|
|
|
|
|
public:
|
2021-04-02 20:52:46 +00:00
|
|
|
SectorGeometryPlane* get(unsigned sectnum, int plane, const FVector2& offset)
|
2021-03-19 22:11:23 +00:00
|
|
|
{
|
|
|
|
if (sectnum >= data.Size()) return nullptr;
|
2021-04-02 20:52:46 +00:00
|
|
|
ValidateSector(sectnum, plane, offset);
|
2021-03-19 22:11:23 +00:00
|
|
|
return &data[sectnum].planes[plane];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSize(unsigned sectcount)
|
|
|
|
{
|
|
|
|
data.Clear(); // delete old content
|
|
|
|
data.Resize(sectcount);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SectorGeometry sectorGeometry;
|
|
|
|
|
|
|
|
|