2017-01-12 15:21:46 +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"
|
|
|
|
|
|
|
|
namespace swrenderer
|
|
|
|
{
|
2017-01-15 03:06:52 +00:00
|
|
|
class RenderViewport
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static RenderViewport *Instance();
|
|
|
|
|
|
|
|
void SetViewport(int width, int height, float trueratio);
|
|
|
|
void SetupFreelook();
|
2017-02-01 15:02:21 +00:00
|
|
|
|
|
|
|
DCanvas *RenderTarget = nullptr;
|
|
|
|
fixed_t viewingrangerecip = 0;
|
|
|
|
double FocalLengthX = 0.0;
|
|
|
|
double FocalLengthY = 0.0;
|
|
|
|
double InvZtoScale = 0.0;
|
|
|
|
double WallTMapScale2 = 0.0;
|
|
|
|
double CenterX = 0.0;
|
|
|
|
double CenterY = 0.0;
|
|
|
|
double YaspectMul = 0.0;
|
|
|
|
double IYaspectMul = 0.0;
|
|
|
|
double globaluclip = 0.0;
|
|
|
|
double globaldclip = 0.0;
|
|
|
|
|
|
|
|
// The xtoviewangleangle[] table maps a screen pixel
|
|
|
|
// to the lowest viewangle that maps back to x ranges
|
|
|
|
// from clipangle to -clipangle.
|
|
|
|
angle_t xtoviewangle[MAXWIDTH + 1];
|
|
|
|
|
|
|
|
uint8_t *dc_destorg = nullptr;
|
2017-01-15 03:06:52 +00:00
|
|
|
|
2017-02-01 20:59:48 +00:00
|
|
|
bool RenderingToCanvas() const { return RenderTarget != screen; }
|
|
|
|
|
2017-01-15 03:06:52 +00:00
|
|
|
private:
|
|
|
|
void InitTextureMapping();
|
|
|
|
void SetupBuffer();
|
2017-02-01 15:02:21 +00:00
|
|
|
|
|
|
|
double BaseYaspectMul = 0.0; // yaspectmul without a forced aspect ratio
|
2017-01-15 03:06:52 +00:00
|
|
|
};
|
2017-01-12 15:21:46 +00:00
|
|
|
}
|