mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- Uplift renderer entry point to DVector3
and provide wrappers for old setups.
This commit is contained in:
parent
056bb9b0cd
commit
f72d42bb8e
7 changed files with 22 additions and 13 deletions
|
@ -192,13 +192,13 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FRenderViewpoint SetupViewpoint(DCoreActor* cam, const vec3_t& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, float fov = -1)
|
||||
FRenderViewpoint SetupViewpoint(DCoreActor* cam, const DVector3& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, float fov = -1)
|
||||
{
|
||||
FRenderViewpoint r_viewpoint{};
|
||||
r_viewpoint.CameraActor = 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.Pos = { position.X, -position.Y, -position.Z };
|
||||
r_viewpoint.HWAngles.Yaw = FAngle::fromDeg(-90.f + (float)angle.Degrees());
|
||||
r_viewpoint.HWAngles.Pitch = FAngle::fromDeg(-horizon.aspitch());
|
||||
r_viewpoint.HWAngles.Roll = FAngle::fromDeg(-(float)rollang.Degrees());
|
||||
|
@ -305,11 +305,11 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
void animatecamsprite(double s);
|
||||
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double smoothratio, float fov)
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double smoothratio, float fov)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
updatesector(position.X, position.Y, §num);
|
||||
updatesector(position, §num);
|
||||
if (sectnum < 0) return;
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
@ -360,9 +360,9 @@ void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sect
|
|||
All.Unclock();
|
||||
}
|
||||
|
||||
void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
void render_camtex(DCoreActor* playersprite, const DVector3& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
{
|
||||
updatesector(position.X, position.Y, §);
|
||||
updatesector(position, §);
|
||||
if (!sect) return;
|
||||
|
||||
screen->RenderState()->SetVertexBuffer(screen->mVertexData);
|
||||
|
|
|
@ -5,8 +5,17 @@
|
|||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double smoothratio, float fov = -1);
|
||||
void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double smoothratio, float fov = -1);
|
||||
void render_camtex(DCoreActor* playersprite, const DVector3& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
|
||||
inline void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, DAngle angle, fixedhoriz horizon, DAngle rollang, double smoothratio, float fov = -1)
|
||||
{
|
||||
render_drawrooms(playersprite, DVector3(position.X * inttoworld, position.Y * inttoworld, position.Z * zinttoworld), sectnum, angle, horizon, rollang, smoothratio, fov);
|
||||
}
|
||||
inline void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, DAngle angle, fixedhoriz horizon, DAngle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
{
|
||||
render_camtex(playersprite, DVector3(position.X* inttoworld, position.Y * inttoworld, position.Z* zinttoworld), sect, angle, horizon, rollang, camtex, rect, smoothratio);
|
||||
}
|
||||
|
||||
struct PortalDesc
|
||||
{
|
||||
|
|
|
@ -769,7 +769,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
fixedhoriz deliriumPitchI = interpolatedhorizon(q16horiz(deliriumPitchO), q16horiz(deliriumPitch), gInterpolate);
|
||||
auto bakCstat = gView->actor->spr.cstat;
|
||||
gView->actor->spr.cstat |= (gViewPos == 0) ? CSTAT_SPRITE_INVISIBLE : CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_TRANS_FLIP;
|
||||
render_drawrooms(gView->actor, { cX, cY, cZ }, sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
render_drawrooms(gView->actor, vec3_t( cX, cY, cZ ), sectnum(pSector), cA, cH + deliriumPitchI, rotscrnang, gInterpolate);
|
||||
gView->actor->spr.cstat = bakCstat;
|
||||
bDeliriumOld = bDelirium && gDeliriumBlur;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ BEGIN_DUKE_NS
|
|||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, DAngle a, fixedhoriz h, DAngle rotscrnang, double smoothratio, bool sceneonly, float fov)
|
||||
{
|
||||
if (!sceneonly) drawweapon(smoothratio);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum(sect), a, h, rotscrnang, smoothratio, fov);
|
||||
render_drawrooms(playersprite, vec3_t( x, y, z ), sectnum(sect), a, h, rotscrnang, smoothratio, fov);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -336,7 +336,7 @@ void DrawView(double smoothRatio, bool sceneonly)
|
|||
|
||||
if (!nFreeze && !sceneonly)
|
||||
DrawWeapons(smoothRatio);
|
||||
render_drawrooms(nullptr, { int(nCamera.X * worldtoint), int(nCamera.Y * worldtoint), viewz }, sectnum(pSector), nCameraa, nCamerapan, rotscrnang, smoothRatio);
|
||||
render_drawrooms(nullptr, vec3_t( int(nCamera.X * worldtoint), int(nCamera.Y * worldtoint), viewz ), sectnum(pSector), nCameraa, nCamerapan, rotscrnang, smoothRatio);
|
||||
|
||||
if (HavePLURemap())
|
||||
{
|
||||
|
|
|
@ -1480,7 +1480,7 @@ void drawscreen(PLAYER* pp, double smoothratio, bool sceneonly)
|
|||
|
||||
if (!sceneonly) UpdatePanel(smoothratio);
|
||||
UpdateWallPortalState();
|
||||
render_drawrooms(pp->actor, { tx, ty, tz }, sectnum(tsect), tang, thoriz, trotscrnang, smoothratio);
|
||||
render_drawrooms(pp->actor, vec3_t( tx, ty, tz ), sectnum(tsect), tang, thoriz, trotscrnang, smoothratio);
|
||||
RestorePortalState();
|
||||
|
||||
if (sceneonly)
|
||||
|
|
|
@ -410,7 +410,7 @@ void drawroomstotile(int daposx, int daposy, int daposz,
|
|||
|
||||
screen->RenderTextureView(canvas, [=](IntRect& rect)
|
||||
{
|
||||
render_camtex(nullptr, { daposx, daposy, daposz }, dacursect, ang, horiz, nullAngle, tileGetTexture(tilenume), rect, smoothratio);
|
||||
render_camtex(nullptr, vec3_t( daposx, daposy, daposz ), dacursect, ang, horiz, nullAngle, tileGetTexture(tilenume), rect, smoothratio);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue