2017-01-11 22:27:35 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "r_defs.h"
|
|
|
|
|
|
|
|
struct FSectorPortal;
|
|
|
|
|
|
|
|
namespace swrenderer
|
|
|
|
{
|
2017-02-03 23:25:37 +00:00
|
|
|
class RenderThread;
|
2017-01-19 02:11:49 +00:00
|
|
|
struct VisiblePlane;
|
2017-01-11 22:27:35 +00:00
|
|
|
|
|
|
|
class VisiblePlaneList
|
|
|
|
{
|
|
|
|
public:
|
2017-02-03 23:25:37 +00:00
|
|
|
VisiblePlaneList(RenderThread *thread);
|
2017-01-11 22:27:35 +00:00
|
|
|
|
2017-01-19 02:19:31 +00:00
|
|
|
void Clear();
|
|
|
|
void ClearKeepFakePlanes();
|
2017-01-11 22:27:35 +00:00
|
|
|
|
2017-01-19 02:11:49 +00:00
|
|
|
VisiblePlane *FindPlane(const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive, const FTransform &xxform, int sky, FSectorPortal *portal, FDynamicColormap *basecolormap);
|
|
|
|
VisiblePlane *GetRange(VisiblePlane *pl, int start, int stop);
|
2017-01-11 22:27:35 +00:00
|
|
|
|
2017-01-19 02:02:32 +00:00
|
|
|
bool HasPortalPlanes() const;
|
2017-01-19 02:11:49 +00:00
|
|
|
VisiblePlane *PopFirstPortalPlane();
|
2017-01-19 02:02:32 +00:00
|
|
|
void ClearPortalPlanes();
|
|
|
|
|
2017-01-11 22:27:35 +00:00
|
|
|
int Render();
|
|
|
|
void RenderHeight(double height);
|
|
|
|
|
2017-02-03 23:25:37 +00:00
|
|
|
RenderThread *Thread = nullptr;
|
|
|
|
|
2017-01-11 22:27:35 +00:00
|
|
|
private:
|
|
|
|
VisiblePlaneList();
|
2017-01-19 02:11:49 +00:00
|
|
|
VisiblePlane *Add(unsigned hash);
|
2017-01-11 22:27:35 +00:00
|
|
|
|
2017-01-19 02:02:32 +00:00
|
|
|
enum { MAXVISPLANES = 128 }; // must be a power of 2
|
2017-01-19 02:11:49 +00:00
|
|
|
VisiblePlane *visplanes[MAXVISPLANES + 1];
|
2017-01-19 02:02:32 +00:00
|
|
|
|
2017-01-11 22:27:35 +00:00
|
|
|
static unsigned CalcHash(int picnum, int lightlevel, const secplane_t &height) { return (unsigned)((picnum) * 3 + (lightlevel)+(FLOAT2FIXED((height).fD())) * 7) & (MAXVISPLANES - 1); }
|
|
|
|
};
|
|
|
|
}
|