2016-03-01 15:47:10 +00:00
|
|
|
#ifndef __R_UTIL_H
|
|
|
|
#define __R_UTIL_H
|
|
|
|
|
|
|
|
#include "r_state.h"
|
2016-04-01 10:22:16 +00:00
|
|
|
#include "vectors.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
|
|
|
// Stuff from r_main.h that's needed outside the rendering code.
|
|
|
|
|
|
|
|
// Number of diminishing brightness levels.
|
|
|
|
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
|
|
|
#define NUMCOLORMAPS 32
|
|
|
|
|
|
|
|
extern DCanvas *RenderTarget;
|
|
|
|
|
2016-04-01 10:22:16 +00:00
|
|
|
extern DVector3 ViewPos;
|
|
|
|
extern DAngle ViewAngle;
|
|
|
|
extern DAngle ViewPitch;
|
2016-04-25 18:27:27 +00:00
|
|
|
extern DAngle ViewRoll;
|
2016-04-07 17:35:01 +00:00
|
|
|
extern DVector3 ViewPath[2];
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
extern "C" int centerx, centerxwide;
|
|
|
|
extern "C" int centery;
|
|
|
|
|
|
|
|
extern int setblocks;
|
|
|
|
|
2016-04-14 17:40:14 +00:00
|
|
|
extern double ViewTanCos;
|
|
|
|
extern double ViewTanSin;
|
|
|
|
extern double FocalTangent;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
extern bool r_NoInterpolate;
|
|
|
|
extern int validcount;
|
|
|
|
|
|
|
|
extern angle_t LocalViewAngle; // [RH] Added to consoleplayer's angle
|
|
|
|
extern int LocalViewPitch; // [RH] Used directly instead of consoleplayer's pitch
|
|
|
|
extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate
|
2016-09-12 13:51:50 +00:00
|
|
|
extern float WidescreenRatio;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-03-24 00:46:11 +00:00
|
|
|
extern double r_TicFracF;
|
2016-03-01 15:47:10 +00:00
|
|
|
extern DWORD r_FrameTime;
|
|
|
|
extern int extralight;
|
|
|
|
extern unsigned int R_OldBlend;
|
|
|
|
|
2016-04-23 03:54:04 +00:00
|
|
|
const double r_Yaspect = 200.0; // Why did I make this a variable? It's never set anywhere.
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// R_PointOnSide
|
|
|
|
//
|
|
|
|
// Traverse BSP (sub) tree, check point against partition plane.
|
|
|
|
// Returns side 0 (front/on) or 1 (back).
|
|
|
|
//
|
|
|
|
// [RH] inlined, stripped down, and made more precise
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
inline int R_PointOnSide (fixed_t x, fixed_t y, const node_t *node)
|
|
|
|
{
|
|
|
|
return DMulScale32 (y-node->y, node->dx, node->x-x, node->dy) > 0;
|
|
|
|
}
|
2016-03-31 15:44:05 +00:00
|
|
|
inline int R_PointOnSide(double x, double y, const node_t *node)
|
|
|
|
{
|
|
|
|
return DMulScale32(FLOAT2FIXED(y) - node->y, node->dx, node->x - FLOAT2FIXED(x), node->dy) > 0;
|
|
|
|
}
|
2016-03-30 22:41:21 +00:00
|
|
|
inline int R_PointOnSide(const DVector2 &pos, const node_t *node)
|
|
|
|
{
|
|
|
|
return DMulScale32(FLOAT2FIXED(pos.Y) - node->y, node->dx, node->x - FLOAT2FIXED(pos.X), node->dy) > 0;
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Used for interpolation waypoints.
|
2016-03-27 11:29:58 +00:00
|
|
|
struct DVector3a
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-03-27 11:29:58 +00:00
|
|
|
DVector3 pos;
|
2016-03-16 11:41:26 +00:00
|
|
|
DAngle angle;
|
2016-03-01 15:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
subsector_t *R_PointInSubsector (fixed_t x, fixed_t y);
|
2016-03-30 22:41:21 +00:00
|
|
|
inline subsector_t *R_PointInSubsector(const DVector2 &pos)
|
|
|
|
{
|
|
|
|
return R_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y));
|
|
|
|
}
|
2016-03-01 15:47:10 +00:00
|
|
|
void R_ResetViewInterpolation ();
|
|
|
|
void R_RebuildViewInterpolation(player_t *player);
|
|
|
|
bool R_GetViewInterpolationStatus();
|
|
|
|
void R_ClearInterpolationPath();
|
2016-03-27 11:29:58 +00:00
|
|
|
void R_AddInterpolationPoint(const DVector3a &vec);
|
2016-03-01 15:47:10 +00:00
|
|
|
void R_SetViewSize (int blocks);
|
2016-04-28 11:59:06 +00:00
|
|
|
void R_SetFOV (DAngle fov);
|
2016-03-01 15:47:10 +00:00
|
|
|
void R_SetupFrame (AActor * camera);
|
|
|
|
void R_SetViewAngle ();
|
|
|
|
|
|
|
|
// Called by startup code.
|
|
|
|
void R_Init (void);
|
|
|
|
void R_ExecuteSetViewSize (void);
|
|
|
|
|
|
|
|
// Called by M_Responder.
|
|
|
|
void R_SetViewSize (int blocks);
|
|
|
|
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight);
|
|
|
|
|
|
|
|
|
|
|
|
extern void R_FreePastViewers ();
|
|
|
|
extern void R_ClearPastViewer (AActor *actor);
|
|
|
|
|
|
|
|
// This list keeps track of the cameras that draw into canvas textures.
|
|
|
|
struct FCanvasTextureInfo
|
|
|
|
{
|
|
|
|
FCanvasTextureInfo *Next;
|
|
|
|
TObjPtr<AActor> Viewpoint;
|
|
|
|
FCanvasTexture *Texture;
|
|
|
|
FTextureID PicNum;
|
|
|
|
int FOV;
|
|
|
|
|
|
|
|
static void Add (AActor *viewpoint, FTextureID picnum, int fov);
|
|
|
|
static void UpdateAll ();
|
|
|
|
static void EmptyList ();
|
|
|
|
static void Serialize (FArchive &arc);
|
|
|
|
static void Mark();
|
|
|
|
|
|
|
|
private:
|
|
|
|
static FCanvasTextureInfo *List;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|