mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- Accept binangle, fixedhoriz and lookangle classes in SetupViewpoint()
vs. Q16.16 variables.
* Allows for more precision than Q16.16. * Used as opportunity for `rollang` to be set using the `asdeg()` method, not `asbuildf()`.
This commit is contained in:
parent
463dbc4c4f
commit
957f7e9487
8 changed files with 19 additions and 21 deletions
|
@ -58,7 +58,6 @@ static vec3_t spritesxyz[MAXSPRITESONSCREEN + 1];
|
|||
static int16_t thewall[MAXWALLSB];
|
||||
static int16_t bunchp2[MAXWALLSB], thesector[MAXWALLSB];
|
||||
static int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
|
||||
static float rollang;
|
||||
static int16_t numscans, numbunches;
|
||||
static int16_t maskwall[MAXWALLSB], maskwallcnt;
|
||||
static int16_t sectorborder[256];
|
||||
|
@ -3773,7 +3772,6 @@ void PrecacheHardwareTextures(int nTile)
|
|||
void renderSetRollAngle(float rolla)
|
||||
{
|
||||
Polymost::gtang = rolla * BAngRadian;
|
||||
rollang = rolla * (BAngRadian * 180 / pi::pif());
|
||||
}
|
||||
|
||||
void videoSetCorrectedAspect()
|
||||
|
|
|
@ -171,18 +171,18 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FRenderViewpoint SetupViewpoint(spritetype* cam, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang)
|
||||
FRenderViewpoint SetupViewpoint(spritetype* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang)
|
||||
{
|
||||
FRenderViewpoint r_viewpoint{};
|
||||
r_viewpoint.CameraSprite = cam;
|
||||
r_viewpoint.SectNums = nullptr;
|
||||
r_viewpoint.SectCount = sectnum;
|
||||
r_viewpoint.Pos = { position.x / 16.f, position.y / -16.f, position.z / -256.f };
|
||||
r_viewpoint.HWAngles.Yaw = -90.f + q16ang(q16angle).asdeg();
|
||||
r_viewpoint.HWAngles.Pitch = -HorizToPitch(q16horizon);
|
||||
r_viewpoint.HWAngles.Roll = -rollang;
|
||||
r_viewpoint.HWAngles.Yaw = -90.f + angle.asdeg();
|
||||
r_viewpoint.HWAngles.Pitch = -horizon.aspitch();
|
||||
r_viewpoint.HWAngles.Roll = -rollang.asdeg();
|
||||
r_viewpoint.FieldOfView = (float)r_fov;
|
||||
r_viewpoint.RotAngle = q16ang(q16angle).asbam();
|
||||
r_viewpoint.RotAngle = angle.asbam();
|
||||
return r_viewpoint;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
}
|
||||
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang)
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
|
@ -279,7 +279,7 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
RenderState->SetVertexBuffer(screen->mVertexData);
|
||||
screen->mVertexData->Reset();
|
||||
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, q16angle, q16horizon, rollang);
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, angle, horizon, rollang);
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
||||
checkBenchActive();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
class FSerializer;
|
||||
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, fixed_t q16angle, fixed_t q16horizon, float rollang);
|
||||
void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, lookangle rollang);
|
||||
|
||||
struct PortalDesc
|
||||
{
|
||||
|
|
|
@ -772,10 +772,10 @@ void viewDrawScreen(bool sceneonly)
|
|||
|
||||
if (testnewrenderer)
|
||||
{
|
||||
fixed_t deliriumPitchI = interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate);
|
||||
fixedhoriz deliriumPitchI = q16horiz(interpolate(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate));
|
||||
int bakCstat = gView->pSprite->cstat;
|
||||
gView->pSprite->cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANSLUCENT_INVERT;
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, nSectnum, cA.asq16(), cH.asq16() + deliriumPitchI, rotscrnang.asbuildf());
|
||||
render_drawrooms(gView->pSprite, { cX, cY, cZ }, nSectnum, cA, cH + deliriumPitchI, rotscrnang);
|
||||
gView->pSprite->cstat = bakCstat;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -82,7 +82,7 @@ void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, bina
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum, a.asq16(), h.asq16(), rotscrnang.asbuildf());
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum, a, h, rotscrnang);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ void animatecamsprite(double smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(camera, camera->pos, camera->sectnum, ang.asq16(), IntToFixed(camera->shade), 0);
|
||||
render_drawrooms(camera, camera->pos, camera->sectnum, ang, buildhoriz(camera->shade), buildlook(0));
|
||||
}
|
||||
display_mirror = 0;
|
||||
renderDrawMasks();
|
||||
|
|
|
@ -367,7 +367,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(nullptr, { nCamerax, nCameray, viewz }, nSector, nCameraa.asq16(), nCamerapan.asq16(), rotscrnang.asbuildf());
|
||||
render_drawrooms(nullptr, { nCamerax, nCameray, viewz }, nSector, nCameraa, nCamerapan, rotscrnang);
|
||||
}
|
||||
|
||||
if (HavePLURemap())
|
||||
|
|
|
@ -1594,7 +1594,7 @@ drawscreen(PLAYERp pp, double smoothratio)
|
|||
else
|
||||
{
|
||||
UpdateWallPortalState();
|
||||
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang.asq16(), thoriz.asq16(), trotscrnang.asbuildf());
|
||||
render_drawrooms(pp->SpriteP, { tx, ty, tz }, tsectnum, tang, thoriz, trotscrnang);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ void JS_InitMirrors(void)
|
|||
// Draw a 3d screen to a specific tile
|
||||
/////////////////////////////////////////////////////
|
||||
void drawroomstotile(int daposx, int daposy, int daposz,
|
||||
fixed_t daq16ang, fixed_t daq16horiz, short dacursectnum, short tilenume)
|
||||
binangle ang, fixedhoriz horiz, short dacursectnum, short tilenume)
|
||||
{
|
||||
TileFiles.MakeCanvas(tilenume, tileWidth(tilenume), tileHeight(tilenume));
|
||||
|
||||
|
@ -475,13 +475,13 @@ void drawroomstotile(int daposx, int daposy, int daposz,
|
|||
{
|
||||
if (!testnewrenderer)
|
||||
{
|
||||
renderDrawRoomsQ16(daposx, daposy, daposz, daq16ang, daq16horiz, dacursectnum);
|
||||
renderDrawRoomsQ16(daposx, daposy, daposz, ang.asq16(), horiz.asq16(), dacursectnum);
|
||||
analyzesprites(daposx, daposy, daposz, false);
|
||||
renderDrawMasks();
|
||||
}
|
||||
else
|
||||
{
|
||||
render_drawrooms(nullptr, { daposx, daposy, daposz }, dacursectnum, daq16ang, daq16horiz, 0);
|
||||
render_drawrooms(nullptr, { daposx, daposy, daposz }, dacursectnum, ang, horiz, buildlook(0));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -721,11 +721,11 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz)
|
|||
|
||||
if (TEST_BOOL11(sp) && numplayers > 1)
|
||||
{
|
||||
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->angle.ang.asq16(), cp->horizon.horiz.asq16(), cp->cursectnum, mirror[cnt].campic);
|
||||
drawroomstotile(cp->posx, cp->posy, cp->posz, cp->angle.ang, cp->horizon.horiz, cp->cursectnum, mirror[cnt].campic);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawroomstotile(sp->x, sp->y, sp->z, IntToFixed(SP_TAG5(sp)), IntToFixed(camhoriz), sp->sectnum, mirror[cnt].campic);
|
||||
drawroomstotile(sp->x, sp->y, sp->z, buildang(SP_TAG5(sp)), buildhoriz(camhoriz), sp->sectnum, mirror[cnt].campic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue