mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- sky tweaking
* Build skies need a different mesh for the dome - the one from GZDoom distorts them too much. * made adjustment to the positioning math after redoing the mesh * Exhumed abuses some strange effect of the original sky placement math which means the y-offsetting must be disabled for this game. * RRRA sky initialization fixed. It must be done after setting up the tiles.
This commit is contained in:
parent
82bcd90755
commit
ab36b86a59
5 changed files with 48 additions and 14 deletions
|
@ -62,6 +62,7 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "v_video.h"
|
||||
#include "hwrenderer/data/buffers.h"
|
||||
#include "version.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -139,10 +140,10 @@ FSkyVertexBuffer::~FSkyVertexBuffer()
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// todo: make both available at the same time.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BUILD_SKY
|
||||
void FSkyVertexBuffer::SkyVertex(int r, int c, bool zflip)
|
||||
{
|
||||
static const FAngle maxSideAngle = 60.f;
|
||||
|
@ -179,8 +180,33 @@ void FSkyVertexBuffer::SkyVertex(int r, int c, bool zflip)
|
|||
|
||||
mVertices.Push(vert);
|
||||
}
|
||||
#else
|
||||
void FSkyVertexBuffer::SkyVertex(int r, int c, bool zflip)
|
||||
{
|
||||
static const FAngle maxSideAngle = 60.f;
|
||||
static const float scale = 10000.;
|
||||
|
||||
FAngle topAngle = (c / (float)mColumns * 360.f);
|
||||
FVector2 pos = topAngle.ToVector(scale);
|
||||
float z = (!zflip) ? (mRows - r) * 4000.f : -(mRows - r) * 4000.f;
|
||||
|
||||
FSkyVertex vert;
|
||||
|
||||
vert.color = r == 0 ? 0xffffff : 0xffffffff;
|
||||
|
||||
// And the texture coordinates.
|
||||
if (zflip) r = mRows * 2 - r;
|
||||
vert.u = 0.5 + (-c / (float)mColumns);
|
||||
vert.v = (r / (float)(2*mRows));
|
||||
|
||||
// And finally the vertex.
|
||||
vert.x = pos.X;
|
||||
vert.y = z - 1.f;
|
||||
vert.z = pos.Y;
|
||||
|
||||
mVertices.Push(vert);
|
||||
}
|
||||
#endif
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -53,16 +53,21 @@ void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane,
|
|||
int remap = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||
|
||||
int16_t const* dapskyoff = getpsky(picnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||
int tw = tileWidth(picnum);
|
||||
if ((1 << sizeToBits(tw)) < tw) dapskybits--; // Build math is weird.
|
||||
|
||||
skytex = GetSkyTexture(picnum, dapskybits, dapskyoff, remap);
|
||||
realskybits = dapskybits;
|
||||
if (skytex) dapskybits = 0;
|
||||
else skytex = tileGetTexture(picnum);
|
||||
}
|
||||
|
||||
float xpanning = plane == plane_ceiling ? sector->ceilingxpan_ : sector->floorxpan_;
|
||||
|
||||
// dapyscale is not relvant for a sky dome.
|
||||
sky->y_scale = FixedToFloat(daptileyscale);
|
||||
sky->y_offset = dapyoffs*2;
|
||||
sky->x_offset = 0;// xpanning / (1 << (realskybits - dapskybits));
|
||||
sky->y_offset = dapyoffs*1.5;
|
||||
sky->x_offset = xpanning / (1 << (realskybits - dapskybits));
|
||||
sky->fadecolor = FadeColor;
|
||||
sky->shade = 0;// clamp(plane == plane_ceiling ? sector->ceilingshade : sector->floorshade, 0, numshades - 1);
|
||||
sky->texture = skytex;
|
||||
|
|
|
@ -65,22 +65,24 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
float texh = tex->GetDisplayHeight();
|
||||
auto& modelMatrix = state.mModelMatrix;
|
||||
auto& textureMatrix = state.mTextureMatrix;
|
||||
auto texskyoffset = tex->GetSkyOffset() + origin->y_offset + skyoffsettest;
|
||||
auto texskyoffset = tex->GetSkyOffset() + skyoffsettest;
|
||||
if (!(g_gameType & GAMEFLAG_PSEXHUMED)) texskyoffset += origin->y_offset;
|
||||
|
||||
int repeat_fac = 1;
|
||||
if (texh <= 192)
|
||||
float repeat_fac = 1;
|
||||
if (texh <= 256)
|
||||
{
|
||||
repeat_fac = 384 / texh;
|
||||
texh *= repeat_fac;
|
||||
repeat_fac = 336.f / texh;
|
||||
texh = 336;
|
||||
}
|
||||
modelMatrix.loadIdentity();
|
||||
modelMatrix.rotate(-180.0f + origin->x_offset, 0.f, 1.f, 0.f);
|
||||
modelMatrix.translate(0.f, -40 + texskyoffset + (texh - 300) / 2 * skyoffsetfactor, 0.f);
|
||||
//modelMatrix.scale(1.f, 0.8f * 1.17f, 1.f);
|
||||
modelMatrix.translate(0.f, -40 + texskyoffset * skyoffsetfactor, 0.f);
|
||||
modelMatrix.scale(1.f, texh / 400.f, 1.f);
|
||||
textureMatrix.loadIdentity();
|
||||
textureMatrix.scale(-1.f, 0.5*repeat_fac, 1.f);
|
||||
textureMatrix.translate(1.f, 0/*origin->y_offset / texh*/, 1.f);
|
||||
state.EnableTextureMatrix(true);
|
||||
textureMatrix.scale(1.f, repeat_fac, 1.f);
|
||||
vertexBuffer->RenderDome(state, origin->texture, FSkyVertexBuffer::SKYMODE_MAINLAYER);
|
||||
state.EnableTextureMatrix(false);
|
||||
}
|
||||
state.SetTextureMode(TM_NORMAL);
|
||||
if (origin->fadecolor & 0xffffff)
|
||||
|
|
|
@ -92,5 +92,6 @@ const int SAVEPICHEIGHT = 180;
|
|||
const int VID_MIN_WIDTH = 640;
|
||||
const int VID_MIN_HEIGHT = 400;
|
||||
#define NPOT_EMULATION
|
||||
#define BUILD_SKY
|
||||
|
||||
#endif //__VERSION_H__
|
||||
|
|
|
@ -313,10 +313,10 @@ void GameInterface::app_init()
|
|||
if (engineInit())
|
||||
G_FatalEngineError();
|
||||
|
||||
setupbackdrop();
|
||||
//Net_SendClientInfo();
|
||||
|
||||
initTiles();
|
||||
setupbackdrop();
|
||||
genspriteremaps();
|
||||
SetupGameButtons();
|
||||
InitCheats();
|
||||
|
|
Loading…
Reference in a new issue