- Merge voxels back into trunk. Even if it needs further tweaking, it should at least be stable now.

SVN r3086 (trunk)
This commit is contained in:
Randy Heit 2011-01-02 18:02:27 +00:00
commit 2add3fb381
24 changed files with 2555 additions and 205 deletions

View file

@ -102,7 +102,6 @@ static fixed_t MaxVisForFloor;
static FRandom pr_torchflicker ("TorchFlicker");
static FRandom pr_hom;
static TArray<InterpolationViewer> PastViewers;
static int centerxwide;
static bool polyclipped;
static bool r_showviewer;
bool r_dontmaplines;
@ -134,6 +133,7 @@ float LastFOV;
int WidescreenRatio;
fixed_t GlobVis;
fixed_t viewingrangerecip;
fixed_t FocalTangent;
fixed_t FocalLengthX;
fixed_t FocalLengthY;
@ -150,6 +150,8 @@ float WallTMapScale2;
extern "C" {
int centerx;
int centery;
int centerxwide;
}
DCanvas *RenderTarget; // [RH] canvas to render to
@ -158,6 +160,7 @@ fixed_t globaluclip, globaldclip;
fixed_t centerxfrac;
fixed_t centeryfrac;
fixed_t yaspectmul;
fixed_t baseyaspectmul; // yaspectmul without a forced aspect ratio
float iyaspectmulfloat;
fixed_t InvZtoScale;
@ -457,6 +460,9 @@ void R_InitTextureMapping ()
FocalLengthY = Scale (centerxfrac, yaspectmul, hitan);
FocalLengthXfloat = (float)FocalLengthX / 65536.f;
// This is 1/FocalTangent before the widescreen extension of FOV.
viewingrangerecip = DivScale32(1, finetangent[FINEANGLES/4+(FieldOfView/2)]);
// Now generate xtoviewangle for sky texture mapping.
// [RH] Do not generate viewangletox, because texture mapping is no
// longer done with trig, so it's not needed.
@ -599,7 +605,7 @@ void R_SetViewSize (int blocks)
void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
{
int virtheight, virtwidth;
int virtheight, virtwidth, trueratio, virtwidth2, virtheight2;
if (windowSize >= 11)
{
@ -620,7 +626,7 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
}
// If the screen is approximately 16:9 or 16:10, consider it widescreen.
WidescreenRatio = CheckRatio (fullWidth, fullHeight);
WidescreenRatio = CheckRatio (fullWidth, fullHeight, &trueratio);
DrawFSHUD = (windowSize == 11);
@ -643,8 +649,18 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
centerxfrac = centerx<<FRACBITS;
centeryfrac = centery<<FRACBITS;
virtwidth = fullWidth;
virtheight = fullHeight;
virtwidth = virtwidth2 = fullWidth;
virtheight = virtheight2 = fullHeight;
if (trueratio & 4)
{
virtheight2 = virtheight2 * BaseRatioSizes[trueratio][3] / 48;
}
else
{
virtwidth2 = virtwidth2 * BaseRatioSizes[trueratio][3] / 48;
}
if (WidescreenRatio & 4)
{
virtheight = virtheight * BaseRatioSizes[WidescreenRatio][3] / 48;
@ -656,6 +672,7 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight)
centerxwide = centerx * BaseRatioSizes[WidescreenRatio][3] / 48;
}
baseyaspectmul = Scale(320 << FRACBITS, virtheight2, r_Yaspect * virtwidth2);
yaspectmul = Scale ((320<<FRACBITS), virtheight, r_Yaspect * virtwidth);
iyaspectmulfloat = (float)virtwidth * r_Yaspect / 320.f / (float)virtheight;
InvZtoScale = yaspectmul * centerx;