raze/source/core/sectorgeometry.h
Christoph Oelckers dc234ea72d - implemented RR's geometry effect.
The grossest of all gross render hack that were ever done with Build...
2021-04-02 22:52:46 +02:00

46 lines
No EOL
912 B
C++

#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];
sectortype compare[2] = {};
vec2_t poscompare[2] = {};
vec2_t poscompare2[2] = {};
};
class SectorGeometry
{
TArray<SectorGeometryData> data;
void ValidateSector(unsigned sectnum, int plane, const FVector2& offset);
void MakeVertices(unsigned sectnum, int plane, const FVector2& offset);
public:
SectorGeometryPlane* get(unsigned sectnum, int plane, const FVector2& offset)
{
if (sectnum >= data.Size()) return nullptr;
ValidateSector(sectnum, plane, offset);
return &data[sectnum].planes[plane];
}
void SetSize(unsigned sectcount)
{
data.Clear(); // delete old content
data.Resize(sectcount);
}
};
extern SectorGeometry sectorGeometry;