- backend sync with Raze

Mostly code reformatting plus license and copyright adjustments
This commit is contained in:
Christoph Oelckers 2020-05-26 22:59:50 +02:00
parent 4881ec257a
commit c892fb1ddb
18 changed files with 126 additions and 98 deletions

View file

@ -45,7 +45,7 @@ F2DDrawer* twod = &drawer;
EXTERN_CVAR(Float, transsouls)
CVAR(Float, classic_scaling_factor, 1.0, CVAR_ARCHIVE)
CVAR(Float, classic_scaling_pixelaspect, 1.2, CVAR_ARCHIVE)
CVAR(Float, classic_scaling_pixelaspect, 1.2f, CVAR_ARCHIVE)
IMPLEMENT_CLASS(DShape2DTransform, false, false)

View file

@ -3,6 +3,7 @@
#include "v_video.h"
#include "s_soundinternal.h"
#include "texturemanager.h"
#include "palutil.h"
void JitCompiler::EmitMOVE()
{

View file

@ -42,6 +42,7 @@
#include "types.h"
#include "basics.h"
#include "texturemanager.h"
#include "palutil.h"
extern cycle_t VMCycles[10];
extern int VMCalls[10];

View file

@ -1,9 +1,10 @@
/*
** pngtexture.cpp
** ddstexture.cpp
** Texture class for DDS images
**
**---------------------------------------------------------------------------
** Copyright 2006-2007 Randy Heit
** Copyright 2006-2016 Randy Heit
** Copyright 2006-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without

View file

@ -3,7 +3,8 @@
** Texture class for JPEG images
**
**---------------------------------------------------------------------------
** Copyright 2006-2007 Randy Heit
** Copyright 2005-2016 Randy Heit
** Copyright 2005-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without

View file

@ -4,7 +4,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2005 David HENRY
** Copyright 2006 Christoph Oelckers
** Copyright 2006-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without

View file

@ -4,6 +4,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2004-2007 Randy Heit
** Copyright 2005-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -34,7 +35,6 @@
*/
#include "files.h"
#include "filesystem.h"
#include "templates.h"
#include "m_png.h"
#include "bitmap.h"
@ -42,6 +42,7 @@
#include "image.h"
#include "printf.h"
#include "texturemanager.h"
#include "filesystem.h"
//==========================================================================
//
@ -640,7 +641,7 @@ class FPNGFileTexture : public FTexture
{
public:
FPNGFileTexture (FileReader &lump, int width, int height, uint8_t colortype);
virtual FBitmap GetBgraBitmap(const PalEntry *remap, int *trans);
virtual FBitmap GetBgraBitmap(const PalEntry *remap, int *trans) override;
protected:
@ -721,7 +722,7 @@ FBitmap FPNGFileTexture::GetBgraBitmap(const PalEntry *remap, int *trans)
lump->Seek (len, FileReader::SeekCur);
else
{
PaletteSize = MIN<int> (len / 3, 256);
PaletteSize = std::min<int> (len / 3, 256);
for(int i = 0; i < PaletteSize; i++)
{
pe[i].r = lump->ReadUInt8();

View file

@ -3,7 +3,7 @@
** Texture class for TGA images
**
**---------------------------------------------------------------------------
** Copyright 2006 Christoph Oelckers
** Copyright 2006-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without

View file

@ -108,6 +108,8 @@ class FGameTexture
public:
float alphaThreshold = 0.5f;
FGameTexture(FTexture* wrap, const char *name);
~FGameTexture();
void Setup(FTexture* wrap);
@ -253,6 +255,13 @@ public:
LeftOffset[which] = x;
TopOffset[which] = y;
}
void SetOffsets(int x, int y)
{
LeftOffset[0] = x;
TopOffset[0] = y;
LeftOffset[1] = x;
TopOffset[1] = y;
}
void SetScale(float x, float y)
{
ScaleX = x;

View file

@ -59,9 +59,15 @@ private:
TArray<TranslatedTexture> hwTex_Translated;
TranslatedTexture * GetTexID(int translation, int scaleflags)
{
// Allow negative indices to pass through unchanged.
// This is needed for allowing the client to allocate slots that aren't matched to a palette, e.g. Build's indexed variants.
if (translation >= 0)
{
auto remap = GPalette.TranslationToTable(translation);
translation = remap == nullptr ? 0 : remap->Index;
}
else translation &= ~0x7fffffff;
if (translation == 0 && !(scaleflags & CTF_Upscale))
{

View file

@ -147,5 +147,4 @@ namespace ImageHelpers
}
}
}
}

View file

@ -873,7 +873,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
for (int i = BuiltTextures.Size()-1; i>= 0; i--)
{
auto &buildinfo = BuiltTextures[i];
bool hasEmpty = false;
for (unsigned j = 0; j < buildinfo.Inits.Size(); j++)

View file

@ -1,24 +1,35 @@
//
//---------------------------------------------------------------------------
//
// Copyright(C) 2004-2016 Christoph Oelckers
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//--------------------------------------------------------------------------
//
/*
** skyboxtexture.cpp
**
**---------------------------------------------------------------------------
** Copyright 2004-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "filesystem.h"
#include "textures.h"

View file

@ -378,6 +378,7 @@ FTextureBuffer FTexture::CreateTexBuffer(int translation, int flags)
if (GetImage() && flags & CTF_ProcessData)
{
if (flags & CTF_Upscale) CreateUpsampledTextureBuffer(result, !!isTransparent, checkonly);
if (!checkonly) ProcessData(result.mBuffer, result.mWidth, result.mHeight, false);
}
@ -539,4 +540,3 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
SystemTextures.AddHardwareTexture(0, false, hwtex);
}

View file

@ -625,7 +625,6 @@ void FTextureManager::AddHiresTextures (int wadnum)
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
gtex->SetWorldPanning(true);
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY()));
ReplaceTexture(tlist[i], gtex, true);

View file

@ -3,7 +3,7 @@
**
**---------------------------------------------------------------------------
** Copyright 2005-2016 Randy Heit
** Copyright 2005-2016 Christoph Oelckers
** Copyright 2005-2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
@ -203,8 +203,9 @@ class FTexture : public RefCountedBase
{
friend class FGameTexture; // only for the porting work
protected:
public:
FHardwareTextureContainer SystemTextures;
protected:
FloatRect* areas = nullptr;
int SourceLump;
uint16_t Width = 0, Height = 0;
@ -250,7 +251,6 @@ public:
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
bool FindHoles(const unsigned char * buffer, int w, int h);
void CopySize(FTexture* BaseTexture)
{
Width = BaseTexture->GetWidth();