raze/source/core/rendering/hw_sections.h

63 lines
1.4 KiB
C
Raw Normal View History

#pragma once
#include "build.h"
2022-01-09 10:53:32 +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,
};
struct SectionLine
{
int section;
int partnersection;
int startpoint;
int endpoint;
int wall;
int partner;
DVector2 v1() const { return ::wall[startpoint].pos; }
DVector2 v2() const { return ::wall[endpoint].pos; }
walltype* wallp() const { return &::wall[wall]; }
SectionLine* partnerLine() const;
};
extern TArray<SectionLine> sectionLines;
inline SectionLine* SectionLine::partnerLine() const
{
return partner == -1 ? nullptr : &sectionLines[partner];
}
struct Section2Loop
{
TArrayView<int> walls;
};
struct Section
{
uint8_t flags;
uint8_t dirty;
uint8_t geomflags;
unsigned index;
int sector;
// this uses a memory arena for storage, so use TArrayView instead of TArray
TArrayView<int> lines;
TArrayView<Section2Loop> loops;
};
extern TArray<Section> sections;
2022-02-20 12:14:39 +00:00
extern TArrayView<TArrayView<int>> sectionsPerSector;
void hw_CreateSections();
using Outline = TArray<TArray<DVector2>>;
2021-12-15 12:05:13 +00:00
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-03 15:48:35 +00:00
void hw_SetSplitSector(int sector, int startpos, int endpos);
void hw_ClearSplitSector();