mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-07 07:21:01 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom into newtimercode4
This commit is contained in:
commit
505da5bf4f
10 changed files with 69 additions and 78 deletions
|
@ -583,7 +583,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
|
||||||
// We have a -iwad parameter. Pick the first usable IWAD we found through that.
|
// We have a -iwad parameter. Pick the first usable IWAD we found through that.
|
||||||
for (unsigned i = numFoundWads; i < mFoundWads.Size(); i++)
|
for (unsigned i = numFoundWads; i < mFoundWads.Size(); i++)
|
||||||
{
|
{
|
||||||
if (mFoundWads[i].mInfoIndex > 0)
|
if (mFoundWads[i].mInfoIndex >= 0)
|
||||||
{
|
{
|
||||||
picks.Push(mFoundWads[i]);
|
picks.Push(mFoundWads[i]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -269,7 +269,7 @@ extern int ScriptDepth;
|
||||||
|
|
||||||
inline float ParseFloat(FScanner &sc)
|
inline float ParseFloat(FScanner &sc)
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
|
|
||||||
return float(sc.Float);
|
return float(sc.Float);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ inline float ParseFloat(FScanner &sc)
|
||||||
|
|
||||||
inline int ParseInt(FScanner &sc)
|
inline int ParseInt(FScanner &sc)
|
||||||
{
|
{
|
||||||
sc.GetNumber();
|
sc.MustGetNumber();
|
||||||
|
|
||||||
return sc.Number;
|
return sc.Number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -938,7 +938,7 @@ int FGLRenderer::PTM_BestColor (const uint32_t *pal_in, int r, int g, int b, int
|
||||||
static bool firstTime = true;
|
static bool firstTime = true;
|
||||||
static float trackpowtable = 0.;
|
static float trackpowtable = 0.;
|
||||||
|
|
||||||
double fbestdist, fdist;
|
double fbestdist = DBL_MAX, fdist;
|
||||||
int bestcolor = 0;
|
int bestcolor = 0;
|
||||||
|
|
||||||
if (firstTime || trackpowtable != gl_paltonemap_powtable)
|
if (firstTime || trackpowtable != gl_paltonemap_powtable)
|
||||||
|
|
|
@ -682,6 +682,7 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump)
|
||||||
|
|
||||||
PostProcessShader shaderdesc;
|
PostProcessShader shaderdesc;
|
||||||
shaderdesc.Target = sc.String;
|
shaderdesc.Target = sc.String;
|
||||||
|
shaderdesc.Target.ToLower();
|
||||||
|
|
||||||
bool validTarget = false;
|
bool validTarget = false;
|
||||||
if (sc.Compare("beforebloom")) validTarget = true;
|
if (sc.Compare("beforebloom")) validTarget = true;
|
||||||
|
|
|
@ -265,11 +265,11 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
alpha.ShouldCycle(true);
|
alpha.ShouldCycle(true);
|
||||||
alpha.SetCycleType(ParseCycleType(sc));
|
alpha.SetCycleType(ParseCycleType(sc));
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
start = sc.Float;
|
start = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
end = sc.Float;
|
end = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
alpha.SetParams(start, end, cycle);
|
alpha.SetParams(start, end, cycle);
|
||||||
|
@ -287,11 +287,11 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
srcFactor.ShouldCycle(true);
|
srcFactor.ShouldCycle(true);
|
||||||
srcFactor.SetCycleType(ParseCycleType(sc));
|
srcFactor.SetCycleType(ParseCycleType(sc));
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
start = sc.Float;
|
start = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
end = sc.Float;
|
end = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
srcFactor.SetParams(start, end, cycle);
|
srcFactor.SetParams(start, end, cycle);
|
||||||
|
@ -309,11 +309,11 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
dstFactor.ShouldCycle(true);
|
dstFactor.ShouldCycle(true);
|
||||||
dstFactor.SetCycleType(ParseCycleType(sc));
|
dstFactor.SetCycleType(ParseCycleType(sc));
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
start = sc.Float;
|
start = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
end = sc.Float;
|
end = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
dstFactor.SetParams(start, end, cycle);
|
dstFactor.SetParams(start, end, cycle);
|
||||||
|
@ -351,23 +351,23 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
g.SetCycleType(type);
|
g.SetCycleType(type);
|
||||||
b.SetCycleType(type);
|
b.SetCycleType(type);
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r1 = float(sc.Float);
|
r1 = float(sc.Float);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g1 = float(sc.Float);
|
g1 = float(sc.Float);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
b1 = float(sc.Float);
|
b1 = float(sc.Float);
|
||||||
|
|
||||||
// get color2
|
// get color2
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r2 = float(sc.Float);
|
r2 = float(sc.Float);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g2 = float(sc.Float);
|
g2 = float(sc.Float);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
b2 = float(sc.Float);
|
b2 = float(sc.Float);
|
||||||
|
|
||||||
// get cycle time
|
// get cycle time
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
r.SetParams(r1, r2, cycle);
|
r.SetParams(r1, r2, cycle);
|
||||||
|
@ -376,11 +376,11 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r1 = float(sc.Float);
|
r1 = float(sc.Float);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g1 = sc.Float;
|
g1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
b1 = sc.Float;
|
b1 = sc.Float;
|
||||||
|
|
||||||
r.SetParams(r1, r1, 0.f);
|
r.SetParams(r1, r1, 0.f);
|
||||||
|
@ -390,9 +390,9 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else if (sc.Compare("center"))
|
else if (sc.Compare("center"))
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
centerX = sc.Float;
|
centerX = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
centerY = sc.Float;
|
centerY = sc.Float;
|
||||||
}
|
}
|
||||||
else if (sc.Compare("emissive"))
|
else if (sc.Compare("emissive"))
|
||||||
|
@ -407,17 +407,17 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
adjustX.ShouldCycle(true);
|
adjustX.ShouldCycle(true);
|
||||||
adjustY.ShouldCycle(true);
|
adjustY.ShouldCycle(true);
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r1 = sc.Float;
|
r1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r2 = sc.Float;
|
r2 = sc.Float;
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g1 = sc.Float;
|
g1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g2 = sc.Float;
|
g2 = sc.Float;
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
offsetX = r1;
|
offsetX = r1;
|
||||||
|
@ -428,9 +428,9 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
offsetX = sc.Float;
|
offsetX = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
offsetY = sc.Float;
|
offsetY = sc.Float;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,12 +447,12 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else if (sc.Compare("rotate"))
|
else if (sc.Compare("rotate"))
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
rotate = sc.Float;
|
rotate = sc.Float;
|
||||||
}
|
}
|
||||||
else if (sc.Compare("rotation"))
|
else if (sc.Compare("rotation"))
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
rotation = sc.Float;
|
rotation = sc.Float;
|
||||||
}
|
}
|
||||||
else if (sc.Compare("scale"))
|
else if (sc.Compare("scale"))
|
||||||
|
@ -462,17 +462,17 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
scaleX.ShouldCycle(true);
|
scaleX.ShouldCycle(true);
|
||||||
scaleY.ShouldCycle(true);
|
scaleY.ShouldCycle(true);
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r1 = sc.Float;
|
r1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r2 = sc.Float;
|
r2 = sc.Float;
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g1 = sc.Float;
|
g1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g2 = sc.Float;
|
g2 = sc.Float;
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
scaleX.SetParams(r1, g1, cycle);
|
scaleX.SetParams(r1, g1, cycle);
|
||||||
|
@ -480,9 +480,9 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
scaleX.SetParams(sc.Float, sc.Float, 0.f);
|
scaleX.SetParams(sc.Float, sc.Float, 0.f);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
scaleY.SetParams(sc.Float, sc.Float, 0.f);
|
scaleY.SetParams(sc.Float, sc.Float, 0.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,15 +510,15 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
vectorX.ShouldCycle(true);
|
vectorX.ShouldCycle(true);
|
||||||
vectorY.ShouldCycle(true);
|
vectorY.ShouldCycle(true);
|
||||||
|
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r1 = sc.Float;
|
r1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g1 = sc.Float;
|
g1 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
r2 = sc.Float;
|
r2 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
g2 = sc.Float;
|
g2 = sc.Float;
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
cycle = sc.Float;
|
cycle = sc.Float;
|
||||||
|
|
||||||
vectorX.SetParams(r1, r2, cycle);
|
vectorX.SetParams(r1, r2, cycle);
|
||||||
|
@ -526,9 +526,9 @@ bool FShaderLayer::ParseLayer(FScanner &sc)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
vectorX.SetParams(sc.Float, sc.Float, 0.f);
|
vectorX.SetParams(sc.Float, sc.Float, 0.f);
|
||||||
sc.GetFloat();
|
sc.MustGetFloat();
|
||||||
vectorY.SetParams(sc.Float, sc.Float, 0.f);
|
vectorY.SetParams(sc.Float, sc.Float, 0.f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,7 +564,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
|
||||||
else sc.UnGet();
|
else sc.UnGet();
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
FTextureID no = TexMan.CheckForTexture(sc.String, type);
|
FTextureID no = TexMan.CheckForTexture(sc.String, type, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_Overridable);
|
||||||
FTexture *tex = TexMan[no];
|
FTexture *tex = TexMan[no];
|
||||||
|
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
|
|
|
@ -57,18 +57,17 @@ bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
|
||||||
double thingxscalemul = spriteScale.X / tex->Scale.X;
|
double thingxscalemul = spriteScale.X / tex->Scale.X;
|
||||||
double thingyscalemul = spriteScale.Y / tex->Scale.Y;
|
double thingyscalemul = spriteScale.Y / tex->Scale.Y;
|
||||||
|
|
||||||
if (flipTextureX)
|
double spriteWidth = thingxscalemul * tex->GetWidth();
|
||||||
pos.X -= (tex->GetWidth() - tex->LeftOffset) * thingxscalemul;
|
|
||||||
else
|
|
||||||
pos.X -= tex->LeftOffset * thingxscalemul;
|
|
||||||
|
|
||||||
double spriteHalfWidth = thingxscalemul * tex->GetWidth() * 0.5;
|
|
||||||
double spriteHeight = thingyscalemul * tex->GetHeight();
|
double spriteHeight = thingyscalemul * tex->GetHeight();
|
||||||
|
|
||||||
pos.X += spriteHalfWidth;
|
double offsetX;
|
||||||
|
if (flipTextureX)
|
||||||
|
offsetX = (tex->GetWidth() - tex->LeftOffset) * thingxscalemul;
|
||||||
|
else
|
||||||
|
offsetX = tex->LeftOffset * thingxscalemul;
|
||||||
|
|
||||||
left = DVector2(pos.X - viewpoint.Sin * spriteHalfWidth, pos.Y + viewpoint.Cos * spriteHalfWidth);
|
left = DVector2(pos.X - viewpoint.Sin * offsetX, pos.Y + viewpoint.Cos * offsetX);
|
||||||
right = DVector2(pos.X + viewpoint.Sin * spriteHalfWidth, pos.Y - viewpoint.Cos * spriteHalfWidth);
|
right = DVector2(left.X + viewpoint.Sin * spriteWidth, left.Y - viewpoint.Cos * spriteWidth);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,36 +80,26 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const TriMatrix &worldTo
|
||||||
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
|
const auto &viewpoint = PolyRenderer::Instance()->Viewpoint;
|
||||||
DVector3 thingpos = thing->InterpolatedPosition(viewpoint.TicFrac);
|
DVector3 thingpos = thing->InterpolatedPosition(viewpoint.TicFrac);
|
||||||
|
|
||||||
DVector3 pos = thingpos;
|
double posZ = thingpos.Z;
|
||||||
|
|
||||||
uint32_t spritetype = (thing->renderflags & RF_SPRITETYPEMASK);
|
uint32_t spritetype = (thing->renderflags & RF_SPRITETYPEMASK);
|
||||||
|
|
||||||
if (spritetype == RF_FACESPRITE)
|
if (spritetype == RF_FACESPRITE)
|
||||||
pos.Z -= thing->Floorclip;
|
posZ -= thing->Floorclip;
|
||||||
|
|
||||||
if (thing->flags2 & MF2_FLOATBOB)
|
if (thing->flags2 & MF2_FLOATBOB)
|
||||||
pos.Z += thing->GetBobOffset(viewpoint.TicFrac);
|
posZ += thing->GetBobOffset(viewpoint.TicFrac);
|
||||||
|
|
||||||
bool flipTextureX = false;
|
bool flipTextureX = false;
|
||||||
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
FTexture *tex = GetSpriteTexture(thing, flipTextureX);
|
||||||
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
|
if (tex == nullptr || tex->UseType == FTexture::TEX_Null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DVector2 spriteScale = thing->Scale;
|
double thingyscalemul = thing->Scale.Y / tex->Scale.Y;
|
||||||
double thingxscalemul = spriteScale.X / tex->Scale.X;
|
|
||||||
double thingyscalemul = spriteScale.Y / tex->Scale.Y;
|
|
||||||
double spriteHalfWidth = thingxscalemul * tex->GetWidth() * 0.5;
|
|
||||||
double spriteHeight = thingyscalemul * tex->GetHeight();
|
double spriteHeight = thingyscalemul * tex->GetHeight();
|
||||||
|
|
||||||
if (flipTextureX)
|
posZ -= (tex->GetHeight() - tex->TopOffset) * thingyscalemul;
|
||||||
pos.X -= (tex->GetWidth() - tex->LeftOffset) * thingxscalemul;
|
posZ = PerformSpriteClipAdjustment(thing, thingpos, spriteHeight, posZ);
|
||||||
else
|
|
||||||
pos.X -= tex->LeftOffset * thingxscalemul;
|
|
||||||
|
|
||||||
pos.X += spriteHalfWidth;
|
|
||||||
|
|
||||||
pos.Z -= (tex->GetHeight() - tex->TopOffset) * thingyscalemul;
|
|
||||||
pos.Z = PerformSpriteClipAdjustment(thing, thingpos, spriteHeight, pos.Z);
|
|
||||||
|
|
||||||
//double depth = 1.0;
|
//double depth = 1.0;
|
||||||
//visstyle_t visstyle = GetSpriteVisStyle(thing, depth);
|
//visstyle_t visstyle = GetSpriteVisStyle(thing, depth);
|
||||||
|
@ -142,7 +131,7 @@ void RenderPolySprite::Render(PolyRenderThread *thread, const TriMatrix &worldTo
|
||||||
|
|
||||||
vertices[i].x = (float)p.X;
|
vertices[i].x = (float)p.X;
|
||||||
vertices[i].y = (float)p.Y;
|
vertices[i].y = (float)p.Y;
|
||||||
vertices[i].z = (float)(pos.Z + spriteHeight * offsets[i].second);
|
vertices[i].z = (float)(posZ + spriteHeight * offsets[i].second);
|
||||||
vertices[i].w = 1.0f;
|
vertices[i].w = 1.0f;
|
||||||
vertices[i].u = (float)(offsets[i].first * tex->Scale.X);
|
vertices[i].u = (float)(offsets[i].first * tex->Scale.X);
|
||||||
vertices[i].v = (float)((1.0f - offsets[i].second) * tex->Scale.Y);
|
vertices[i].v = (float)((1.0f - offsets[i].second) * tex->Scale.Y);
|
||||||
|
|
|
@ -699,9 +699,9 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
||||||
is32bit = !!sc.Compare("force32bit");
|
is32bit = !!sc.Compare("force32bit");
|
||||||
if (!is32bit) sc.UnGet();
|
if (!is32bit) sc.UnGet();
|
||||||
|
|
||||||
sc.GetNumber();
|
sc.MustGetNumber();
|
||||||
width = sc.Number;
|
width = sc.Number;
|
||||||
sc.GetNumber();
|
sc.MustGetNumber();
|
||||||
height = sc.Number;
|
height = sc.Number;
|
||||||
|
|
||||||
if (lumpnum>=0)
|
if (lumpnum>=0)
|
||||||
|
|
|
@ -651,6 +651,7 @@ struct TVector3
|
||||||
TVector3 &operator ^= (const TVector3 &other)
|
TVector3 &operator ^= (const TVector3 &other)
|
||||||
{
|
{
|
||||||
*this = *this ^ other;
|
*this = *this ^ other;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1223,7 +1223,7 @@ void D3DFB::Flip()
|
||||||
{
|
{
|
||||||
RECT box;
|
RECT box;
|
||||||
GetClientRect(Window, &box);
|
GetClientRect(Window, &box);
|
||||||
if (box.right > 0 && box.right > 0 && (Width != box.right || Height != box.bottom))
|
if (box.right > 0 && box.bottom > 0 && (Width != box.right || Height != box.bottom))
|
||||||
{
|
{
|
||||||
Resize(box.right, box.bottom);
|
Resize(box.right, box.bottom);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue