gzdoom/src/swrenderer/scene/r_bsp.h

67 lines
1.6 KiB
C
Raw Normal View History

2016-03-01 15:47:10 +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.
//
2017-01-04 14:39:47 +00:00
#pragma once
2016-03-01 15:47:10 +00:00
#include "tarray.h"
#include <stddef.h>
#include "r_defs.h"
2017-01-04 14:39:47 +00:00
#include "swrenderer/line/r_line.h"
2016-12-22 04:20:53 +00:00
namespace swrenderer
{
2017-01-04 14:39:47 +00:00
struct visplane_t;
2017-01-04 14:39:47 +00:00
// The 3072 below is just an arbitrary value picked to avoid
// drawing lines the player is too close to that would overflow
// the texture calculations.
#define TOO_CLOSE_Z (3072.0 / (1<<12))
2017-01-04 14:39:47 +00:00
enum
{
FAKED_Center,
FAKED_BelowFloor,
FAKED_AboveCeiling
};
2016-03-01 15:47:10 +00:00
2017-01-04 14:39:47 +00:00
class RenderBSP
{
public:
static RenderBSP *Instance();
2016-03-01 15:47:10 +00:00
2017-01-04 14:39:47 +00:00
void ClearClip();
void RenderScene();
2016-03-01 15:47:10 +00:00
2017-01-04 14:39:47 +00:00
void ResetFakingUnderwater() { r_fakingunderwater = false; }
sector_t *FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel, seg_t *backline, int backx1, int backx2, double frontcz1, double frontcz2);
2016-03-01 15:47:10 +00:00
2017-01-04 14:39:47 +00:00
short floorclip[MAXWIDTH];
short ceilingclip[MAXWIDTH];
2017-01-04 14:39:47 +00:00
private:
void RenderBSPNode(void *node);
void RenderSubsector(subsector_t *sub);
bool CheckBBox(float *bspcoord);
void AddPolyobjs(subsector_t *sub);
void FakeDrawLoop(subsector_t *sub, visplane_t *floorplane, visplane_t *ceilingplane);
2016-03-01 15:47:10 +00:00
2017-01-04 14:39:47 +00:00
subsector_t *InSubsector;
sector_t *frontsector;
uint8_t FakeSide;
bool r_fakingunderwater;
SWRenderLine renderline;
};
}