From 4f8e0dd936b2eafd4704d0518d774db85324978e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 17 Oct 2019 09:42:11 +0200 Subject: [PATCH] - cleaned up a few copyright notices and unified licenses --- source/build/include/build.h | 5 -- source/common/textures/bitmap.cpp | 2 +- source/common/textures/bitmap.h | 2 +- source/common/textures/buildtiles.cpp | 27 ++++++--- source/common/textures/formats/ddstexture.cpp | 5 +- .../common/textures/formats/jpegtexture.cpp | 3 +- source/common/textures/formats/pcxtexture.cpp | 2 +- source/common/textures/formats/pngtexture.cpp | 1 + source/common/textures/formats/tgatexture.cpp | 2 +- source/glbackend/gl_samplers.cpp | 55 ++++++++++++------- source/glbackend/gl_shader.cpp | 6 -- source/glbackend/glbackend.cpp | 36 +++++++++++- 12 files changed, 97 insertions(+), 49 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 40aaf927b..3c3838839 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -961,11 +961,6 @@ Coding example #2: TILE VARIABLES: NUMTILES - the number of tiles found TILES.DAT. - TILESIZX[MAXTILES] - simply the x-dimension of the tile number. - TILESIZY[MAXTILES] - simply the y-dimension of the tile number. - WALOFF[MAXTILES] - the actual address pointing to the top-left - corner of the tile. - PICANM[MAXTILES] - flags for animating the tile. TIMING VARIABLES: TOTALCLOCK - When the engine is initialized, TOTALCLOCK is set to zero. diff --git a/source/common/textures/bitmap.cpp b/source/common/textures/bitmap.cpp index 2f786eb69..3f79318de 100644 --- a/source/common/textures/bitmap.cpp +++ b/source/common/textures/bitmap.cpp @@ -2,7 +2,7 @@ ** bitmap.cpp ** **--------------------------------------------------------------------------- -** Copyright 2008 Christoph Oelckers +** Copyright 2008-2019 Christoph Oelckers ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without diff --git a/source/common/textures/bitmap.h b/source/common/textures/bitmap.h index b5b1bb257..e20b64b5d 100644 --- a/source/common/textures/bitmap.h +++ b/source/common/textures/bitmap.h @@ -2,7 +2,7 @@ ** bitmap.h ** **--------------------------------------------------------------------------- -** Copyright 2008 Christoph Oelckers +** Copyright 2008-2019 Christoph Oelckers ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without diff --git a/source/common/textures/buildtiles.cpp b/source/common/textures/buildtiles.cpp index 736dcb6ec..eee7e8f04 100644 --- a/source/common/textures/buildtiles.cpp +++ b/source/common/textures/buildtiles.cpp @@ -59,15 +59,15 @@ BuildFiles TileFiles; // //========================================================================== -picanm_t tileConvertAnimFormat(int32_t const picanmdisk) +picanm_t tileConvertAnimFormat(int32_t const picanimraw) { // Unpack a 4 byte packed anim descriptor into the internal 5 byte format. picanm_t anm; - anm.num = picanmdisk & 63; - anm.xofs = (picanmdisk >> 8) & 255; - anm.yofs = (picanmdisk >> 16) & 255; - anm.sf = ((picanmdisk >> 24) & 15) | (picanmdisk & 192); - anm.extra = (picanmdisk >> 28) & 15; + anm.num = picanimraw & 63; + anm.xofs = (picanimraw >> 8) & 255; + anm.yofs = (picanimraw >> 16) & 255; + anm.sf = ((picanimraw >> 24) & 15) | (picanimraw & 192); + anm.extra = (picanimraw >> 28) & 15; return anm; } @@ -228,11 +228,10 @@ void BuildFiles::CloseAllMapArt() // // LoadArtFile // -// Returns the number of tiles found. Also loads all the data for -// R_InitBuildTiles() to process later. +// Returns the number of tiles found. // // let's load everything into memory on startup. -// Even for Ion Fury this will merely add 60 MB, because the engine already needs to cache the data, albeit in a compressed-per-lump form, +// Even for Ion Fury this will merely add 80 MB, because the engine already needs to cache the data, albeit in a compressed-per-lump form, // so its 100MB art file will only have a partial impact on memory. // //=========================================================================== @@ -300,6 +299,8 @@ void BuildFiles::LoadArtSet(const char* filename) // For each tile index there may only be one replacement and its // type may never change! // +// All these uses will need some review further down the line so that the texture manager's content is immutable. +// //========================================================================== FTexture* BuildFiles::ValidateCustomTile(int tilenum, int type) @@ -312,6 +313,13 @@ FTexture* BuildFiles::ValidateCustomTile(int tilenum, int type) FTexture* replacement = nullptr; if (type == FTexture::Writable) { + // Creates an empty writable tile. + // Current use cases are: + // Camera textures (should be made to be creatable by the hardware renderer instead of falling back on the software renderer.) + // thumbnails for savegame and loadgame (should bypass the texture manager entirely.) + // view tilting in the software renderer (this should just use a local buffer instead of relying on the texture manager.) + // Movie playback (like thumbnails this should bypass the texture manager entirely.) + // Blood's 'lens' effect (apparently MP only) - combination of a camera texture with a distortion map - should be made a shader effect to be applied to the camera texture. replacement = new FWritableTile; } else if (type == FTexture::Restorable) @@ -320,6 +328,7 @@ FTexture* BuildFiles::ValidateCustomTile(int tilenum, int type) // It only gets used for the crosshair and two specific effects: // A) the fire in Blood. // B) the pin display in Redneck Rampage's bowling lanes. + // All of these effects should probably be redone without actual texture hacking... if (tile->GetWidth() == 0 || tile->GetHeight() == 0) return nullptr; // The base must have a size for this to work. // todo: invalidate hardware textures for tile. replacement = new FRestorableTile(tile); diff --git a/source/common/textures/formats/ddstexture.cpp b/source/common/textures/formats/ddstexture.cpp index 42e26fc31..f8160ba94 100644 --- a/source/common/textures/formats/ddstexture.cpp +++ b/source/common/textures/formats/ddstexture.cpp @@ -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 diff --git a/source/common/textures/formats/jpegtexture.cpp b/source/common/textures/formats/jpegtexture.cpp index 2acad87b5..a8a60c0c5 100644 --- a/source/common/textures/formats/jpegtexture.cpp +++ b/source/common/textures/formats/jpegtexture.cpp @@ -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 diff --git a/source/common/textures/formats/pcxtexture.cpp b/source/common/textures/formats/pcxtexture.cpp index 6966a256a..807c1560f 100644 --- a/source/common/textures/formats/pcxtexture.cpp +++ b/source/common/textures/formats/pcxtexture.cpp @@ -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 diff --git a/source/common/textures/formats/pngtexture.cpp b/source/common/textures/formats/pngtexture.cpp index 84c272e7e..21660c8d9 100644 --- a/source/common/textures/formats/pngtexture.cpp +++ b/source/common/textures/formats/pngtexture.cpp @@ -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 diff --git a/source/common/textures/formats/tgatexture.cpp b/source/common/textures/formats/tgatexture.cpp index de5ecb90b..6a8596e72 100644 --- a/source/common/textures/formats/tgatexture.cpp +++ b/source/common/textures/formats/tgatexture.cpp @@ -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 diff --git a/source/glbackend/gl_samplers.cpp b/source/glbackend/gl_samplers.cpp index d5080ad9e..0481c9d60 100644 --- a/source/glbackend/gl_samplers.cpp +++ b/source/glbackend/gl_samplers.cpp @@ -1,24 +1,37 @@ -// -//--------------------------------------------------------------------------- -// -// Copyright(C) 2014-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/ -// -//-------------------------------------------------------------------------- -// +/* +** gl_samplers.cpp +** +** Texture sampler handling +** +**--------------------------------------------------------------------------- +** Copyright 2015-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 "glad/glad.h" #include "glbackend.h" diff --git a/source/glbackend/gl_shader.cpp b/source/glbackend/gl_shader.cpp index 88c9913bc..b3a6888d0 100644 --- a/source/glbackend/gl_shader.cpp +++ b/source/glbackend/gl_shader.cpp @@ -18,12 +18,6 @@ ** 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. -** 4. When not used as part of GZDoom or a GZDoom derivative, this code will be -** covered by the terms of the GNU Lesser General Public License as published -** by the Free Software Foundation; either version 2.1 of the License, or (at -** your option) any later version. -** 5. Full disclosure of the entire project's source code, except for third -** party libraries is mandatory. (NOTE: This clause is non-negotiable!) ** ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 6cc11ec8d..5bcbb648d 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -1,3 +1,37 @@ +/* +** glbackend.cpp +** +** OpenGL API abstraction +** +**--------------------------------------------------------------------------- +** Copyright 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 #include "glad/glad.h" #include "glbackend.h" @@ -77,7 +111,7 @@ void GLInstance::Init() catch (const std::runtime_error& err) { // This is far from an optimal solution but at this point the only way to get the error out. - wm_msgbox("Shader compilation failed", err.what()); + wm_msgbox(nullptr, "Shader compilation failed: %s", err.what()); exit(1); }