mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-03-25 19:10:49 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom
# Conflicts: # src/CMakeLists.txt
This commit is contained in:
commit
59511fe228
83 changed files with 4959 additions and 966 deletions
27
docs/licenses/README.TXT
Normal file
27
docs/licenses/README.TXT
Normal file
|
@ -0,0 +1,27 @@
|
|||
The original Doom source code was released by id Software under the
|
||||
Doom Source Code License. See doomlic.txt.
|
||||
|
||||
Parts of the renderer use code from the BUILD engine by Ken Silverman.
|
||||
See buildlic.txt.
|
||||
|
||||
The majority of original code uses a BSD-like lincese. See bsd.txt.
|
||||
|
||||
This software is based in part on the work of the Independent JPEG Group.
|
||||
|
||||
This software uses the 'zlib' general purpose compression library by
|
||||
Jean-loup Gailly and Mark Adler.
|
||||
|
||||
This software uses the gdtoa package, see gdtoa.txt.
|
||||
|
||||
This software uses the snes_spc library, which is covered by the GNU Lesser
|
||||
General Public License. See lgpl.txt.
|
||||
|
||||
This software uses the "Dynamic Universal Music Bibliotheque" library for
|
||||
MOD music playback. See dumb.txt for original license. The version used,
|
||||
however, has been heavily modified from its original form and is the same
|
||||
version used by the foobar2000 component foo_dumb as of mid-2008, found at
|
||||
http://kode54.foobar2000.org/.
|
||||
|
||||
This software uses the OPL emulator from MAME 0.95. Playback of MUS files
|
||||
on the OPL emulation is accomplished with some help from Vladimir Arnost's
|
||||
MUS File Player Library, with fixes to make it more accurate.
|
27
docs/licenses/bsd.txt
Normal file
27
docs/licenses/bsd.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2009 Randy Heit, Christoph Oelckers, et al.
|
||||
** 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.
|
||||
**---------------------------------------------------------------------------
|
71
docs/licenses/buildlic.txt
Normal file
71
docs/licenses/buildlic.txt
Normal file
|
@ -0,0 +1,71 @@
|
|||
BUILD SOURCE CODE LICENSE TERMS: 06/20/2000
|
||||
|
||||
[1] I give you permission to make modifications to my Build source and
|
||||
distribute it, BUT:
|
||||
|
||||
[2] Any derivative works based on my Build source may be distributed ONLY
|
||||
through the INTERNET.
|
||||
|
||||
[3] Distribution of any derivative works MUST be done completely FREE of
|
||||
charge - no commercial exploitation whatsoever.
|
||||
|
||||
[4] Anything you distribute which uses a part of my Build Engine source
|
||||
code MUST include:
|
||||
|
||||
[A] The following message somewhere in the archive:
|
||||
|
||||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
|
||||
[B] This text file "BUILDLIC.TXT" along with it.
|
||||
|
||||
[C] Any source files that you modify must include this message as well:
|
||||
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
|
||||
[5] The use of the Build Engine for commercial purposes will require an
|
||||
appropriate license arrangement with me. Contact information is
|
||||
on my web site.
|
||||
|
||||
[6] I take no responsibility for damage to your system.
|
||||
|
||||
[7] Technical support: Before contacting me with questions, please read
|
||||
and do ALL of the following!
|
||||
|
||||
[A] Look though ALL of my text files. There are 7 of them (including this
|
||||
one). I like to think that I wrote them for a reason. You will find
|
||||
many of your answers in the history section of BUILD.TXT and
|
||||
BUILD2.TXT (they're located inside SRC.ZIP).
|
||||
|
||||
[B] If that doesn't satisfy you, then try going to:
|
||||
|
||||
"http://www.advsys.net/ken/buildsrc"
|
||||
|
||||
where I will maintain a Build Source Code FAQ (or perhaps I might
|
||||
just provide a link to a good FAQ).
|
||||
|
||||
[C] I am willing to respond to questions, but ONLY if they come at a rate
|
||||
that I can handle.
|
||||
|
||||
PLEASE TRY TO AVOID ASKING DUPLICATE QUESTIONS!
|
||||
|
||||
As my line of defense, I will post my current policy about
|
||||
answering Build source questions (right below the E-mail address
|
||||
on my web site.) You can check there to see if I'm getting
|
||||
overloaded with questions or not.
|
||||
|
||||
If I'm too busy, it might say something like this:
|
||||
|
||||
I'm too busy to answer Build source questions right now.
|
||||
Sorry, but don't expect a reply from me any time soon.
|
||||
|
||||
If I'm open for Build source questions, please state your question
|
||||
clearly and don't include any unsolicited attachments unless
|
||||
they're really small (like less than 50k). Assume that I have
|
||||
a 28.8k modem. Also, don't leave out important details just
|
||||
to make your question appear shorter - making me guess what
|
||||
you're asking doesn't save me time!
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-Ken S. (official web site: http://www.advsys.net/ken)
|
10
docs/licenses/cephes.txt
Normal file
10
docs/licenses/cephes.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
Some software in this archive may be from the book _Methods and
|
||||
Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster
|
||||
International, 1989) or from the Cephes Mathematical Library, a
|
||||
commercial product. In either event, it is copyrighted by the author.
|
||||
What you see here may be used freely but it comes with no support or
|
||||
guarantee.
|
||||
|
||||
Stephen L. Moshier
|
||||
moshier@na-net.ornl.gov
|
||||
|
112
docs/licenses/doomlic.txt
Normal file
112
docs/licenses/doomlic.txt
Normal file
|
@ -0,0 +1,112 @@
|
|||
|
||||
|
||||
LIMITED USE SOFTWARE LICENSE AGREEMENT
|
||||
|
||||
This Limited Use Software License Agreement (the "Agreement")
|
||||
is a legal agreement between you, the end-user, and Id Software, Inc.
|
||||
("ID"). By downloading or purchasing the software material, which
|
||||
includes source code (the "Source Code"), artwork data, music and
|
||||
software tools (collectively, the "Software"), you are agreeing to
|
||||
be bound by the terms of this Agreement. If you do not agree to the
|
||||
terms of this Agreement, promptly destroy the Software you may have
|
||||
downloaded or copied.
|
||||
|
||||
ID SOFTWARE LICENSE
|
||||
|
||||
1. Grant of License. ID grants to you the right to use the
|
||||
Software. You have no ownership or proprietary rights in or to the
|
||||
Software, or the Trademark. For purposes of this section, "use" means
|
||||
loading the Software into RAM, as well as installation on a hard disk
|
||||
or other storage device. The Software, together with any archive copy
|
||||
thereof, shall be destroyed when no longer used in accordance with
|
||||
this Agreement, or when the right to use the Software is terminated.
|
||||
You agree that the Software will not be shipped, transferred or
|
||||
exported into any country in violation of the U.S. Export
|
||||
Administration Act (or any other law governing such matters) and that
|
||||
you will not utilize, in any other manner, the Software in violation
|
||||
of any applicable law.
|
||||
|
||||
2. Permitted Uses. For educational purposes only, you, the
|
||||
end-user, may use portions of the Source Code, such as particular
|
||||
routines, to develop your own software, but may not duplicate the
|
||||
Source Code, except as noted in paragraph 4. The limited right
|
||||
referenced in the preceding sentence is hereinafter referred to as
|
||||
"Educational Use." By so exercising the Educational Use right you
|
||||
shall not obtain any ownership, copyright, proprietary or other
|
||||
interest in or to the Source Code, or any portion of the Source
|
||||
Code. You may dispose of your own software in your sole discretion.
|
||||
With the exception of the Educational Use right, you may not
|
||||
otherwise use the Software, or an portion of the Software, which
|
||||
includes the Source Code, for commercial gain.
|
||||
|
||||
3. Prohibited Uses: Under no circumstances shall you, the
|
||||
end-user, be permitted, allowed or authorized to commercially exploit
|
||||
the Software. Neither you nor anyone at your direction shall do any
|
||||
of the following acts with regard to the Software, or any portion
|
||||
thereof:
|
||||
|
||||
Rent;
|
||||
|
||||
Sell;
|
||||
|
||||
Lease;
|
||||
|
||||
Offer on a pay-per-play basis;
|
||||
|
||||
Distribute for money or any other consideration; or
|
||||
|
||||
In any other manner and through any medium whatsoever
|
||||
commercially exploit or use for any commercial purpose.
|
||||
|
||||
Notwithstanding the foregoing prohibitions, you may commercially
|
||||
exploit the software you develop by exercising the Educational Use
|
||||
right, referenced in paragraph 2. hereinabove.
|
||||
|
||||
4. Copyright. The Software and all copyrights related thereto
|
||||
(including all characters and other images generated by the Software
|
||||
or depicted in the Software) are owned by ID and is protected by
|
||||
United States copyright laws and international treaty provisions.
|
||||
Id shall retain exclusive ownership and copyright in and to the
|
||||
Software and all portions of the Software and you shall have no
|
||||
ownership or other proprietary interest in such materials. You must
|
||||
treat the Software like any other copyrighted material. You may not
|
||||
otherwise reproduce, copy or disclose to others, in whole or in any
|
||||
part, the Software. You may not copy the written materials
|
||||
accompanying the Software. You agree to use your best efforts to
|
||||
see that any user of the Software licensed hereunder complies with
|
||||
this Agreement.
|
||||
|
||||
5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT
|
||||
TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
|
||||
RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO
|
||||
JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
|
||||
WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS.
|
||||
THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS
|
||||
WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
|
||||
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE
|
||||
MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF
|
||||
OF ID.
|
||||
|
||||
Exclusive Remedies. The Software is being offered to you
|
||||
free of any charge. You agree that you have no remedy against ID, its
|
||||
affiliates, contractors, suppliers, and agents for loss or damage
|
||||
caused by any defect or failure in the Software regardless of the form
|
||||
of action, whether in contract, tort, includinegligence, strict
|
||||
liability or otherwise, with regard to the Software. This Agreement
|
||||
shall be construed in accordance with and governed by the laws of the
|
||||
State of Texas. Copyright and other proprietary matters will be
|
||||
governed by United States laws and international treaties. IN ANY
|
||||
CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST
|
||||
SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
|
||||
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
|
||||
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
|
||||
OTHER PARTY. Some jurisdictions do not allow the exclusion or
|
||||
limitation of incidental or consequential damages, so the above
|
||||
limitation or exclusion may not apply to you.
|
||||
|
||||
|
||||
|
||||
|
54
docs/licenses/dumb.txt
Normal file
54
docs/licenses/dumb.txt
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* _______ ____ __ ___ ___
|
||||
* \ _ \ \ / \ / \ \ / / ' ' '
|
||||
* | | \ \ | | || | \/ | . .
|
||||
* | | | | | | || ||\ /| |
|
||||
* | | | | | | || || \/ | | ' ' '
|
||||
* | | | | | | || || | | . .
|
||||
* | |_/ / \ \__// || | |
|
||||
* /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
|
||||
* / \
|
||||
* / . \
|
||||
* licence.txt - Conditions for use of DUMB. / / \ \
|
||||
* | < / \_
|
||||
* If you do not agree to these terms, please | \/ /\ /
|
||||
* do not use DUMB. \_ / > /
|
||||
* | \ / /
|
||||
* Information in [brackets] is provided to aid | ' /
|
||||
* interpretation of the licence. \__/
|
||||
*/
|
||||
|
||||
|
||||
Dynamic Universal Music Bibliotheque
|
||||
|
||||
Copyright (C) 2001-2003 Ben Davis, Robert J Ohannessian and Julien Cugniere
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event shall the authors be held liable for any damages arising from the
|
||||
use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim
|
||||
that you wrote the original software. If you use this software in a
|
||||
product, you are requested to acknowledge its use in the product
|
||||
documentation, along with details on where to get an unmodified version of
|
||||
this software, but this is not a strict requirement.
|
||||
|
||||
[Note that the above point asks for a link to DUMB, not just a mention.
|
||||
Googling for DUMB doesn't help much! The URL is "http://dumb.sf.net/".]
|
||||
|
||||
[The only reason why the link is not strictly required is that such a
|
||||
requirement prevents DUMB from being used in projects with certain other
|
||||
licences, notably the GPL. See http://www.gnu.org/philosophy/bsd.html .]
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed from or altered in any source distribution.
|
||||
|
||||
4. If you are using the Program in someone else's bedroom at any Monday
|
||||
3:05 PM, you are not allowed to modify the Program for ten minutes. [This
|
||||
clause provided by Inphernic; every licence should contain at least one
|
||||
clause, the reasoning behind which is far from obvious.]
|
27
docs/licenses/gdtoa.txt
Normal file
27
docs/licenses/gdtoa.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
/****************************************************************
|
||||
|
||||
The author of this software is David M. Gay.
|
||||
|
||||
Copyright (C) 1998 by Lucent Technologies
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of Lucent or any of its entities
|
||||
not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
||||
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
|
||||
****************************************************************/
|
504
docs/licenses/lgpl.txt
Normal file
504
docs/licenses/lgpl.txt
Normal file
|
@ -0,0 +1,504 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library 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 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
BIN
docs/licenses/xBRZ.jpg
Normal file
BIN
docs/licenses/xBRZ.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
|
@ -48,49 +48,59 @@ if( WIN32 )
|
|||
|
||||
add_definitions( -D_WIN32 )
|
||||
|
||||
find_path( D3D_INCLUDE_DIR d3d9.h
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Include )
|
||||
if( NOT D3D_INCLUDE_DIR )
|
||||
message( SEND_ERROR "Could not find DirectX 9 header files" )
|
||||
else()
|
||||
include_directories( ${D3D_INCLUDE_DIR} )
|
||||
endif()
|
||||
if( NOT MSVC )
|
||||
find_path( D3D_INCLUDE_DIR d3d9.h
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Include )
|
||||
if( NOT D3D_INCLUDE_DIR )
|
||||
message( SEND_ERROR "Could not find DirectX 9 header files" )
|
||||
else()
|
||||
include_directories( ${D3D_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
find_path( XINPUT_INCLUDE_DIR xinput.h
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Include )
|
||||
if( NOT XINPUT_INCLUDE_DIR )
|
||||
message( WARNING "Could not find xinput.h. XInput will be disabled." )
|
||||
add_definitions( -DNO_XINPUT )
|
||||
find_path( XINPUT_INCLUDE_DIR xinput.h
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Include )
|
||||
if( NOT XINPUT_INCLUDE_DIR )
|
||||
message( WARNING "Could not find xinput.h. XInput will be disabled." )
|
||||
add_definitions( -DNO_XINPUT )
|
||||
else()
|
||||
include_directories( ${XINPUT_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
find_library( DX_dxguid_LIBRARY dxguid
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Lib Lib/${XBITS} )
|
||||
find_library( DX_dinput8_LIBRARY dinput8
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Lib Lib/${XBITS} )
|
||||
|
||||
set( DX_LIBS_FOUND YES )
|
||||
if( NOT DX_dxguid_LIBRARY )
|
||||
set( DX_LIBS_FOUND NO )
|
||||
endif()
|
||||
if( NOT DX_dinput8_LIBRARY )
|
||||
set( DX_LIBS_FOUND NO )
|
||||
endif()
|
||||
|
||||
if( NOT DX_LIBS_FOUND )
|
||||
message( FATAL_ERROR "Could not find DirectX 9 libraries" )
|
||||
endif()
|
||||
|
||||
set( DX_LIBS
|
||||
"${DX_dxguid_LIBRARY}"
|
||||
"${DX_dinput8_LIBRARY}"
|
||||
)
|
||||
else()
|
||||
include_directories( ${XINPUT_INCLUDE_DIR} )
|
||||
set( DX_LIBS
|
||||
dxguid
|
||||
dinput8
|
||||
)
|
||||
endif()
|
||||
|
||||
find_library( DX_dxguid_LIBRARY dxguid
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Lib Lib/${XBITS} )
|
||||
find_library( DX_dinput8_LIBRARY dinput8
|
||||
PATHS ENV DXSDK_DIR
|
||||
PATH_SUFFIXES Lib Lib/${XBITS} )
|
||||
|
||||
set( DX_LIBS_FOUND YES )
|
||||
if( NOT DX_dxguid_LIBRARY )
|
||||
set( DX_LIBS_FOUND NO )
|
||||
endif()
|
||||
if( NOT DX_dinput8_LIBRARY )
|
||||
set( DX_LIBS_FOUND NO )
|
||||
endif()
|
||||
|
||||
if( NOT DX_LIBS_FOUND )
|
||||
message( FATAL_ERROR "Could not find DirectX 9 libraries" )
|
||||
endif()
|
||||
|
||||
set( ZDOOM_LIBS
|
||||
set( ZDOOM_LIBS ${DX_LIBS}
|
||||
wsock32
|
||||
winmm
|
||||
"${DX_dxguid_LIBRARY}"
|
||||
"${DX_dinput8_LIBRARY}"
|
||||
ole32
|
||||
user32
|
||||
gdi32
|
||||
|
@ -417,6 +427,7 @@ set( PLAT_WIN32_SOURCES
|
|||
win32/i_main.cpp
|
||||
win32/i_movie.cpp
|
||||
win32/i_system.cpp
|
||||
win32/i_specialpaths.cpp
|
||||
win32/st_start.cpp
|
||||
win32/win32gliface.cpp
|
||||
win32/win32video.cpp )
|
||||
|
@ -436,8 +447,11 @@ set( PLAT_SDL_SOURCES
|
|||
posix/sdl/sdlvideo.cpp
|
||||
posix/sdl/sdlglvideo.cpp
|
||||
posix/sdl/st_start.cpp )
|
||||
set( PLAT_UNIX_SOURCES
|
||||
posix/unix/i_specialpaths.cpp )
|
||||
set( PLAT_OSX_SOURCES
|
||||
posix/osx/iwadpicker_cocoa.mm
|
||||
posix/osx/i_specialpaths.mm
|
||||
posix/osx/zdoom.icns )
|
||||
set( PLAT_COCOA_SOURCES
|
||||
posix/cocoa/critsec.cpp
|
||||
|
@ -454,7 +468,7 @@ set( PLAT_COCOA_SOURCES
|
|||
if( WIN32 )
|
||||
set( SYSTEM_SOURCES_DIR win32 )
|
||||
set( SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
|
||||
if( ZD_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE )
|
||||
# CMake is not set up to compile and link rc files with GCC. :(
|
||||
|
@ -469,12 +483,12 @@ elseif( APPLE )
|
|||
if( OSX_COCOA_BACKEND )
|
||||
set( SYSTEM_SOURCES_DIR posix posix/cocoa )
|
||||
set( SYSTEM_SOURCES ${PLAT_COCOA_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
else()
|
||||
set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_SDL_SOURCES} )
|
||||
set( PLAT_OSX_SOURCES ${PLAT_OSX_SOURCES} posix/sdl/i_system.mm )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_COCOA_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
endif()
|
||||
|
||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} )
|
||||
|
@ -483,7 +497,7 @@ elseif( APPLE )
|
|||
set_source_files_properties( posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
|
||||
else()
|
||||
set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
||||
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} )
|
||||
set( SYSTEM_SOURCES ${PLAT_POSIX_SOURCES} ${PLAT_SDL_SOURCES} ${PLAT_UNIX_SOURCES} )
|
||||
set( OTHER_SYSTEM_SOURCES ${PLAT_WIN32_SOURCES} ${PLAT_OSX_SOURCES} ${PLAT_COCOA_SOURCES} )
|
||||
endif()
|
||||
|
||||
|
@ -587,6 +601,7 @@ file( GLOB HEADER_FILES
|
|||
gl/dynlights/*.h
|
||||
gl/hqnx/*.h
|
||||
gl/hqnx_asm/*.h
|
||||
gl/xbr/*.h
|
||||
gl/models/*.h
|
||||
gl/renderer/*.h
|
||||
gl/scene/*.h
|
||||
|
@ -781,6 +796,8 @@ set( FASTMATH_SOURCES
|
|||
gl/hqnx/hq2x.cpp
|
||||
gl/hqnx/hq3x.cpp
|
||||
gl/hqnx/hq4x.cpp
|
||||
gl/xbr/xbrz.cpp
|
||||
gl/xbr/xbrz_old.cpp
|
||||
gl/textures/gl_hwtexture.cpp
|
||||
gl/textures/gl_texture.cpp
|
||||
gl/textures/gl_material.cpp
|
||||
|
@ -823,6 +840,7 @@ set( FASTMATH_SOURCES
|
|||
gl/shaders/gl_presentshader.cpp
|
||||
gl/shaders/gl_bloomshader.cpp
|
||||
gl/shaders/gl_blurshader.cpp
|
||||
gl/shaders/gl_colormapshader.cpp
|
||||
gl/shaders/gl_tonemapshader.cpp
|
||||
gl/shaders/gl_lensshader.cpp
|
||||
gl/system/gl_interface.cpp
|
||||
|
@ -1091,7 +1109,6 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
|
|||
${FASTMATH_SOURCES}
|
||||
${PCH_SOURCES}
|
||||
x86.cpp
|
||||
m_specialpaths.cpp
|
||||
strnatcmp.c
|
||||
zstring.cpp
|
||||
math/asin.c
|
||||
|
@ -1225,7 +1242,8 @@ source_group("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/
|
|||
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")
|
||||
source_group("OpenGL Renderer\\Dynamic Lights" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/dynlights/.+")
|
||||
source_group("OpenGL Renderer\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx/.+")
|
||||
source_group("OpenGL Renderer\\HQ Resize Assembly version" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
|
||||
source_group("OpenGL Renderer\\HQ Resize MMX version" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
|
||||
source_group("OpenGL Renderer\\XBRZ" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/hqnx_asm/.+")
|
||||
source_group("OpenGL Renderer\\Models" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/models/.+")
|
||||
source_group("OpenGL Renderer\\Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/renderer/.+")
|
||||
source_group("OpenGL Renderer\\Scene" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/scene/.+")
|
||||
|
@ -1244,6 +1262,7 @@ source_group("Resource Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r
|
|||
source_group("POSIX Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/.+")
|
||||
source_group("Cocoa Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/cocoa/.+")
|
||||
source_group("OS X Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/.+")
|
||||
source_group("Unix Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/unix/.+")
|
||||
source_group("SDL Files" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/posix/sdl/.+")
|
||||
source_group("SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
|
||||
source_group("Shared Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_shared/.+")
|
||||
|
|
|
@ -1058,6 +1058,7 @@ public:
|
|||
int skillrespawncount;
|
||||
int TIDtoHate; // TID of things to hate (0 if none)
|
||||
FNameNoInit Species; // For monster families
|
||||
TObjPtr<AActor> alternative; // (Un)Morphed actors stored here. Those with the MF_UNMORPHED flag are the originals.
|
||||
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
|
||||
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
|
||||
double Floorclip; // value to use for floor clipping
|
||||
|
|
|
@ -38,7 +38,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
APlayerPawn *actor;
|
||||
|
||||
actor = p->mo;
|
||||
if (actor == NULL)
|
||||
if (actor == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
if ((p->mo->GetClass() == spawntype)
|
||||
&& (p->mo->PlayerFlags & PPF_CANSUPERMORPH)
|
||||
&& (p->morphTics < (((duration) ? duration : MORPHTICS) - TICRATE))
|
||||
&& (p->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true) == NULL))
|
||||
&& (p->mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true) == nullptr))
|
||||
{ // Make a super chicken
|
||||
p->mo->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
{ // Dead players cannot morph
|
||||
return false;
|
||||
}
|
||||
if (spawntype == NULL)
|
||||
if (spawntype == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
}
|
||||
morphed->Angles.Yaw = actor->Angles.Yaw;
|
||||
morphed->target = actor->target;
|
||||
morphed->tracer = actor;
|
||||
morphed->tracer = actor->tracer;
|
||||
morphed->alternative = actor;
|
||||
morphed->FriendPlayer = actor->FriendPlayer;
|
||||
morphed->DesignatedTeam = actor->DesignatedTeam;
|
||||
morphed->Score = actor->Score;
|
||||
|
@ -113,7 +114,8 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
morphed->flags2 |= actor->flags2 & MF2_FLY;
|
||||
morphed->flags3 |= actor->flags3 & MF3_GHOST;
|
||||
AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||
actor->player = NULL;
|
||||
actor->player = nullptr;
|
||||
actor->alternative = morphed;
|
||||
actor->flags &= ~(MF_SOLID|MF_SHOOTABLE);
|
||||
actor->flags |= MF_UNMORPHED;
|
||||
actor->renderflags |= RF_INVISIBLE;
|
||||
|
@ -129,7 +131,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
|
|||
p->Vel.X = p->Vel.Y = 0;
|
||||
morphed->ObtainInventory (actor);
|
||||
// Remove all armor
|
||||
for (item = morphed->Inventory; item != NULL; )
|
||||
for (item = morphed->Inventory; item != nullptr; )
|
||||
{
|
||||
AInventory *next = item->Inventory;
|
||||
if (item->IsKindOf (RUNTIME_CLASS(AArmor)))
|
||||
|
@ -182,7 +184,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
// because the level or game is ended while morphed,
|
||||
// by the time it gets executed the morphed player
|
||||
// pawn instance may have already been destroyed.
|
||||
if (pmo == NULL || pmo->tracer == NULL)
|
||||
if (pmo == nullptr || pmo->alternative == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -197,7 +199,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
return false;
|
||||
}
|
||||
|
||||
mo = barrier_cast<APlayerPawn *>(pmo->tracer);
|
||||
mo = barrier_cast<APlayerPawn *>(pmo->alternative);
|
||||
mo->SetOrigin (pmo->Pos(), false);
|
||||
mo->flags |= MF_SOLID;
|
||||
pmo->flags &= ~MF_SOLID;
|
||||
|
@ -208,10 +210,14 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
player->morphTics = 2*TICRATE;
|
||||
return false;
|
||||
}
|
||||
pmo->player = NULL;
|
||||
// No longer using tracer as morph storage. That is what 'alternative' is for.
|
||||
// If the tracer has changed on the morph, change the original too.
|
||||
mo->target = pmo->target;
|
||||
mo->tracer = pmo->tracer;
|
||||
pmo->player = nullptr;
|
||||
|
||||
// Remove the morph power if the morph is being undone prematurely.
|
||||
for (AInventory *item = pmo->Inventory, *next = NULL; item != NULL; item = next)
|
||||
for (AInventory *item = pmo->Inventory, *next = nullptr; item != nullptr; item = next)
|
||||
{
|
||||
next = item->Inventory;
|
||||
if (item->IsKindOf(RUNTIME_CLASS(APowerMorph)))
|
||||
|
@ -252,10 +258,10 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
player->morphTics = 0;
|
||||
player->MorphedPlayerClass = 0;
|
||||
player->MorphStyle = 0;
|
||||
player->MorphExitFlash = NULL;
|
||||
player->MorphExitFlash = nullptr;
|
||||
player->viewheight = mo->ViewHeight;
|
||||
AInventory *level2 = mo->FindInventory (RUNTIME_CLASS(APowerWeaponLevel2), true);
|
||||
if (level2 != NULL)
|
||||
if (level2 != nullptr)
|
||||
{
|
||||
level2->Destroy ();
|
||||
}
|
||||
|
@ -310,31 +316,31 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
}
|
||||
}
|
||||
|
||||
AActor *eflash = NULL;
|
||||
if (exit_flash != NULL)
|
||||
AActor *eflash = nullptr;
|
||||
if (exit_flash != nullptr)
|
||||
{
|
||||
eflash = Spawn(exit_flash, pmo->Vec3Angle(20., mo->Angles.Yaw, TELEFOGHEIGHT), ALLOW_REPLACE);
|
||||
if (eflash) eflash->target = mo;
|
||||
}
|
||||
mo->SetupWeaponSlots(); // Use original class's weapon slots.
|
||||
beastweap = player->ReadyWeapon;
|
||||
if (player->PremorphWeapon != NULL)
|
||||
if (player->PremorphWeapon != nullptr)
|
||||
{
|
||||
player->PremorphWeapon->PostMorphWeapon ();
|
||||
}
|
||||
else
|
||||
{
|
||||
player->ReadyWeapon = player->PendingWeapon = NULL;
|
||||
player->ReadyWeapon = player->PendingWeapon = nullptr;
|
||||
}
|
||||
if (correctweapon)
|
||||
{ // Better "lose morphed weapon" semantics
|
||||
PClassActor *morphweapon = PClass::FindActor(pmo->MorphWeapon);
|
||||
if (morphweapon != NULL && morphweapon->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
|
||||
if (morphweapon != nullptr && morphweapon->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
AWeapon *OriginalMorphWeapon = static_cast<AWeapon *>(mo->FindInventory (morphweapon));
|
||||
if ((OriginalMorphWeapon != NULL) && (OriginalMorphWeapon->GivenAsMorphWeapon))
|
||||
if ((OriginalMorphWeapon != nullptr) && (OriginalMorphWeapon->GivenAsMorphWeapon))
|
||||
{ // You don't get to keep your morphed weapon.
|
||||
if (OriginalMorphWeapon->SisterWeapon != NULL)
|
||||
if (OriginalMorphWeapon->SisterWeapon != nullptr)
|
||||
{
|
||||
OriginalMorphWeapon->SisterWeapon->Destroy ();
|
||||
}
|
||||
|
@ -344,20 +350,21 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
|
|||
}
|
||||
else // old behaviour (not really useful now)
|
||||
{ // Assumptions made here are no longer valid
|
||||
if (beastweap != NULL)
|
||||
if (beastweap != nullptr)
|
||||
{ // You don't get to keep your morphed weapon.
|
||||
if (beastweap->SisterWeapon != NULL)
|
||||
if (beastweap->SisterWeapon != nullptr)
|
||||
{
|
||||
beastweap->SisterWeapon->Destroy ();
|
||||
}
|
||||
beastweap->Destroy ();
|
||||
}
|
||||
}
|
||||
pmo->tracer = NULL;
|
||||
mo->alternative = nullptr;
|
||||
pmo->alternative = nullptr;
|
||||
pmo->Destroy ();
|
||||
// Restore playerclass armor to its normal amount.
|
||||
AHexenArmor *hxarmor = mo->FindInventory<AHexenArmor>();
|
||||
if (hxarmor != NULL)
|
||||
if (hxarmor != nullptr)
|
||||
{
|
||||
hxarmor->Slots[4] = mo->GetClass()->HexenArmor[0];
|
||||
}
|
||||
|
@ -517,9 +524,9 @@ bool P_MorphedDeath(AActor *actor, AActor **morphed, int *morphedstyle, int *mor
|
|||
(actor->player->morphTics) &&
|
||||
(actor->player->MorphStyle & MORPH_UNDOBYDEATH) &&
|
||||
(actor->player->mo) &&
|
||||
(actor->player->mo->tracer))
|
||||
(actor->player->mo->alternative))
|
||||
{
|
||||
AActor *realme = actor->player->mo->tracer;
|
||||
AActor *realme = actor->player->mo->alternative;
|
||||
int realstyle = actor->player->MorphStyle;
|
||||
int realhealth = actor->health;
|
||||
if (P_UndoPlayerMorph(actor->player, actor->player, 0, !!(actor->player->MorphStyle & MORPH_UNDOBYDEATHFORCED)))
|
||||
|
|
|
@ -3464,6 +3464,78 @@ class CommandIfWaterLevel : public SBarInfoNegatableFlowControl
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CommandIfCVarInt : public SBarInfoNegatableFlowControl
|
||||
{
|
||||
public:
|
||||
CommandIfCVarInt(SBarInfo *script) : SBarInfoNegatableFlowControl(script),
|
||||
equalcomp(false)
|
||||
{
|
||||
}
|
||||
|
||||
void ParseNegatable(FScanner &sc, bool fullScreenOffsets)
|
||||
{
|
||||
if(!sc.CheckToken(TK_StringConst))
|
||||
{
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
}
|
||||
|
||||
cvarname = sc.String;
|
||||
cvar = FindCVar(cvarname, nullptr);
|
||||
|
||||
if (cvar != nullptr)
|
||||
{
|
||||
ECVarType cvartype = cvar->GetRealType();
|
||||
|
||||
if (cvartype == CVAR_Bool || cvartype == CVAR_Int)
|
||||
{
|
||||
sc.MustGetToken(',');
|
||||
sc.MustGetToken(TK_IntConst);
|
||||
value = sc.Number;
|
||||
|
||||
if (sc.CheckToken(','))
|
||||
{
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
|
||||
if(sc.Compare("equal"))
|
||||
{
|
||||
equalcomp = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Type mismatch: console variable '%s' is not of type 'bool' or 'int'.", cvarname.GetChars());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Unknown console variable '%s'.", cvarname.GetChars());
|
||||
}
|
||||
}
|
||||
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
|
||||
{
|
||||
SBarInfoNegatableFlowControl::Tick(block, statusBar, hudChanged);
|
||||
|
||||
bool result = false;
|
||||
cvar = GetCVar(statusBar->CPlayer->mo, cvarname);
|
||||
|
||||
if (cvar != nullptr)
|
||||
{
|
||||
int cvarvalue = cvar->GetGenericRep(CVAR_Int).Int;
|
||||
result = equalcomp ? cvarvalue == value : cvarvalue >= value;
|
||||
}
|
||||
|
||||
SetTruth(result, block, statusBar);
|
||||
}
|
||||
protected:
|
||||
FString cvarname;
|
||||
FBaseCVar *cvar;
|
||||
int value;
|
||||
bool equalcomp;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const char *SBarInfoCommandNames[] =
|
||||
{
|
||||
"drawimage", "drawnumber", "drawswitchableimage",
|
||||
|
@ -3474,7 +3546,7 @@ static const char *SBarInfoCommandNames[] =
|
|||
"isselected", "usesammo", "usessecondaryammo",
|
||||
"hasweaponpiece", "inventorybarnotvisible",
|
||||
"weaponammo", "ininventory", "alpha", "ifhealth",
|
||||
"ifinvulnerable", "ifwaterlevel",
|
||||
"ifinvulnerable", "ifwaterlevel", "ifcvarint",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -3488,7 +3560,7 @@ enum SBarInfoCommands
|
|||
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
|
||||
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
|
||||
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA, SBARINFO_IFHEALTH,
|
||||
SBARINFO_IFINVULNERABLE, SBARINFO_IFWATERLEVEL,
|
||||
SBARINFO_IFINVULNERABLE, SBARINFO_IFWATERLEVEL, SBARINFO_IFCVARINT,
|
||||
};
|
||||
|
||||
SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
||||
|
@ -3524,6 +3596,7 @@ SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
|
|||
case SBARINFO_IFHEALTH: return new CommandIfHealth(script);
|
||||
case SBARINFO_IFINVULNERABLE: return new CommandIfInvulnerable(script);
|
||||
case SBARINFO_IFWATERLEVEL: return new CommandIfWaterLevel(script);
|
||||
case SBARINFO_IFCVARINT: return new CommandIfCVarInt(script);
|
||||
}
|
||||
|
||||
sc.ScriptError("Unknown command '%s'.\n", sc.String);
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
#include "gl/data/gl_vertexbuffer.h"
|
||||
|
||||
|
||||
CVAR(Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Do some tinkering with the menus so that certain options only appear
|
||||
|
@ -66,40 +68,39 @@
|
|||
|
||||
void gl_PatchMenu()
|
||||
{
|
||||
if (gl.glslversion == 0)
|
||||
// Radial fog and Doom lighting are not available without full shader support.
|
||||
|
||||
FOptionValues **opt = OptionValues.CheckKey("LightingModes");
|
||||
if (opt != NULL)
|
||||
{
|
||||
// Radial fog and Doom lighting are not available without full shader support.
|
||||
|
||||
FOptionValues **opt = OptionValues.CheckKey("LightingModes");
|
||||
if (opt != NULL)
|
||||
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||
{
|
||||
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||
// Delete 'Doom' lighting mode
|
||||
if ((*opt)->mValues[i].Value == 2.0 || (*opt)->mValues[i].Value == 8.0)
|
||||
{
|
||||
// Delete 'Doom' lighting mode
|
||||
if ((*opt)->mValues[i].Value == 2.0 || (*opt)->mValues[i].Value == 8.0)
|
||||
{
|
||||
(*opt)->mValues.Delete(i);
|
||||
}
|
||||
(*opt)->mValues.Delete(i);
|
||||
}
|
||||
}
|
||||
|
||||
opt = OptionValues.CheckKey("FogMode");
|
||||
if (opt != NULL)
|
||||
{
|
||||
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||
{
|
||||
// Delete 'Radial' fog mode
|
||||
if ((*opt)->mValues[i].Value == 2.0)
|
||||
{
|
||||
(*opt)->mValues.Delete(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// disable features that don't work without shaders.
|
||||
if (gl_lightmode == 2 || gl_lightmode == 8) gl_lightmode = 3;
|
||||
if (gl_fogmode == 2) gl_fogmode = 1;
|
||||
}
|
||||
|
||||
opt = OptionValues.CheckKey("FogMode");
|
||||
if (opt != NULL)
|
||||
{
|
||||
for(int i = (*opt)->mValues.Size()-1; i>=0; i--)
|
||||
{
|
||||
// Delete 'Radial' fog mode
|
||||
if ((*opt)->mValues[i].Value == 2.0)
|
||||
{
|
||||
(*opt)->mValues.Delete(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// disable features that don't work without shaders.
|
||||
if (gl_lightmode == 2 || gl_lightmode == 8) gl_lightmode = 3;
|
||||
if (gl_fogmode == 2) gl_fogmode = 1;
|
||||
|
||||
// todo: remove more unsupported stuff like postprocessing options.
|
||||
}
|
||||
|
||||
|
||||
|
@ -378,14 +379,14 @@ void FRenderState::DrawColormapOverlay()
|
|||
//==========================================================================
|
||||
|
||||
bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, Vector & nearPt, Vector & up, Vector & right,
|
||||
float & scale, int desaturation, bool checkside, bool additive)
|
||||
float & scale, bool checkside, bool additive)
|
||||
{
|
||||
Vector fn, pos;
|
||||
|
||||
DVector3 lpos = light->PosRelative(group);
|
||||
|
||||
float dist = fabsf(p.DistToPoint(lpos.X, lpos.Z, lpos.Y));
|
||||
float radius = (light->GetRadius() * gl_lights_size);
|
||||
float radius = light->GetRadius();
|
||||
|
||||
if (radius <= 0.f) return false;
|
||||
if (dist > radius) return false;
|
||||
|
@ -416,9 +417,9 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, Vector & nearPt,
|
|||
|
||||
float cs = 1.0f - (dist / radius);
|
||||
if (additive) cs *= 0.2f; // otherwise the light gets too strong.
|
||||
float r = light->GetRed() / 255.0f * cs * gl_lights_intensity;
|
||||
float g = light->GetGreen() / 255.0f * cs * gl_lights_intensity;
|
||||
float b = light->GetBlue() / 255.0f * cs * gl_lights_intensity;
|
||||
float r = light->GetRed() / 255.0f * cs;
|
||||
float g = light->GetGreen() / 255.0f * cs;
|
||||
float b = light->GetBlue() / 255.0f * cs;
|
||||
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
|
@ -434,14 +435,6 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, Vector & nearPt,
|
|||
{
|
||||
gl_RenderState.BlendEquation(GL_FUNC_ADD);
|
||||
}
|
||||
if (desaturation > 0 && gl.glslversion > 0) // no-shader excluded because no desaturated textures.
|
||||
{
|
||||
float gray = (r * 77 + g * 143 + b * 37) / 257;
|
||||
|
||||
r = (r*(32 - desaturation) + gray*desaturation) / 32;
|
||||
g = (g*(32 - desaturation) + gray*desaturation) / 32;
|
||||
b = (b*(32 - desaturation) + gray*desaturation) / 32;
|
||||
}
|
||||
gl_RenderState.SetColor(r, g, b);
|
||||
return true;
|
||||
}
|
||||
|
@ -487,15 +480,10 @@ bool GLWall::PutWallCompat(int passflag)
|
|||
if (sub->lighthead == nullptr) return false;
|
||||
}
|
||||
|
||||
bool foggy = !gl_isBlack(Colormap.FadeColor) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive;
|
||||
bool foggy = gl_CheckFog(&Colormap, lightlevel) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive;
|
||||
bool masked = passflag == 2 && gltexture->isMasked();
|
||||
|
||||
int list = list_indices[masked][foggy];
|
||||
if (list == GLLDL_WALLS_PLAIN)
|
||||
{
|
||||
if (gltexture->tex->gl_info.Brightmap && gl.glslversion >= 0.f) list = GLLDL_WALLS_BRIGHT;
|
||||
//if (flags & GLWF_GLOW) list = GLLDL_WALLS_BRIGHT;
|
||||
}
|
||||
gl_drawinfo->dldrawlists[list].AddWall(this);
|
||||
return true;
|
||||
|
||||
|
@ -520,10 +508,6 @@ bool GLFlat::PutFlatCompat(bool fog)
|
|||
|
||||
|
||||
int list = list_indices[masked][foggy];
|
||||
if (list == GLLDL_FLATS_PLAIN)
|
||||
{
|
||||
if (gltexture->tex->gl_info.Brightmap && gl.glslversion >= 0.f) list = GLLDL_FLATS_BRIGHT;
|
||||
}
|
||||
gl_drawinfo->dldrawlists[list].AddFlat(this);
|
||||
return true;
|
||||
}
|
||||
|
@ -612,7 +596,7 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
|||
}
|
||||
|
||||
p.Set(plane.plane);
|
||||
if (!gl_SetupLight(sub->sector->PortalGroup, p, light, nearPt, up, right, scale, CM_DEFAULT, false, pass != GLPASS_LIGHTTEX))
|
||||
if (!gl_SetupLight(sub->sector->PortalGroup, p, light, nearPt, up, right, scale, false, pass != GLPASS_LIGHTTEX))
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
|
@ -692,7 +676,7 @@ bool GLWall::PrepareLight(ADynamicLight * light, int pass)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!gl_SetupLight(seg->frontsector->PortalGroup, p, light, nearPt, up, right, scale, CM_DEFAULT, true, pass != GLPASS_LIGHTTEX))
|
||||
if (!gl_SetupLight(seg->frontsector->PortalGroup, p, light, nearPt, up, right, scale, true, pass != GLPASS_LIGHTTEX))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -798,9 +782,7 @@ void FGLRenderer::RenderMultipassStuff()
|
|||
gl_RenderState.SetTextureMode(TM_MASK);
|
||||
gl_RenderState.EnableBrightmap(true);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_BRIGHT].DrawWalls(GLPASS_PLAIN);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(GLPASS_PLAIN);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_BRIGHT].DrawFlats(GLPASS_PLAIN);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(GLPASS_PLAIN);
|
||||
|
||||
// Part 3: The base of fogged surfaces, including the texture
|
||||
|
@ -823,10 +805,8 @@ void FGLRenderer::RenderMultipassStuff()
|
|||
glDepthFunc(GL_EQUAL);
|
||||
if (glset.lightmode == 8) gl_RenderState.SetSoftLightLevel(255);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(GLPASS_LIGHTTEX);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_BRIGHT].DrawWalls(GLPASS_LIGHTTEX);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(GLPASS_LIGHTTEX);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(GLPASS_LIGHTTEX);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_BRIGHT].DrawFlats(GLPASS_LIGHTTEX);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(GLPASS_LIGHTTEX);
|
||||
gl_RenderState.BlendEquation(GL_FUNC_ADD);
|
||||
}
|
||||
|
@ -841,8 +821,6 @@ void FGLRenderer::RenderMultipassStuff()
|
|||
glDepthFunc(GL_LEQUAL);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(GLPASS_TEXONLY);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(GLPASS_TEXONLY);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_BRIGHT].DrawWalls(GLPASS_TEXONLY);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_BRIGHT].DrawFlats(GLPASS_TEXONLY);
|
||||
gl_RenderState.AlphaFunc(GL_GREATER, gl_mask_threshold);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(GLPASS_TEXONLY);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(GLPASS_TEXONLY);
|
||||
|
@ -854,10 +832,8 @@ void FGLRenderer::RenderMultipassStuff()
|
|||
if (gl_SetupLightTexture())
|
||||
{
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawWalls(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_BRIGHT].DrawWalls(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_MASKED].DrawWalls(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_PLAIN].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_BRIGHT].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_FLATS_MASKED].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOG].DrawWalls(GLPASS_LIGHTTEX_FOGGY);
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_FOGMASKED].DrawWalls(GLPASS_LIGHTTEX_FOGGY);
|
||||
|
|
|
@ -75,7 +75,7 @@ FVertexBuffer::~FVertexBuffer()
|
|||
void FSimpleVertexBuffer::BindVBO()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FSimpleVertex), &VSiO->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FSimpleVertex), &VSiO->u);
|
||||
|
@ -100,7 +100,7 @@ void FSimpleVertexBuffer::EnableColorArray(bool on)
|
|||
{
|
||||
if (on)
|
||||
{
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glEnableVertexAttribArray(VATTR_COLOR);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ void FSimpleVertexBuffer::EnableColorArray(bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glDisableVertexAttribArray(VATTR_COLOR);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void FSimpleVertexBuffer::set(FSimpleVertex *verts, int count)
|
|||
//==========================================================================
|
||||
|
||||
FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
|
||||
: FVertexBuffer(gl.buffermethod != BM_CLIENTARRAY)
|
||||
: FVertexBuffer(!gl.legacyMode)
|
||||
{
|
||||
switch (gl.buffermethod)
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
|
|||
break;
|
||||
}
|
||||
|
||||
case BM_CLIENTARRAY:
|
||||
default:
|
||||
{
|
||||
map = new FFlatVertex[BUFFER_SIZE];
|
||||
DPrintf(DMSG_NOTIFY, "Using client array buffer\n");
|
||||
|
@ -219,7 +219,7 @@ FFlatVertexBuffer::~FFlatVertexBuffer()
|
|||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
if (gl.buffermethod == BM_CLIENTARRAY)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
delete[] map;
|
||||
}
|
||||
|
@ -230,19 +230,10 @@ FFlatVertexBuffer::~FFlatVertexBuffer()
|
|||
void FFlatVertexBuffer::BindVBO()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
if (gl.buffermethod != BM_CLIENTARRAY)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->u);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we cannot use a hardware buffer, use an old-style client array.
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &map->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FFlatVertex), &map->u);
|
||||
}
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FFlatVertex), &VTO->u);
|
||||
glEnableVertexAttribArray(VATTR_VERTEX);
|
||||
glEnableVertexAttribArray(VATTR_TEXCOORD);
|
||||
glDisableVertexAttribArray(VATTR_COLOR);
|
||||
|
|
|
@ -10,6 +10,15 @@ struct secplane_t;
|
|||
struct subsector_t;
|
||||
struct sector_t;
|
||||
|
||||
enum
|
||||
{
|
||||
VATTR_VERTEX_BIT,
|
||||
VATTR_TEXCOORD_BIT,
|
||||
VATTR_COLOR_BIT,
|
||||
VATTR_VERTEX2_BIT,
|
||||
VATTR_NORMAL_BIT
|
||||
};
|
||||
|
||||
|
||||
class FVertexBuffer
|
||||
{
|
||||
|
@ -20,6 +29,7 @@ public:
|
|||
FVertexBuffer(bool wantbuffer = true);
|
||||
virtual ~FVertexBuffer();
|
||||
virtual void BindVBO() = 0;
|
||||
void EnableBufferArrays(int enable, int disable);
|
||||
};
|
||||
|
||||
struct FFlatVertex
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
#include "gl/utility/gl_convert.h"
|
||||
#include "gl/utility/gl_templates.h"
|
||||
|
||||
EXTERN_CVAR (Float, gl_lights_size);
|
||||
EXTERN_CVAR (Bool, gl_lights_additive);
|
||||
EXTERN_CVAR(Int, vid_renderer)
|
||||
|
||||
|
||||
|
@ -379,7 +377,7 @@ void ADynamicLight::UpdateLocation()
|
|||
{
|
||||
intensity = m_currentRadius;
|
||||
}
|
||||
radius = intensity * 2.0f * gl_lights_size;
|
||||
radius = intensity * 2.0f;
|
||||
|
||||
if (X() != oldx || Y() != oldy || radius != oldradius)
|
||||
{
|
||||
|
|
|
@ -61,8 +61,6 @@
|
|||
#include "gl/utility/gl_clock.h"
|
||||
#include "gl/utility/gl_convert.h"
|
||||
|
||||
EXTERN_CVAR (Float, gl_lights_intensity);
|
||||
EXTERN_CVAR (Float, gl_lights_size);
|
||||
int ScriptDepth;
|
||||
void gl_InitGlow(FScanner &sc);
|
||||
void gl_ParseBrightmap(FScanner &sc, int);
|
||||
|
@ -175,7 +173,7 @@ void FLightDefaults::ApplyProperties(ADynamicLight * light) const
|
|||
light->Angles.Yaw.Degrees = m_Param;
|
||||
light->SetOffset(m_Pos);
|
||||
light->halo = m_halo;
|
||||
for (int a = 0; a < 3; a++) light->args[a] = clamp<int>((int)(m_Args[a] * gl_lights_intensity), 0, 255);
|
||||
for (int a = 0; a < 3; a++) light->args[a] = clamp<int>((int)(m_Args[a]), 0, 255);
|
||||
light->m_Radius[0] = int(m_Args[LIGHT_INTENSITY]);
|
||||
light->m_Radius[1] = int(m_Args[LIGHT_SECONDARY_INTENSITY]);
|
||||
light->flags4 &= ~(MF4_ADDITIVE | MF4_SUBTRACTIVE | MF4_DONTLIGHTSELF);
|
||||
|
|
|
@ -184,7 +184,7 @@ struct FDynLightData
|
|||
|
||||
|
||||
|
||||
bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bool forceadditive, FDynLightData &data);
|
||||
bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &data);
|
||||
void gl_UploadLights(FDynLightData &data);
|
||||
|
||||
|
||||
|
|
|
@ -70,29 +70,22 @@ CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
|
|||
|
||||
CVAR (Bool, gl_attachedlights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR (Bool, gl_lights_checkside, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR (Float, gl_lights_intensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR (Float, gl_lights_size, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR (Bool, gl_light_sprites, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CVAR (Bool, gl_light_particles, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
CUSTOM_CVAR (Bool, gl_lights_additive, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
gl_DeleteAllAttachedLights();
|
||||
gl_RecreateAllAttachedLights();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Sets up the parameters to render one dynamic light onto one plane
|
||||
//
|
||||
//==========================================================================
|
||||
bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bool forceadditive, FDynLightData &ldata)
|
||||
bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, FDynLightData &ldata)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
DVector3 pos = light->PosRelative(group);
|
||||
|
||||
float dist = fabsf(p.DistToPoint(pos.X, pos.Z, pos.Y));
|
||||
float radius = (light->GetRadius() * gl_lights_size);
|
||||
float radius = (light->GetRadius());
|
||||
|
||||
if (radius <= 0.f) return false;
|
||||
if (dist > radius) return false;
|
||||
|
@ -103,7 +96,7 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bo
|
|||
|
||||
|
||||
float cs;
|
||||
if (gl_lights_additive || light->flags4&MF4_ADDITIVE || forceadditive)
|
||||
if (light->IsAdditive())
|
||||
{
|
||||
cs = 0.2f;
|
||||
i = 2;
|
||||
|
@ -113,9 +106,9 @@ bool gl_GetLight(int group, Plane & p, ADynamicLight * light, bool checkside, bo
|
|||
cs = 1.0f;
|
||||
}
|
||||
|
||||
float r = light->GetRed() / 255.0f * cs * gl_lights_intensity;
|
||||
float g = light->GetGreen() / 255.0f * cs * gl_lights_intensity;
|
||||
float b = light->GetBlue() / 255.0f * cs * gl_lights_intensity;
|
||||
float r = light->GetRed() / 255.0f * cs;
|
||||
float g = light->GetGreen() / 255.0f * cs;
|
||||
float b = light->GetBlue() / 255.0f * cs;
|
||||
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define __HQX_COMMON_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "mystdint.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define MASK_2 0x0000FF00
|
||||
#define MASK_13 0x00FF00FF
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mystdint.h"
|
||||
#include "common.h"
|
||||
#include "hqx.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mystdint.h"
|
||||
#include "common.h"
|
||||
#include "hqx.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mystdint.h"
|
||||
#include "common.h"
|
||||
#include "hqx.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef __HQX_H_
|
||||
#define __HQX_H_
|
||||
|
||||
#include "mystdint.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#ifdef __MINGW32__
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mystdint.h"
|
||||
#include "hqx.h"
|
||||
|
||||
uint32_t *RGBtoYUV;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef __MYSTDINT_H
|
||||
#define __MYSTDINT_H
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <stdint.h>
|
||||
#else
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int8 int8_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -105,7 +105,7 @@ void gl_FlushModels()
|
|||
//===========================================================================
|
||||
|
||||
FModelVertexBuffer::FModelVertexBuffer(bool needindex, bool singleframe)
|
||||
: FVertexBuffer(singleframe || gl.glslversion > 0)
|
||||
: FVertexBuffer(singleframe || !gl.legacyMode)
|
||||
{
|
||||
vbo_ptr = nullptr;
|
||||
ibo_id = 0;
|
||||
|
@ -125,7 +125,7 @@ void FModelVertexBuffer::BindVBO()
|
|||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glEnableVertexAttribArray(VATTR_VERTEX);
|
||||
glEnableVertexAttribArray(VATTR_TEXCOORD);
|
||||
|
@ -170,7 +170,7 @@ FModelVertex *FModelVertexBuffer::LockVertexBuffer(unsigned int size)
|
|||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
glBufferData(GL_ARRAY_BUFFER, size * sizeof(FModelVertex), nullptr, GL_STATIC_DRAW);
|
||||
if (gl.version >= 3.0)
|
||||
if (!gl.legacyMode)
|
||||
return (FModelVertex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, size * sizeof(FModelVertex), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
else
|
||||
return (FModelVertex*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
|
@ -211,7 +211,7 @@ unsigned int *FModelVertexBuffer::LockIndexBuffer(unsigned int size)
|
|||
{
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, size * sizeof(unsigned int), NULL, GL_STATIC_DRAW);
|
||||
if (gl.version >= 3.0)
|
||||
if (!gl.legacyMode)
|
||||
return (unsigned int*)glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, size * sizeof(unsigned int), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||
else
|
||||
return (unsigned int*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
|
@ -251,7 +251,7 @@ unsigned int FModelVertexBuffer::SetupFrame(unsigned int frame1, unsigned int fr
|
|||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (vbo_id > 0)
|
||||
{
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u);
|
||||
|
|
|
@ -71,7 +71,7 @@ CUSTOM_CVAR(Bool, gl_enhanced_nightvision, true, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
|||
{
|
||||
// The fixed colormap state needs to be reset because if this happens when
|
||||
// a shader is set to CM_LITE or CM_TORCH it won't register the change in behavior caused by this CVAR.
|
||||
if (GLRenderer != NULL && GLRenderer->mShaderManager != NULL)
|
||||
if (GLRenderer != nullptr && GLRenderer->mShaderManager != nullptr)
|
||||
{
|
||||
GLRenderer->mShaderManager->ResetFixedColormap();
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "gl/shaders/gl_bloomshader.h"
|
||||
#include "gl/shaders/gl_blurshader.h"
|
||||
#include "gl/shaders/gl_tonemapshader.h"
|
||||
#include "gl/shaders/gl_colormapshader.h"
|
||||
#include "gl/shaders/gl_lensshader.h"
|
||||
#include "gl/shaders/gl_presentshader.h"
|
||||
#include "gl/renderer/gl_2ddrawer.h"
|
||||
|
@ -126,7 +127,7 @@ void FGLRenderer::RenderScreenQuad()
|
|||
void FGLRenderer::BloomScene()
|
||||
{
|
||||
// Only bloom things if enabled and no special fixed light mode is active
|
||||
if (!gl_bloom || !FGLRenderBuffers::IsEnabled() || gl_fixedcolormap != CM_DEFAULT)
|
||||
if (!gl_bloom || gl_fixedcolormap != CM_DEFAULT)
|
||||
return;
|
||||
|
||||
FGLDebug::PushGroup("BloomScene");
|
||||
|
@ -212,7 +213,7 @@ void FGLRenderer::BloomScene()
|
|||
|
||||
void FGLRenderer::TonemapScene()
|
||||
{
|
||||
if (gl_tonemap == 0 || !FGLRenderBuffers::IsEnabled())
|
||||
if (gl_tonemap == 0)
|
||||
return;
|
||||
|
||||
FGLDebug::PushGroup("TonemapScene");
|
||||
|
@ -256,7 +257,7 @@ void FGLRenderer::BindTonemapPalette(int texunit)
|
|||
{
|
||||
for (int b = 0; b < 64; b++)
|
||||
{
|
||||
PalEntry color = GPalette.BaseColors[ColorMatcher.Pick((r << 2) | (r >> 1), (g << 2) | (g >> 1), (b << 2) | (b >> 1))];
|
||||
PalEntry color = GPalette.BaseColors[ColorMatcher.Pick((r << 2) | (r >> 4), (g << 2) | (g >> 4), (b << 2) | (b >> 4))];
|
||||
int index = ((r * 64 + g) * 64 + b) * 4;
|
||||
lut[index] = color.r;
|
||||
lut[index + 1] = color.g;
|
||||
|
@ -284,6 +285,38 @@ void FGLRenderer::ClearTonemapPalette()
|
|||
mTonemapPalette = nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Colormap scene texture and place the result in the HUD/2D texture
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FGLRenderer::ColormapScene()
|
||||
{
|
||||
if (gl_fixedcolormap < CM_FIRSTSPECIALCOLORMAP || gl_fixedcolormap >= CM_MAXCOLORMAP)
|
||||
return;
|
||||
|
||||
FGLDebug::PushGroup("ColormapScene");
|
||||
|
||||
FGLPostProcessState savedState;
|
||||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0);
|
||||
mColormapShader->Bind();
|
||||
|
||||
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
|
||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
||||
|
||||
mColormapShader->MapStart.Set(scm->ColorizeStart[0], scm->ColorizeStart[1], scm->ColorizeStart[2], 0.f);
|
||||
mColormapShader->MapRange.Set(m);
|
||||
|
||||
RenderScreenQuad();
|
||||
mBuffers->NextTexture();
|
||||
|
||||
FGLDebug::PopGroup();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Apply lens distortion and place the result in the HUD/2D texture
|
||||
|
@ -292,7 +325,7 @@ void FGLRenderer::ClearTonemapPalette()
|
|||
|
||||
void FGLRenderer::LensDistortScene()
|
||||
{
|
||||
if (gl_lens == 0 || !FGLRenderBuffers::IsEnabled())
|
||||
if (gl_lens == 0)
|
||||
return;
|
||||
|
||||
FGLDebug::PushGroup("LensDistortScene");
|
||||
|
@ -411,6 +444,8 @@ void FGLRenderer::ClearBorders()
|
|||
|
||||
int clientWidth = framebuffer->GetClientWidth();
|
||||
int clientHeight = framebuffer->GetClientHeight();
|
||||
if (clientWidth == 0 || clientHeight == 0)
|
||||
return;
|
||||
|
||||
glViewport(0, 0, clientWidth, clientHeight);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "doomerrors.h"
|
||||
|
||||
CVAR(Int, gl_multisample, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
CVAR(Bool, gl_renderbuffers, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
CVAR(Bool, gl_renderbuffers, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -149,6 +149,14 @@ void FGLRenderBuffers::DeleteFrameBuffer(GLuint &handle)
|
|||
|
||||
bool FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHeight)
|
||||
{
|
||||
if (gl_renderbuffers != BuffersActive)
|
||||
{
|
||||
if (BuffersActive)
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mOutputFB);
|
||||
BuffersActive = gl_renderbuffers;
|
||||
GLRenderer->mShaderManager->ResetFixedColormap();
|
||||
}
|
||||
|
||||
if (!IsEnabled())
|
||||
return false;
|
||||
|
||||
|
@ -216,19 +224,10 @@ void FGLRenderBuffers::CreateScene(int width, int height, int samples)
|
|||
ClearScene();
|
||||
|
||||
if (samples > 1)
|
||||
mSceneMultisample = CreateRenderBuffer("SceneMultisample", GetHdrFormat(), samples, width, height);
|
||||
mSceneMultisample = CreateRenderBuffer("SceneMultisample", GL_RGBA16F, samples, width, height);
|
||||
|
||||
if ((gl.flags & RFL_NO_DEPTHSTENCIL) != 0)
|
||||
{
|
||||
mSceneDepth = CreateRenderBuffer("SceneDepth", GL_DEPTH_COMPONENT24, samples, width, height);
|
||||
mSceneStencil = CreateRenderBuffer("SceneStencil", GL_STENCIL_INDEX8, samples, width, height);
|
||||
mSceneFB = CreateFrameBuffer("SceneFB", samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepth, mSceneStencil, samples > 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mSceneDepthStencil = CreateRenderBuffer("SceneDepthStencil", GL_DEPTH24_STENCIL8, samples, width, height);
|
||||
mSceneFB = CreateFrameBuffer("SceneFB", samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepthStencil, samples > 1);
|
||||
}
|
||||
mSceneDepthStencil = CreateRenderBuffer("SceneDepthStencil", GL_DEPTH24_STENCIL8, samples, width, height);
|
||||
mSceneFB = CreateFrameBuffer("SceneFB", samples > 1 ? mSceneMultisample : mPipelineTexture[0], mSceneDepthStencil, samples > 1);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -243,7 +242,7 @@ void FGLRenderBuffers::CreatePipeline(int width, int height)
|
|||
|
||||
for (int i = 0; i < NumPipelineTextures; i++)
|
||||
{
|
||||
mPipelineTexture[i] = Create2DTexture("PipelineTexture", GetHdrFormat(), width, height);
|
||||
mPipelineTexture[i] = Create2DTexture("PipelineTexture", GL_RGBA16F, width, height);
|
||||
mPipelineFB[i] = CreateFrameBuffer("PipelineFB", mPipelineTexture[i]);
|
||||
}
|
||||
}
|
||||
|
@ -270,8 +269,8 @@ void FGLRenderBuffers::CreateBloom(int width, int height)
|
|||
level.Width = MAX(bloomWidth / 2, 1);
|
||||
level.Height = MAX(bloomHeight / 2, 1);
|
||||
|
||||
level.VTexture = Create2DTexture("Bloom.VTexture", GetHdrFormat(), level.Width, level.Height);
|
||||
level.HTexture = Create2DTexture("Bloom.HTexture", GetHdrFormat(), level.Width, level.Height);
|
||||
level.VTexture = Create2DTexture("Bloom.VTexture", GL_RGBA16F, level.Width, level.Height);
|
||||
level.HTexture = Create2DTexture("Bloom.HTexture", GL_RGBA16F, level.Width, level.Height);
|
||||
level.VFramebuffer = CreateFrameBuffer("Bloom.VFramebuffer", level.VTexture);
|
||||
level.HFramebuffer = CreateFrameBuffer("Bloom.HFramebuffer", level.HTexture);
|
||||
|
||||
|
@ -280,17 +279,6 @@ void FGLRenderBuffers::CreateBloom(int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Fallback support for older OpenGL where RGBA16F might not be available
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
GLuint FGLRenderBuffers::GetHdrFormat()
|
||||
{
|
||||
return ((gl.flags & RFL_NO_RGBA16F) != 0) ? GL_RGBA8 : GL_RGBA16F;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Creates a 2D texture defaulting to linear filtering and clamp to edge
|
||||
|
@ -559,7 +547,8 @@ void FGLRenderBuffers::BindOutputFB()
|
|||
|
||||
bool FGLRenderBuffers::IsEnabled()
|
||||
{
|
||||
return gl_renderbuffers && gl.glslversion != 0 && !FailedCreate;
|
||||
return BuffersActive && !gl.legacyMode && !FailedCreate;
|
||||
}
|
||||
|
||||
bool FGLRenderBuffers::FailedCreate = false;
|
||||
bool FGLRenderBuffers::BuffersActive = false;
|
||||
|
|
|
@ -59,8 +59,6 @@ private:
|
|||
void DeleteRenderBuffer(GLuint &handle);
|
||||
void DeleteFrameBuffer(GLuint &handle);
|
||||
|
||||
GLuint GetHdrFormat();
|
||||
|
||||
int mWidth = 0;
|
||||
int mHeight = 0;
|
||||
int mSamples = 0;
|
||||
|
@ -86,6 +84,7 @@ private:
|
|||
GLuint mOutputFB = 0;
|
||||
|
||||
static bool FailedCreate;
|
||||
static bool BuffersActive;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -67,6 +67,7 @@
|
|||
#include "gl/shaders/gl_bloomshader.h"
|
||||
#include "gl/shaders/gl_blurshader.h"
|
||||
#include "gl/shaders/gl_tonemapshader.h"
|
||||
#include "gl/shaders/gl_colormapshader.h"
|
||||
#include "gl/shaders/gl_lensshader.h"
|
||||
#include "gl/shaders/gl_presentshader.h"
|
||||
#include "gl/textures/gl_texture.h"
|
||||
|
@ -97,21 +98,30 @@ CVAR(Bool, gl_scale_viewport, true, 0);
|
|||
FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
|
||||
{
|
||||
framebuffer = fb;
|
||||
mClipPortal = NULL;
|
||||
mCurrentPortal = NULL;
|
||||
mClipPortal = nullptr;
|
||||
mCurrentPortal = nullptr;
|
||||
mMirrorCount = 0;
|
||||
mPlaneMirrorCount = 0;
|
||||
mLightCount = 0;
|
||||
mAngles = FRotator(0.f, 0.f, 0.f);
|
||||
mViewVector = FVector2(0,0);
|
||||
mVBO = NULL;
|
||||
mSkyVBO = NULL;
|
||||
mVBO = nullptr;
|
||||
mSkyVBO = nullptr;
|
||||
gl_spriteindex = 0;
|
||||
mShaderManager = NULL;
|
||||
gllight = glpart2 = glpart = mirrortexture = NULL;
|
||||
mLights = NULL;
|
||||
mShaderManager = nullptr;
|
||||
gllight = glpart2 = glpart = mirrortexture = nullptr;
|
||||
mLights = nullptr;
|
||||
m2DDrawer = nullptr;
|
||||
mTonemapPalette = nullptr;
|
||||
mBuffers = nullptr;
|
||||
mPresentShader = nullptr;
|
||||
mBloomExtractShader = nullptr;
|
||||
mBloomCombineShader = nullptr;
|
||||
mBlurShader = nullptr;
|
||||
mTonemapShader = nullptr;
|
||||
mTonemapPalette = nullptr;
|
||||
mColormapShader = nullptr;
|
||||
mLensShader = nullptr;
|
||||
}
|
||||
|
||||
void gl_LoadModels();
|
||||
|
@ -124,13 +134,14 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
mBloomCombineShader = new FBloomCombineShader();
|
||||
mBlurShader = new FBlurShader();
|
||||
mTonemapShader = new FTonemapShader();
|
||||
mColormapShader = new FColormapShader();
|
||||
mTonemapPalette = nullptr;
|
||||
mLensShader = new FLensShader();
|
||||
mPresentShader = new FPresentShader();
|
||||
m2DDrawer = new F2DDrawer;
|
||||
|
||||
// Only needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
||||
if (gl.buffermethod != BM_CLIENTARRAY)
|
||||
// needed for the core profile, because someone decided it was a good idea to remove the default VAO.
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glGenVertexArrays(1, &mVAOID);
|
||||
glBindVertexArray(mVAOID);
|
||||
|
@ -145,7 +156,7 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
|
||||
mVBO = new FFlatVertexBuffer(width, height);
|
||||
mSkyVBO = new FSkyVertexBuffer;
|
||||
if (gl.lightmethod != LM_SOFTWARE) mLights = new FLightBuffer();
|
||||
if (!gl.legacyMode) mLights = new FLightBuffer();
|
||||
else mLights = NULL;
|
||||
gl_RenderState.SetVertexBuffer(mVBO);
|
||||
mFBID = 0;
|
||||
|
@ -184,6 +195,7 @@ FGLRenderer::~FGLRenderer()
|
|||
if (mBlurShader) delete mBlurShader;
|
||||
if (mTonemapShader) delete mTonemapShader;
|
||||
if (mTonemapPalette) delete mTonemapPalette;
|
||||
if (mColormapShader) delete mColormapShader;
|
||||
if (mLensShader) delete mLensShader;
|
||||
}
|
||||
|
||||
|
@ -219,6 +231,13 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
|
|||
// Back buffer letterbox for the final output
|
||||
int clientWidth = framebuffer->GetClientWidth();
|
||||
int clientHeight = framebuffer->GetClientHeight();
|
||||
if (clientWidth == 0 || clientHeight == 0)
|
||||
{
|
||||
// When window is minimized there may not be any client area.
|
||||
// Pretend to the rest of the render code that we just have a very small window.
|
||||
clientWidth = 160;
|
||||
clientHeight = 120;
|
||||
}
|
||||
int screenWidth = framebuffer->GetWidth();
|
||||
int screenHeight = framebuffer->GetHeight();
|
||||
float scale = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight);
|
||||
|
|
|
@ -23,6 +23,7 @@ class FBloomExtractShader;
|
|||
class FBloomCombineShader;
|
||||
class FBlurShader;
|
||||
class FTonemapShader;
|
||||
class FColormapShader;
|
||||
class FLensShader;
|
||||
class FPresentShader;
|
||||
class F2DDrawer;
|
||||
|
@ -93,6 +94,7 @@ public:
|
|||
FBloomCombineShader *mBloomCombineShader;
|
||||
FBlurShader *mBlurShader;
|
||||
FTonemapShader *mTonemapShader;
|
||||
FColormapShader *mColormapShader;
|
||||
FHardwareTexture *mTonemapPalette;
|
||||
FLensShader *mLensShader;
|
||||
FPresentShader *mPresentShader;
|
||||
|
@ -166,6 +168,7 @@ public:
|
|||
void EndDrawScene(sector_t * viewsector);
|
||||
void BloomScene();
|
||||
void TonemapScene();
|
||||
void ColormapScene();
|
||||
void BindTonemapPalette(int texunit);
|
||||
void ClearTonemapPalette();
|
||||
void LensDistortScene();
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_colormap.h"
|
||||
#include "gl/dynlights//gl_lightbuffer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
|
||||
void gl_SetTextureMode(int type);
|
||||
|
||||
|
@ -220,15 +221,24 @@ bool FRenderState::ApplyShader()
|
|||
{
|
||||
activeShader->muFixedColormap.Set(0);
|
||||
}
|
||||
else if (mColormapState < CM_MAXCOLORMAP)
|
||||
else if (mColormapState > CM_DEFAULT && mColormapState < CM_MAXCOLORMAP)
|
||||
{
|
||||
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
|
||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
||||
if (FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
// When using postprocessing to apply the colormap, we must render the image fullbright here.
|
||||
activeShader->muFixedColormap.Set(2);
|
||||
activeShader->muColormapStart.Set(1, 1, 1, 1.f);
|
||||
}
|
||||
else
|
||||
{
|
||||
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
|
||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
||||
|
||||
activeShader->muFixedColormap.Set(1);
|
||||
activeShader->muColormapStart.Set(scm->ColorizeStart[0], scm->ColorizeStart[1], scm->ColorizeStart[2], 0.f);
|
||||
activeShader->muColormapRange.Set(m);
|
||||
activeShader->muFixedColormap.Set(1);
|
||||
activeShader->muColormapStart.Set(scm->ColorizeStart[0], scm->ColorizeStart[1], scm->ColorizeStart[2], 0.f);
|
||||
activeShader->muColormapRange.Set(m);
|
||||
}
|
||||
}
|
||||
else if (mColormapState == CM_FOGLAYER)
|
||||
{
|
||||
|
@ -314,7 +324,7 @@ void FRenderState::Apply()
|
|||
else mVertexBuffer->BindVBO();
|
||||
mCurrentVertexBuffer = mVertexBuffer;
|
||||
}
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
ApplyShader();
|
||||
}
|
||||
|
@ -351,7 +361,7 @@ void FRenderState::ApplyMatrices()
|
|||
|
||||
void FRenderState::ApplyLightIndex(int index)
|
||||
{
|
||||
if (gl.lightmethod != LM_SOFTWARE)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
if (index > -1 && GLRenderer->mLights->GetBufferType() == GL_UNIFORM_BUFFER)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
// Without shaders this translation must be applied to any texture.
|
||||
if (alphatexture)
|
||||
{
|
||||
if (mat->tex->UseBasePalette() || gl.glslversion == 0) translation = TRANSLATION(TRANSLATION_Standard, 8);
|
||||
if (mat->tex->UseBasePalette() || gl.legacyMode) translation = TRANSLATION(TRANSLATION_Standard, 8);
|
||||
}
|
||||
mEffectState = overrideshader >= 0? overrideshader : mat->mShaderIndex;
|
||||
mShaderTimer = mat->tex->gl_info.shaderspeed;
|
||||
|
|
|
@ -322,7 +322,7 @@ void GLDrawList::SortWallIntoPlane(SortNode * head,SortNode * sort)
|
|||
AddWall(&w);
|
||||
|
||||
// Splitting is done in the shader with clip planes, if available
|
||||
if (gl.glslversion < 1.3f)
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
{
|
||||
GLWall * ws1;
|
||||
ws->vertcount = 0; // invalidate current vertices.
|
||||
|
@ -382,7 +382,7 @@ void GLDrawList::SortSpriteIntoPlane(SortNode * head,SortNode * sort)
|
|||
AddSprite(&s); // add a copy to avoid reallocation issues.
|
||||
|
||||
// Splitting is done in the shader with clip planes, if available
|
||||
if (gl.glslversion < 1.3f)
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
{
|
||||
GLSprite * ss1;
|
||||
ss1=&sprites[sprites.Size()-1];
|
||||
|
@ -476,9 +476,15 @@ void GLDrawList::SortWallIntoWall(SortNode * head,SortNode * sort)
|
|||
|
||||
ws1->glseg.x1=ws->glseg.x2=ix;
|
||||
ws1->glseg.y1=ws->glseg.y2=iy;
|
||||
ws1->glseg.fracleft = ws->glseg.fracright = ws->glseg.fracleft + r*(ws->glseg.fracright - ws->glseg.fracleft);
|
||||
ws1->ztop[0]=ws->ztop[1]=izt;
|
||||
ws1->zbottom[0]=ws->zbottom[1]=izb;
|
||||
ws1->tcs[GLWall::LOLFT].u = ws1->tcs[GLWall::UPLFT].u = ws->tcs[GLWall::LORGT].u = ws->tcs[GLWall::UPRGT].u = iu;
|
||||
if (gl.buffermethod == BM_DEFERRED)
|
||||
{
|
||||
ws->MakeVertices(false);
|
||||
ws1->MakeVertices(false);
|
||||
}
|
||||
|
||||
SortNode * sort2=SortNodes.GetNew();
|
||||
memset(sort2,0,sizeof(SortNode));
|
||||
|
@ -805,17 +811,19 @@ void GLDrawList::DrawSorted()
|
|||
|
||||
if (!sorted)
|
||||
{
|
||||
GLRenderer->mVBO->Map();
|
||||
MakeSortList();
|
||||
sorted=DoSort(SortNodes[SortNodeStart]);
|
||||
GLRenderer->mVBO->Unmap();
|
||||
}
|
||||
gl_RenderState.ClearClipSplit();
|
||||
if (gl.glslversion >= 1.3f)
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
glEnable(GL_CLIP_DISTANCE1);
|
||||
glEnable(GL_CLIP_DISTANCE2);
|
||||
}
|
||||
DoDrawSorted(sorted);
|
||||
if (gl.glslversion >= 1.3f)
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
glDisable(GL_CLIP_DISTANCE1);
|
||||
glDisable(GL_CLIP_DISTANCE2);
|
||||
|
@ -994,7 +1002,7 @@ static FDrawInfoList di_list;
|
|||
FDrawInfo::FDrawInfo()
|
||||
{
|
||||
next = NULL;
|
||||
if (gl.lightmethod == LM_SOFTWARE)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
dldrawlists = new GLDrawList[GLLDL_TYPES];
|
||||
}
|
||||
|
|
|
@ -30,11 +30,9 @@ enum DLDrawListType
|
|||
{
|
||||
// These are organized so that the various multipass rendering modes have to be set as few times as possible
|
||||
GLLDL_WALLS_PLAIN, // dynamic lights on normal walls
|
||||
GLLDL_WALLS_BRIGHT, // dynamic lights on brightmapped walls
|
||||
GLLDL_WALLS_MASKED, // dynamic lights on masked midtextures
|
||||
|
||||
GLLDL_FLATS_PLAIN, // dynamic lights on normal flats
|
||||
GLLDL_FLATS_BRIGHT, // dynamic lights on brightmapped flats
|
||||
GLLDL_FLATS_MASKED, // dynamic lights on masked flats
|
||||
|
||||
GLLDL_WALLS_FOG, // lights on fogged walls
|
||||
|
|
|
@ -154,7 +154,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli)
|
|||
}
|
||||
|
||||
p.Set(plane.plane);
|
||||
gl_GetLight(sub->sector->PortalGroup, p, light, false, false, lightdata);
|
||||
gl_GetLight(sub->sector->PortalGroup, p, light, false, lightdata);
|
||||
node = node->nextLight;
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
{
|
||||
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
|
||||
gl_SetPlaneTextureRotation(&plane, gltexture);
|
||||
DrawSubsectors(pass, gl.lightmethod != LM_SOFTWARE, true);
|
||||
DrawSubsectors(pass, !gl.legacyMode, true);
|
||||
gl_RenderState.EnableTextureMatrix(false);
|
||||
}
|
||||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -468,7 +468,7 @@ inline void GLFlat::PutFlat(bool fog)
|
|||
{
|
||||
Colormap.Clear();
|
||||
}
|
||||
if (gl.lightmethod == LM_SOFTWARE)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
if (PutFlatCompat(fog)) return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "gl/renderer/gl_lightdata.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_quaddrawer.h"
|
||||
#include "gl/dynlights/gl_glow.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
|
@ -128,8 +129,21 @@ void GLPortal::ClearScreen()
|
|||
bool multi = !!glIsEnabled(GL_MULTISAMPLE);
|
||||
gl_MatrixStack.Push(gl_RenderState.mViewMatrix);
|
||||
gl_MatrixStack.Push(gl_RenderState.mProjectionMatrix);
|
||||
screen->Begin2D(false);
|
||||
screen->Dim(0, 1.f, 0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
gl_RenderState.mViewMatrix.loadIdentity();
|
||||
gl_RenderState.mProjectionMatrix.ortho(0, SCREENWIDTH, SCREENHEIGHT, 0, -1.0f, 1.0f);
|
||||
gl_RenderState.ApplyMatrices();
|
||||
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
FQuadDrawer qd;
|
||||
qd.Set(0, 0, 0, 0, 0, 0);
|
||||
qd.Set(1, 0, SCREENHEIGHT, 0, 0, 0);
|
||||
qd.Set(2, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0);
|
||||
qd.Set(3, SCREENWIDTH, 0, 0, 0, 0);
|
||||
qd.Render(GL_TRIANGLE_FAN);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
gl_MatrixStack.Pop(gl_RenderState.mProjectionMatrix);
|
||||
gl_MatrixStack.Pop(gl_RenderState.mViewMatrix);
|
||||
|
@ -137,7 +151,6 @@ void GLPortal::ClearScreen()
|
|||
if (multi) glEnable(GL_MULTISAMPLE);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// DrawPortalStencil
|
||||
|
|
|
@ -409,7 +409,7 @@ void FGLRenderer::RenderScene(int recursion)
|
|||
|
||||
// this is the only geometry type on which decals can possibly appear
|
||||
gl_drawinfo->drawlists[GLDL_PLAINWALLS].DrawDecals();
|
||||
if (gl.lightmethod == LM_SOFTWARE)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
// also process the render lists with walls and dynamic lights
|
||||
gl_drawinfo->dldrawlists[GLLDL_WALLS_PLAIN].DrawDecals();
|
||||
|
@ -635,12 +635,14 @@ void FGLRenderer::DrawBlend(sector_t * viewsector)
|
|||
V_AddBlend (player->BlendR, player->BlendG, player->BlendB, player->BlendA, blend);
|
||||
}
|
||||
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
if (blend[3]>0.0f)
|
||||
{
|
||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.SetColor(blend[0], blend[1], blend[2], blend[3]);
|
||||
gl_FillScreen();
|
||||
}
|
||||
gl_RenderState.ResetColor();
|
||||
gl_RenderState.EnableTexture(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -676,16 +678,17 @@ void FGLRenderer::EndDrawScene(sector_t * viewsector)
|
|||
{
|
||||
DrawPlayerSprites (viewsector, false);
|
||||
}
|
||||
int cm = gl_RenderState.GetFixedColormap();
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
gl_RenderState.DrawColormapOverlay();
|
||||
}
|
||||
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
gl_RenderState.SetSoftLightLevel(-1);
|
||||
DrawTargeterSprites();
|
||||
DrawBlend(viewsector);
|
||||
if (gl.glslversion == 0.0)
|
||||
if (!FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
gl_RenderState.SetFixedColormap(cm);
|
||||
gl_RenderState.DrawColormapOverlay();
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
DrawBlend(viewsector);
|
||||
}
|
||||
|
||||
// Restore standard rendering state
|
||||
|
@ -768,7 +771,7 @@ void FGLRenderer::SetFixedColormap (player_t *player)
|
|||
|
||||
sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen)
|
||||
{
|
||||
sector_t * retval;
|
||||
sector_t * lviewsector;
|
||||
mSceneClearColor[0] = 0.0f;
|
||||
mSceneClearColor[1] = 0.0f;
|
||||
mSceneClearColor[2] = 0.0f;
|
||||
|
@ -815,11 +818,11 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
|||
}
|
||||
|
||||
// 'viewsector' will not survive the rendering so it cannot be used anymore below.
|
||||
retval = viewsector;
|
||||
lviewsector = viewsector;
|
||||
|
||||
// Render (potentially) multiple views for stereo 3d
|
||||
float viewShift[3];
|
||||
const s3d::Stereo3DMode& stereo3dMode = s3d::Stereo3DMode::getCurrentMode();
|
||||
const s3d::Stereo3DMode& stereo3dMode = mainview && toscreen? s3d::Stereo3DMode::getCurrentMode() : s3d::Stereo3DMode::getMonoMode();
|
||||
stereo3dMode.SetUp();
|
||||
for (int eye_ix = 0; eye_ix < stereo3dMode.eye_count(); ++eye_ix)
|
||||
{
|
||||
|
@ -845,13 +848,19 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
|||
clipper.SafeAddClipRangeRealAngles(ViewAngle.BAMs() + a1, ViewAngle.BAMs() - a1);
|
||||
|
||||
ProcessScene(toscreen);
|
||||
if (mainview && toscreen) EndDrawScene(retval); // do not call this for camera textures.
|
||||
if (mainview)
|
||||
if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures.
|
||||
if (mainview && FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
if (FGLRenderBuffers::IsEnabled()) mBuffers->BlitSceneToTexture();
|
||||
mBuffers->BlitSceneToTexture();
|
||||
BloomScene();
|
||||
TonemapScene();
|
||||
ColormapScene();
|
||||
LensDistortScene();
|
||||
|
||||
// This should be done after postprocessing, not before.
|
||||
mBuffers->BindCurrentFB();
|
||||
glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height);
|
||||
DrawBlend(lviewsector);
|
||||
}
|
||||
mDrawingScene2D = false;
|
||||
eye->TearDown();
|
||||
|
@ -860,7 +869,7 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
|
|||
|
||||
gl_frameCount++; // This counter must be increased right before the interpolations are restored.
|
||||
interpolator.RestoreInterpolations ();
|
||||
return retval;
|
||||
return lviewsector;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -896,7 +905,7 @@ void FGLRenderer::RenderView (player_t* player)
|
|||
|
||||
P_FindParticleSubsectors ();
|
||||
|
||||
if (gl.lightmethod != LM_SOFTWARE) GLRenderer->mLights->Clear();
|
||||
if (!gl.legacyMode) GLRenderer->mLights->Clear();
|
||||
|
||||
// NoInterpolateView should have no bearing on camera textures, but needs to be preserved for the main view below.
|
||||
bool saved_niv = NoInterpolateView;
|
||||
|
@ -951,7 +960,7 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei
|
|||
SetFixedColormap(player);
|
||||
gl_RenderState.SetVertexBuffer(mVBO);
|
||||
GLRenderer->mVBO->Reset();
|
||||
if (gl.lightmethod != LM_SOFTWARE) GLRenderer->mLights->Clear();
|
||||
if (!gl.legacyMode) GLRenderer->mLights->Clear();
|
||||
|
||||
// Check if there's some lights. If not some code can be skipped.
|
||||
TThinkerIterator<ADynamicLight> it(STAT_DLIGHT);
|
||||
|
@ -963,7 +972,10 @@ void FGLRenderer::WriteSavePic (player_t *player, FILE *file, int width, int hei
|
|||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
gl_RenderState.SetSoftLightLevel(-1);
|
||||
screen->Begin2D(false);
|
||||
DrawBlend(viewsector);
|
||||
if (!FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
DrawBlend(viewsector);
|
||||
}
|
||||
CopyToBackbuffer(&bounds, false);
|
||||
glFlush();
|
||||
|
||||
|
@ -1305,29 +1317,16 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
gl_fixedcolormap=CM_DEFAULT;
|
||||
gl_RenderState.SetFixedColormap(CM_DEFAULT);
|
||||
|
||||
bool usefb = gl_usefb || gltex->GetWidth() > screen->GetWidth() || gltex->GetHeight() > screen->GetHeight();
|
||||
if (!usefb)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
// In legacy mode, fail if the requested texture is too large.
|
||||
if (gltex->GetWidth() > screen->GetWidth() || gltex->GetHeight() > screen->GetHeight()) return;
|
||||
glFlush();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__INTEL_COMPILER))
|
||||
__try
|
||||
#endif
|
||||
{
|
||||
GLRenderer->StartOffscreen();
|
||||
gltex->BindToFrameBuffer();
|
||||
}
|
||||
#if defined(_WIN32) && (defined(_MSC_VER) || defined(__INTEL_COMPILER))
|
||||
__except(1)
|
||||
{
|
||||
usefb = false;
|
||||
gl_usefb = false;
|
||||
GLRenderer->EndOffscreen();
|
||||
glFlush();
|
||||
}
|
||||
#endif
|
||||
GLRenderer->StartOffscreen();
|
||||
gltex->BindToFrameBuffer();
|
||||
}
|
||||
|
||||
GL_IRECT bounds;
|
||||
|
@ -1337,7 +1336,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
|
|||
|
||||
GLRenderer->RenderViewpoint(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false, false);
|
||||
|
||||
if (!usefb)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
glFlush();
|
||||
gl_RenderState.SetMaterial(gltex, 0, 0, -1, false);
|
||||
|
|
|
@ -87,7 +87,7 @@ FSkyVertexBuffer::~FSkyVertexBuffer()
|
|||
void FSkyVertexBuffer::BindVBO()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_id);
|
||||
if (gl.glslversion > 0)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FSkyVertex), &VSO->x);
|
||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FSkyVertex), &VSO->u);
|
||||
|
@ -321,7 +321,7 @@ void FSkyVertexBuffer::RenderDome(FMaterial *tex, int mode)
|
|||
RenderRow(GL_TRIANGLE_FAN, rc);
|
||||
gl_RenderState.EnableTexture(true);
|
||||
// The color array can only be activated now if this is drawn without shader
|
||||
if (gl.glslversion == 0)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
|
|
@ -870,7 +870,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
RenderStyle.CheckFuzz();
|
||||
if (RenderStyle.BlendOp == STYLEOP_Fuzz)
|
||||
{
|
||||
if (gl_fuzztype != 0 && gl.glslversion > 0)
|
||||
if (gl_fuzztype != 0 && !gl.legacyMode)
|
||||
{
|
||||
// Todo: implement shader selection here
|
||||
RenderStyle = LegacyRenderStyles[STYLE_Translucent];
|
||||
|
|
|
@ -96,7 +96,7 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t *
|
|||
dist = FVector3(x - light->X(), y - light->Y(), z - light->Z()).LengthSquared();
|
||||
}
|
||||
|
||||
radius = light->GetRadius() * gl_lights_size;
|
||||
radius = light->GetRadius();
|
||||
|
||||
if (dist < radius * radius)
|
||||
{
|
||||
|
@ -106,9 +106,9 @@ void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t *
|
|||
|
||||
if (frac > 0)
|
||||
{
|
||||
lr = light->GetRed() / 255.0f * gl_lights_intensity;
|
||||
lg = light->GetGreen() / 255.0f * gl_lights_intensity;
|
||||
lb = light->GetBlue() / 255.0f * gl_lights_intensity;
|
||||
lr = light->GetRed() / 255.0f;
|
||||
lg = light->GetGreen() / 255.0f;
|
||||
lb = light->GetBlue() / 255.0f;
|
||||
if (light->IsSubtractive())
|
||||
{
|
||||
float bright = FVector3(lr, lg, lb).Length();
|
||||
|
|
|
@ -140,7 +140,7 @@ void GLWall::PutWall(bool translucent)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (gl.lightmethod == LM_SOFTWARE && !translucent)
|
||||
if (gl.legacyMode && !translucent)
|
||||
{
|
||||
if (PutWallCompat(passflag[type])) return;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ void GLWall::SetupLights()
|
|||
float y = node->lightsource->Y();
|
||||
float z = node->lightsource->Z();
|
||||
float dist = fabsf(p.DistToPoint(x, z, y));
|
||||
float radius = (node->lightsource->GetRadius() * gl_lights_size);
|
||||
float radius = node->lightsource->GetRadius();
|
||||
float scale = 1.0f / ((2.f * radius) - dist);
|
||||
|
||||
if (radius > 0.f && dist < radius)
|
||||
|
@ -158,7 +158,7 @@ void GLWall::SetupLights()
|
|||
}
|
||||
if (outcnt[0]!=4 && outcnt[1]!=4 && outcnt[2]!=4 && outcnt[3]!=4)
|
||||
{
|
||||
gl_GetLight(seg->frontsector->PortalGroup, p, node->lightsource, true, false, lightdata);
|
||||
gl_GetLight(seg->frontsector->PortalGroup, p, node->lightsource, true, lightdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,9 +216,8 @@ void GLWall::RenderWall(int textured)
|
|||
}
|
||||
else if (vertcount == 0)
|
||||
{
|
||||
// in case we get here without valid vertex data and no ability to create them now,
|
||||
// use the quad drawer as fallback (without edge splitting.)
|
||||
// This can only happen in one special situation, when a translucent line got split during sorting.
|
||||
// This should never happen but in case it actually does, use the quad drawer as fallback (without edge splitting.)
|
||||
// This way it at least gets drawn.
|
||||
FQuadDrawer qd;
|
||||
qd.Set(0, glseg.x1, zbottom[0], glseg.y1, tcs[LOLFT].u, tcs[LOLFT].v);
|
||||
qd.Set(1, glseg.x1, ztop[0], glseg.y1, tcs[UPLFT].u, tcs[UPLFT].v);
|
||||
|
@ -242,7 +241,7 @@ void GLWall::RenderFogBoundary()
|
|||
{
|
||||
if (gl_fogmode && gl_fixedcolormap == 0)
|
||||
{
|
||||
if (gl.glslversion > 0.f)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
int rel = rellight + getExtraLight();
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
|
@ -276,7 +275,7 @@ void GLWall::RenderMirrorSurface()
|
|||
Vector v(glseg.y2-glseg.y1, 0 ,-glseg.x2+glseg.x1);
|
||||
v.Normalize();
|
||||
|
||||
if (gl.glslversion >= 0.f)
|
||||
if (!gl.legacyMode)
|
||||
{
|
||||
// we use texture coordinates and texture matrix to pass the normal stuff to the shader so that the default vertex buffer format can be used as is.
|
||||
tcs[LOLFT].u = tcs[LORGT].u = tcs[UPLFT].u = tcs[UPRGT].u = v.X();
|
||||
|
|
|
@ -87,20 +87,6 @@ void FBlurShader::Blur(FGLRenderer *renderer, float blurAmount, int sampleCount,
|
|||
else
|
||||
setup->HorizontalShader->Bind();
|
||||
|
||||
if (gl.glslversion < 1.3)
|
||||
{
|
||||
if (vertical)
|
||||
{
|
||||
setup->VerticalScaleX.Set(1.0f / width);
|
||||
setup->VerticalScaleY.Set(1.0f / height);
|
||||
}
|
||||
else
|
||||
{
|
||||
setup->HorizontalScaleX.Set(1.0f / width);
|
||||
setup->HorizontalScaleY.Set(1.0f / height);
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, inputTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
@ -156,14 +142,6 @@ FBlurShader::BlurSetup *FBlurShader::GetSetup(float blurAmount, int sampleCount)
|
|||
blurSetup.HorizontalShader->Bind();
|
||||
glUniform1i(glGetUniformLocation(*blurSetup.HorizontalShader.get(), "SourceTexture"), 0);
|
||||
|
||||
if (gl.glslversion < 1.3)
|
||||
{
|
||||
blurSetup.VerticalScaleX.Init(*blurSetup.VerticalShader.get(), "ScaleX");
|
||||
blurSetup.VerticalScaleY.Init(*blurSetup.VerticalShader.get(), "ScaleY");
|
||||
blurSetup.HorizontalScaleX.Init(*blurSetup.HorizontalShader.get(), "ScaleX");
|
||||
blurSetup.HorizontalScaleY.Init(*blurSetup.HorizontalShader.get(), "ScaleY");
|
||||
}
|
||||
|
||||
mBlurSetups.Push(blurSetup);
|
||||
|
||||
return &mBlurSetups[mBlurSetups.Size() - 1];
|
||||
|
|
67
src/gl/shaders/gl_colormapshader.cpp
Normal file
67
src/gl/shaders/gl_colormapshader.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
** gl_colormapshader.cpp
|
||||
** Applies a fullscreen colormap to the scene
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2016 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.
|
||||
** 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
|
||||
** 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 "gl/system/gl_system.h"
|
||||
#include "files.h"
|
||||
#include "m_swap.h"
|
||||
#include "v_video.h"
|
||||
#include "gl/gl_functions.h"
|
||||
#include "vectors.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/shaders/gl_colormapshader.h"
|
||||
|
||||
void FColormapShader::Bind()
|
||||
{
|
||||
auto &shader = mShader;
|
||||
if (!shader)
|
||||
{
|
||||
shader.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 330);
|
||||
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/colormap.fp", "", 330);
|
||||
shader.SetFragDataLocation(0, "FragColor");
|
||||
shader.Link("shaders/glsl/colormap");
|
||||
shader.SetAttribLocation(0, "PositionInProjection");
|
||||
MapStart.Init(shader, "uFixedColormapStart");
|
||||
MapRange.Init(shader, "uFixedColormapRange");
|
||||
}
|
||||
shader.Bind();
|
||||
}
|
||||
|
20
src/gl/shaders/gl_colormapshader.h
Normal file
20
src/gl/shaders/gl_colormapshader.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef __GL_COLORMAPSHADER_H
|
||||
#define __GL_COLORMAPSHADER_H
|
||||
|
||||
#include "gl_shaderprogram.h"
|
||||
|
||||
class FColormapShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniformSampler SceneTexture;
|
||||
FUniform4f MapStart;
|
||||
FUniform4f MapRange;
|
||||
|
||||
private:
|
||||
|
||||
FShaderProgram mShader;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -91,40 +91,27 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
//
|
||||
FString vp_comb;
|
||||
|
||||
if (gl.lightmethod == LM_SOFTWARE)
|
||||
assert(GLRenderer->mLights != NULL);
|
||||
// On the shader side there is no difference between LM_DEFERRED and LM_DIRECT, it only decides how the buffer is initialized.
|
||||
unsigned int lightbuffertype = GLRenderer->mLights->GetBufferType();
|
||||
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
|
||||
if (lightbuffertype == GL_UNIFORM_BUFFER)
|
||||
{
|
||||
if (gl.glslversion >= 1.3)
|
||||
// This differentiation is for some Intel drivers which fail on #extension, so use of #version 140 is necessary
|
||||
if (gl.glslversion < 1.4f)
|
||||
{
|
||||
vp_comb = "#version 130\n";
|
||||
vp_comb.Format("#version 130\n#extension GL_ARB_uniform_buffer_object : require\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp_comb = "#define GLSL12_COMPATIBLE\n";
|
||||
vp_comb.Format("#version 140\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(GLRenderer->mLights != NULL);
|
||||
// On the shader side there is no difference between LM_DEFERRED and LM_DIRECT, it only matters which buffer type is used by the light buffer.
|
||||
unsigned int lightbuffertype = GLRenderer->mLights->GetBufferType();
|
||||
unsigned int lightbuffersize = GLRenderer->mLights->GetBlockSize();
|
||||
if (lightbuffertype == GL_UNIFORM_BUFFER)
|
||||
{
|
||||
// This differentiation is for some Intel drivers which fail on #extension, so use of #version 140 is necessary
|
||||
if (gl.glslversion < 1.4f || gl.version < 3.1f)
|
||||
{
|
||||
vp_comb.Format("#version 130\n#extension GL_ARB_uniform_buffer_object : require\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
else
|
||||
{
|
||||
vp_comb.Format("#version 140\n#define NUM_UBO_LIGHTS %d\n", lightbuffersize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n";
|
||||
}
|
||||
vp_comb = "#version 400 core\n#extension GL_ARB_shader_storage_buffer_object : require\n#define SHADER_STORAGE_LIGHTS\n";
|
||||
}
|
||||
|
||||
if (gl.buffermethod == BM_DEFERRED)
|
||||
{
|
||||
vp_comb << "#define USE_QUAD_DRAWER\n";
|
||||
|
@ -169,12 +156,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
}
|
||||
}
|
||||
|
||||
if (gl.glslversion < 1.3)
|
||||
{
|
||||
FShaderProgram::PatchVertShader(vp_comb);
|
||||
FShaderProgram::PatchFragShader(fp_comb);
|
||||
}
|
||||
else if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES)
|
||||
{
|
||||
// On ATI's GL3 drivers we have to disable gl_ClipDistance because it's hopelessly broken.
|
||||
// This will cause some glitches and regressions but is the only way to avoid total display garbage.
|
||||
|
@ -273,7 +255,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
texcoordmatrix_index = glGetUniformLocation(hShader, "uQuadTexCoords");
|
||||
quadmode_index = glGetUniformLocation(hShader, "uQuadMode");
|
||||
|
||||
if (LM_SOFTWARE != gl.lightmethod && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
if (!gl.legacyMode && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
int tempindex = glGetUniformBlockIndex(hShader, "LightBufferUBO");
|
||||
if (tempindex != -1) glUniformBlockBinding(hShader, tempindex, LIGHTBUF_BINDINGPOINT);
|
||||
|
@ -424,7 +406,7 @@ static const FEffectShader effectshaders[]=
|
|||
|
||||
FShaderManager::FShaderManager()
|
||||
{
|
||||
if (gl.glslversion > 0) CompileShaders();
|
||||
if (!gl.legacyMode) CompileShaders();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -435,7 +417,7 @@ FShaderManager::FShaderManager()
|
|||
|
||||
FShaderManager::~FShaderManager()
|
||||
{
|
||||
if (gl.glslversion > 0) Clean();
|
||||
if (!gl.legacyMode) Clean();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -577,7 +559,7 @@ EXTERN_CVAR(Int, gl_fuzztype)
|
|||
|
||||
void FShaderManager::ApplyMatrices(VSMatrix *proj, VSMatrix *view)
|
||||
{
|
||||
if (gl.glslversion == 0)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf(proj->get());
|
||||
|
|
|
@ -12,7 +12,8 @@ enum
|
|||
VATTR_VERTEX = 0,
|
||||
VATTR_TEXCOORD = 1,
|
||||
VATTR_COLOR = 2,
|
||||
VATTR_VERTEX2 = 3
|
||||
VATTR_VERTEX2 = 3,
|
||||
VATTR_NORMAL = 4
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -240,24 +240,13 @@ FString FShaderProgram::PatchShader(ShaderType type, const FString &code, const
|
|||
if (defines)
|
||||
patchedCode << defines;
|
||||
|
||||
if (gl.glslversion >= 1.3)
|
||||
{
|
||||
// these settings are actually pointless but there seem to be some old ATI drivers that fail to compile the shader without setting the precision here.
|
||||
patchedCode << "precision highp int;\n";
|
||||
patchedCode << "precision highp float;\n";
|
||||
}
|
||||
// these settings are actually pointless but there seem to be some old ATI drivers that fail to compile the shader without setting the precision here.
|
||||
patchedCode << "precision highp int;\n";
|
||||
patchedCode << "precision highp float;\n";
|
||||
|
||||
patchedCode << "#line 1\n";
|
||||
patchedCode << code;
|
||||
|
||||
if (gl.glslversion < 1.3)
|
||||
{
|
||||
if (type == Vertex)
|
||||
PatchVertShader(patchedCode);
|
||||
else if (type == Fragment)
|
||||
PatchFragShader(patchedCode);
|
||||
}
|
||||
|
||||
return patchedCode;
|
||||
}
|
||||
|
||||
|
@ -268,36 +257,3 @@ FString FShaderProgram::PatchShader(ShaderType type, const FString &code, const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FShaderProgram::PatchCommon(FString &code)
|
||||
{
|
||||
code.Substitute("precision highp int;", "");
|
||||
code.Substitute("precision highp float;", "");
|
||||
}
|
||||
|
||||
void FShaderProgram::PatchVertShader(FString &code)
|
||||
{
|
||||
PatchCommon(code);
|
||||
code.Substitute("in vec", "attribute vec");
|
||||
code.Substitute("in float", "attribute float");
|
||||
code.Substitute("out vec", "varying vec");
|
||||
code.Substitute("out float", "varying float");
|
||||
code.Substitute("gl_ClipDistance", "//");
|
||||
}
|
||||
|
||||
void FShaderProgram::PatchFragShader(FString &code)
|
||||
{
|
||||
PatchCommon(code);
|
||||
code.Substitute("out vec4 FragColor;", "");
|
||||
code.Substitute("FragColor", "gl_FragColor");
|
||||
code.Substitute("in vec", "varying vec");
|
||||
// this patches the switch statement to if's.
|
||||
code.Substitute("break;", "");
|
||||
code.Substitute("switch (uFixedColormap)", "int i = uFixedColormap;");
|
||||
code.Substitute("case 0:", "if (i == 0)");
|
||||
code.Substitute("case 1:", "else if (i == 1)");
|
||||
code.Substitute("case 2:", "else if (i == 2)");
|
||||
code.Substitute("case 3:", "else if (i == 3)");
|
||||
code.Substitute("case 4:", "else if (i == 4)");
|
||||
code.Substitute("case 5:", "else if (i == 5)");
|
||||
code.Substitute("texture(", "texture2D(");
|
||||
}
|
||||
|
|
|
@ -26,16 +26,11 @@ public:
|
|||
operator GLuint() const { return mProgram; }
|
||||
explicit operator bool() const { return mProgram != 0; }
|
||||
|
||||
// Needed by FShader
|
||||
static void PatchVertShader(FString &code);
|
||||
static void PatchFragShader(FString &code);
|
||||
|
||||
private:
|
||||
FShaderProgram(const FShaderProgram &) = delete;
|
||||
FShaderProgram &operator=(const FShaderProgram &) = delete;
|
||||
|
||||
static FString PatchShader(ShaderType type, const FString &code, const char *defines, int maxGlslVersion);
|
||||
static void PatchCommon(FString &code);
|
||||
|
||||
void CreateShader(ShaderType type);
|
||||
FString GetShaderInfoLog(GLuint handle);
|
||||
|
|
|
@ -74,6 +74,7 @@ class Stereo3DMode
|
|||
public:
|
||||
/* static methods for managing the selected stereoscopic view state */
|
||||
static const Stereo3DMode& getCurrentMode();
|
||||
static const Stereo3DMode& getMonoMode();
|
||||
|
||||
Stereo3DMode();
|
||||
virtual ~Stereo3DMode();
|
||||
|
|
|
@ -105,5 +105,12 @@ const Stereo3DMode& Stereo3DMode::getCurrentMode()
|
|||
return *currentStereo3DMode;
|
||||
}
|
||||
|
||||
const Stereo3DMode& Stereo3DMode::getMonoMode()
|
||||
{
|
||||
setCurrentMode(MonoView::getInstance());
|
||||
return *currentStereo3DMode;
|
||||
}
|
||||
|
||||
|
||||
} /* namespace s3d */
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@ EXTERN_CVAR(Int, gl_weaponlight)
|
|||
EXTERN_CVAR (Bool, gl_lights);
|
||||
EXTERN_CVAR (Bool, gl_attachedlights);
|
||||
EXTERN_CVAR (Bool, gl_lights_checkside);
|
||||
EXTERN_CVAR (Float, gl_lights_intensity);
|
||||
EXTERN_CVAR (Float, gl_lights_size);
|
||||
EXTERN_CVAR (Bool, gl_lights_additive);
|
||||
EXTERN_CVAR (Bool, gl_light_sprites);
|
||||
EXTERN_CVAR (Bool, gl_light_particles);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
glEnable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_CLAMP);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
if (gl.glslversion == 0) glEnable(GL_TEXTURE_2D);
|
||||
if (gl.legacyMode) glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
|
|
@ -154,10 +154,10 @@ void gl_LoadExtensions()
|
|||
else Printf("Emulating OpenGL v %s\n", version);
|
||||
}
|
||||
|
||||
gl.version = strtod(version, NULL) + 0.01f;
|
||||
float gl_version = (float)strtod(version, NULL) + 0.01f;
|
||||
|
||||
// Don't even start if it's lower than 2.0 or no framebuffers are available
|
||||
if ((gl.version < 2.0 || !CheckExtension("GL_EXT_framebuffer_object")) && gl.version < 3.0)
|
||||
// Don't even start if it's lower than 2.0 or no framebuffers are available (The framebuffer extension is needed for glGenerateMipmapsEXT!)
|
||||
if ((gl_version < 2.0f || !CheckExtension("GL_EXT_framebuffer_object")) && gl_version < 3.0f)
|
||||
{
|
||||
I_FatalError("Unsupported OpenGL version.\nAt least OpenGL 2.0 with framebuffer support is required to run " GAMENAME ".\n");
|
||||
}
|
||||
|
@ -166,105 +166,86 @@ void gl_LoadExtensions()
|
|||
gl.glslversion = strtod((char*)glGetString(GL_SHADING_LANGUAGE_VERSION), NULL) + 0.01f;
|
||||
|
||||
gl.vendorstring = (char*)glGetString(GL_VENDOR);
|
||||
gl.lightmethod = LM_SOFTWARE;
|
||||
gl.buffermethod = BM_CLIENTARRAY;
|
||||
|
||||
if ((gl.version >= 3.3f || CheckExtension("GL_ARB_sampler_objects")) && !Args->CheckParm("-nosampler"))
|
||||
// first test for optional features
|
||||
if (CheckExtension("GL_ARB_texture_compression")) gl.flags |= RFL_TEXTURE_COMPRESSION;
|
||||
if (CheckExtension("GL_EXT_texture_compression_s3tc")) gl.flags |= RFL_TEXTURE_COMPRESSION_S3TC;
|
||||
|
||||
if ((gl_version >= 3.3f || CheckExtension("GL_ARB_sampler_objects")) && !Args->CheckParm("-nosampler"))
|
||||
{
|
||||
gl.flags |= RFL_SAMPLER_OBJECTS;
|
||||
}
|
||||
|
||||
// Buffer lighting is only feasible with GLSL 1.3 and higher, even if 1.2 supports the extension.
|
||||
if (gl.version > 3.0f && (gl.version >= 3.3f || CheckExtension("GL_ARB_uniform_buffer_object")))
|
||||
// The minimum requirement for the modern render path are GL 3.0 + uniform buffers
|
||||
if (gl_version < 3.0f || (gl_version < 3.1f && !CheckExtension("GL_ARB_uniform_buffer_object")))
|
||||
{
|
||||
gl.lightmethod = LM_DEFERRED;
|
||||
gl.buffermethod = BM_DEFERRED;
|
||||
}
|
||||
|
||||
if (CheckExtension("GL_ARB_texture_compression")) gl.flags |= RFL_TEXTURE_COMPRESSION;
|
||||
if (CheckExtension("GL_EXT_texture_compression_s3tc")) gl.flags |= RFL_TEXTURE_COMPRESSION_S3TC;
|
||||
|
||||
if (Args->CheckParm("-noshader")/* || gl.glslversion < 1.2f*/)
|
||||
{
|
||||
gl.version = 2.11f;
|
||||
gl.legacyMode = true;
|
||||
gl.lightmethod = LM_LEGACY;
|
||||
gl.buffermethod = BM_LEGACY;
|
||||
gl.glslversion = 0;
|
||||
gl.lightmethod = LM_SOFTWARE;
|
||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||
}
|
||||
else if (gl.version < 3.0f)
|
||||
{
|
||||
if (CheckExtension("GL_NV_GPU_shader4") || CheckExtension("GL_EXT_GPU_shader4")) gl.glslversion = 1.21f; // for pre-3.0 drivers that support capable hardware. Needed for Apple.
|
||||
else
|
||||
{
|
||||
gl.buffermethod = BM_CLIENTARRAY;
|
||||
gl.glslversion = 0;
|
||||
}
|
||||
|
||||
if (!CheckExtension("GL_EXT_packed_float")) gl.flags |= RFL_NO_RGBA16F;
|
||||
if (!CheckExtension("GL_EXT_packed_depth_stencil")) gl.flags |= RFL_NO_DEPTHSTENCIL;
|
||||
gl.flags |= RFL_NO_CLIP_PLANES;
|
||||
}
|
||||
else if (gl.version < 4.f)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (strstr(gl.vendorstring, "ATI Tech"))
|
||||
{
|
||||
gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (gl.version < 4.5f)
|
||||
{
|
||||
// don't use GL 4.x features when running in GL 3 emulation mode.
|
||||
if (CheckExtension("GL_ARB_buffer_storage"))
|
||||
{
|
||||
// work around a problem with older AMD drivers: Their implementation of shader storage buffer objects is piss-poor and does not match uniform buffers even closely.
|
||||
// Recent drivers, GL 4.4 don't have this problem, these can easily be recognized by also supporting the GL_ARB_buffer_storage extension.
|
||||
if (CheckExtension("GL_ARB_shader_storage_buffer_object"))
|
||||
{
|
||||
// Shader storage buffer objects are broken on current Intel drivers.
|
||||
if (strstr(gl.vendorstring, "Intel") == NULL)
|
||||
{
|
||||
gl.flags |= RFL_SHADER_STORAGE_BUFFER;
|
||||
}
|
||||
}
|
||||
gl.flags |= RFL_BUFFER_STORAGE;
|
||||
gl.lightmethod = LM_DIRECT;
|
||||
gl.buffermethod = BM_PERSISTENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.version = 3.3f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume that everything works without problems on GL 4.5 drivers where these things are core features.
|
||||
gl.flags |= RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE;
|
||||
gl.lightmethod = LM_DIRECT;
|
||||
gl.buffermethod = BM_PERSISTENT;
|
||||
}
|
||||
gl.legacyMode = false;
|
||||
gl.lightmethod = LM_DEFERRED;
|
||||
gl.buffermethod = BM_DEFERRED;
|
||||
if (gl_version < 4.f)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (strstr(gl.vendorstring, "ATI Tech"))
|
||||
{
|
||||
gl.flags |= RFL_NO_CLIP_PLANES; // gl_ClipDistance is horribly broken on ATI GL3 drivers for Windows.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (gl_version < 4.5f)
|
||||
{
|
||||
// don't use GL 4.x features when running a GL 3.x context.
|
||||
if (CheckExtension("GL_ARB_buffer_storage"))
|
||||
{
|
||||
// work around a problem with older AMD drivers: Their implementation of shader storage buffer objects is piss-poor and does not match uniform buffers even closely.
|
||||
// Recent drivers, GL 4.4 don't have this problem, these can easily be recognized by also supporting the GL_ARB_buffer_storage extension.
|
||||
if (CheckExtension("GL_ARB_shader_storage_buffer_object"))
|
||||
{
|
||||
// Shader storage buffer objects are broken on current Intel drivers.
|
||||
if (strstr(gl.vendorstring, "Intel") == NULL)
|
||||
{
|
||||
gl.flags |= RFL_SHADER_STORAGE_BUFFER;
|
||||
}
|
||||
}
|
||||
gl.flags |= RFL_BUFFER_STORAGE;
|
||||
gl.lightmethod = LM_DIRECT;
|
||||
gl.buffermethod = BM_PERSISTENT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume that everything works without problems on GL 4.5 drivers where these things are core features.
|
||||
gl.flags |= RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE;
|
||||
gl.lightmethod = LM_DIRECT;
|
||||
gl.buffermethod = BM_PERSISTENT;
|
||||
}
|
||||
|
||||
if (gl.version >= 4.3f || CheckExtension("GL_ARB_invalidate_subdata")) gl.flags |= RFL_INVALIDATE_BUFFER;
|
||||
if (gl.version >= 4.3f || CheckExtension("GL_KHR_debug")) gl.flags |= RFL_DEBUG;
|
||||
if (gl_version >= 4.3f || CheckExtension("GL_ARB_invalidate_subdata")) gl.flags |= RFL_INVALIDATE_BUFFER;
|
||||
if (gl_version >= 4.3f || CheckExtension("GL_KHR_debug")) gl.flags |= RFL_DEBUG;
|
||||
|
||||
const char *lm = Args->CheckValue("-lightmethod");
|
||||
if (lm != NULL)
|
||||
{
|
||||
if (!stricmp(lm, "deferred") && gl.lightmethod == LM_DIRECT) gl.lightmethod = LM_DEFERRED;
|
||||
if (!stricmp(lm, "textured")) gl.lightmethod = LM_SOFTWARE;
|
||||
}
|
||||
const char *lm = Args->CheckValue("-lightmethod");
|
||||
if (lm != NULL)
|
||||
{
|
||||
if (!stricmp(lm, "deferred") && gl.lightmethod == LM_DIRECT) gl.lightmethod = LM_DEFERRED;
|
||||
}
|
||||
|
||||
lm = Args->CheckValue("-buffermethod");
|
||||
if (lm != NULL)
|
||||
{
|
||||
if (!stricmp(lm, "deferred") && gl.buffermethod == BM_PERSISTENT) gl.buffermethod = BM_DEFERRED;
|
||||
if (!stricmp(lm, "clientarray")) gl.buffermethod = BM_CLIENTARRAY;
|
||||
lm = Args->CheckValue("-buffermethod");
|
||||
if (lm != NULL)
|
||||
{
|
||||
if (!stricmp(lm, "deferred") && gl.buffermethod == BM_PERSISTENT) gl.buffermethod = BM_DEFERRED;
|
||||
}
|
||||
}
|
||||
|
||||
int v;
|
||||
|
||||
if (gl.lightmethod != LM_SOFTWARE && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
if (!gl.legacyMode && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, &v);
|
||||
gl.maxuniforms = v;
|
||||
|
@ -284,24 +265,27 @@ void gl_LoadExtensions()
|
|||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl.max_texturesize);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
// fudge a bit with the framebuffer stuff to avoid redundancies in the main code. Some of the older cards do not have the ARB stuff but the calls are nearly identical.
|
||||
FUDGE_FUNC(glGenerateMipmap, EXT);
|
||||
FUDGE_FUNC(glGenFramebuffers, EXT);
|
||||
FUDGE_FUNC(glBindFramebuffer, EXT);
|
||||
FUDGE_FUNC(glDeleteFramebuffers, EXT);
|
||||
FUDGE_FUNC(glFramebufferTexture2D, EXT);
|
||||
FUDGE_FUNC(glGenerateMipmap, EXT);
|
||||
FUDGE_FUNC(glGenFramebuffers, EXT);
|
||||
FUDGE_FUNC(glBindFramebuffer, EXT);
|
||||
FUDGE_FUNC(glDeleteFramebuffers, EXT);
|
||||
FUDGE_FUNC(glFramebufferTexture2D, EXT);
|
||||
FUDGE_FUNC(glFramebufferRenderbuffer, EXT);
|
||||
FUDGE_FUNC(glGenRenderbuffers, EXT);
|
||||
FUDGE_FUNC(glDeleteRenderbuffers, EXT);
|
||||
FUDGE_FUNC(glRenderbufferStorage, EXT);
|
||||
FUDGE_FUNC(glBindRenderbuffer, EXT);
|
||||
FUDGE_FUNC(glCheckFramebufferStatus, EXT);
|
||||
gl_PatchMenu();
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
// fudge a bit with the framebuffer stuff to avoid redundancies in the main code. Some of the older cards do not have the ARB stuff but the calls are nearly identical.
|
||||
FUDGE_FUNC(glGenerateMipmap, EXT);
|
||||
FUDGE_FUNC(glGenFramebuffers, EXT);
|
||||
FUDGE_FUNC(glBindFramebuffer, EXT);
|
||||
FUDGE_FUNC(glDeleteFramebuffers, EXT);
|
||||
FUDGE_FUNC(glFramebufferTexture2D, EXT);
|
||||
FUDGE_FUNC(glGenerateMipmap, EXT);
|
||||
FUDGE_FUNC(glGenFramebuffers, EXT);
|
||||
FUDGE_FUNC(glBindFramebuffer, EXT);
|
||||
FUDGE_FUNC(glDeleteFramebuffers, EXT);
|
||||
FUDGE_FUNC(glFramebufferTexture2D, EXT);
|
||||
FUDGE_FUNC(glFramebufferRenderbuffer, EXT);
|
||||
FUDGE_FUNC(glGenRenderbuffers, EXT);
|
||||
FUDGE_FUNC(glDeleteRenderbuffers, EXT);
|
||||
FUDGE_FUNC(glRenderbufferStorage, EXT);
|
||||
FUDGE_FUNC(glBindRenderbuffer, EXT);
|
||||
FUDGE_FUNC(glCheckFramebufferStatus, EXT);
|
||||
gl_PatchMenu();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -313,7 +297,7 @@ void gl_LoadExtensions()
|
|||
void gl_PrintStartupLog()
|
||||
{
|
||||
int v = 0;
|
||||
if (gl.version >= 3.2) glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &v);
|
||||
if (!gl.legacyMode) glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &v);
|
||||
|
||||
Printf ("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
|
||||
Printf ("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
|
||||
|
@ -332,7 +316,7 @@ void gl_PrintStartupLog()
|
|||
glGetIntegerv(GL_MAX_VARYING_FLOATS, &v);
|
||||
Printf ("Max. varying: %d\n", v);
|
||||
|
||||
if (gl.lightmethod != LM_SOFTWARE && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
if (!gl.legacyMode && !(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &v);
|
||||
Printf ("Max. uniform block size: %d\n", v);
|
||||
|
@ -349,7 +333,7 @@ void gl_PrintStartupLog()
|
|||
}
|
||||
|
||||
// For shader-less, the special alphatexture translation must be changed to actually set the alpha, because it won't get translated by a shader.
|
||||
if (gl.glslversion == 0)
|
||||
if (gl.legacyMode)
|
||||
{
|
||||
FRemapTable *remap = translationtables[TRANSLATION_Standard][8];
|
||||
for (int i = 0; i < 256; i++)
|
||||
|
|
|
@ -21,12 +21,10 @@ enum RenderFlags
|
|||
RFL_BUFFER_STORAGE = 8,
|
||||
RFL_SAMPLER_OBJECTS = 16,
|
||||
|
||||
RFL_NO_RGBA16F = 32,
|
||||
RFL_NO_DEPTHSTENCIL = 64,
|
||||
RFL_NO_CLIP_PLANES = 128,
|
||||
RFL_NO_CLIP_PLANES = 32,
|
||||
|
||||
RFL_INVALIDATE_BUFFER = 256,
|
||||
RFL_DEBUG = 512
|
||||
RFL_INVALIDATE_BUFFER = 64,
|
||||
RFL_DEBUG = 128
|
||||
};
|
||||
|
||||
enum TexMode
|
||||
|
@ -43,15 +41,15 @@ enum TexMode
|
|||
|
||||
enum ELightMethod
|
||||
{
|
||||
LM_SOFTWARE = 0, // multi-pass texturing
|
||||
LM_LEGACY = 0, // placeholder for legacy mode (textured lights), should not be checked anywhere in the code!
|
||||
LM_DEFERRED = 1, // calculate lights up front in a separate pass
|
||||
LM_DIRECT = 2, // calculate lights on the fly along with the render data
|
||||
};
|
||||
|
||||
enum EBufferMethod
|
||||
{
|
||||
BM_CLIENTARRAY = 0, // use a client array instead of a hardware buffer
|
||||
BM_DEFERRED = 1, // use a temporarily mapped buffer (only necessary on GL 3.x core profile, i.e. Apple)
|
||||
BM_LEGACY = 0, // placeholder for legacy mode (client arrays), should not be checked anywhere in the code!
|
||||
BM_DEFERRED = 1, // use a temporarily mapped buffer, for GL 3.x core profile
|
||||
BM_PERSISTENT = 2 // use a persistently mapped buffer
|
||||
};
|
||||
|
||||
|
@ -64,10 +62,10 @@ struct RenderContext
|
|||
unsigned int uniformblockalignment;
|
||||
int lightmethod;
|
||||
int buffermethod;
|
||||
float version;
|
||||
float glslversion;
|
||||
int max_texturesize;
|
||||
char * vendorstring;
|
||||
bool legacyMode;
|
||||
|
||||
int MaxLights() const
|
||||
{
|
||||
|
|
|
@ -43,15 +43,21 @@
|
|||
#ifdef HAVE_MMX
|
||||
#include "gl/hqnx_asm/hqnx_asm.h"
|
||||
#endif
|
||||
#include "gl/xbr/xbrz.h"
|
||||
#include "gl/xbr/xbrz_old.h"
|
||||
|
||||
CUSTOM_CVAR(Int, gl_texture_hqresize, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||
{
|
||||
#ifdef HAVE_MMX
|
||||
if (self < 0 || self > 9)
|
||||
#else
|
||||
if (self < 0 || self > 6)
|
||||
#endif
|
||||
if (self < 0 || self > 16)
|
||||
{
|
||||
self = 0;
|
||||
}
|
||||
#ifndef HAVE_MMX
|
||||
// This is to allow the menu option to work properly so that these filters can be skipped while cycling through them.
|
||||
if (self == 7) self = 10;
|
||||
if (self == 8) self = 10;
|
||||
if (self == 9) self = 6;
|
||||
#endif
|
||||
GLRenderer->FlushTextures();
|
||||
}
|
||||
|
||||
|
@ -242,6 +248,42 @@ static unsigned char *hqNxHelper( void (*hqNxFunction) ( unsigned*, unsigned*, i
|
|||
}
|
||||
|
||||
|
||||
|
||||
static unsigned char *xbrzHelper( void (*xbrzFunction) ( size_t, const uint32_t*, uint32_t*, int, int, xbrz::ColorFormat, const xbrz::ScalerCfg&, int, int ),
|
||||
const int N,
|
||||
unsigned char *inputBuffer,
|
||||
const int inWidth,
|
||||
const int inHeight,
|
||||
int &outWidth,
|
||||
int &outHeight )
|
||||
{
|
||||
outWidth = N * inWidth;
|
||||
outHeight = N *inHeight;
|
||||
|
||||
unsigned char * newBuffer = new unsigned char[outWidth*outHeight*4];
|
||||
xbrzFunction(N, reinterpret_cast<uint32_t*>(inputBuffer), reinterpret_cast<uint32_t*>(newBuffer), inWidth, inHeight, xbrz::ARGB, xbrz::ScalerCfg(), 0, std::numeric_limits<int>::max());
|
||||
delete[] inputBuffer;
|
||||
return newBuffer;
|
||||
}
|
||||
|
||||
static unsigned char *xbrzoldHelper( void (*xbrzFunction) ( size_t factor, const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, const xbrz_old::ScalerCfg& cfg, int yFirst, int yLast ),
|
||||
const int N,
|
||||
unsigned char *inputBuffer,
|
||||
const int inWidth,
|
||||
const int inHeight,
|
||||
int &outWidth,
|
||||
int &outHeight )
|
||||
{
|
||||
outWidth = N * inWidth;
|
||||
outHeight = N *inHeight;
|
||||
|
||||
unsigned char * newBuffer = new unsigned char[outWidth*outHeight*4];
|
||||
xbrzFunction(N, reinterpret_cast<uint32_t*>(inputBuffer), reinterpret_cast<uint32_t*>(newBuffer), inWidth, inHeight, xbrz_old::ScalerCfg(), 0, std::numeric_limits<int>::max());
|
||||
delete[] inputBuffer;
|
||||
return newBuffer;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// [BB] Upsamples the texture in inputBuffer, frees inputBuffer and returns
|
||||
|
@ -264,7 +306,7 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
|
|||
return inputBuffer;
|
||||
|
||||
// [BB] Don't upsample non-shader handled warped textures. Needs too much memory and time
|
||||
if (gl.glslversion == 0 && inputTexture->bWarped)
|
||||
if (gl.legacyMode && inputTexture->bWarped)
|
||||
return inputBuffer;
|
||||
|
||||
// already scaled?
|
||||
|
@ -322,6 +364,16 @@ unsigned char *gl_CreateUpsampledTextureBuffer ( const FTexture *inputTexture, u
|
|||
case 9:
|
||||
return hqNxAsmHelper( &HQnX_asm::hq4x_32, 4, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||
#endif
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
return xbrzHelper(xbrz::scale, type - 8, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
return xbrzoldHelper(xbrz_old::scale, type - 11, inputBuffer, inWidth, inHeight, outWidth, outHeight );
|
||||
|
||||
}
|
||||
}
|
||||
return inputBuffer;
|
||||
|
|
|
@ -64,18 +64,6 @@ extern int TexFormat[];
|
|||
//===========================================================================
|
||||
unsigned int FHardwareTexture::lastbound[FHardwareTexture::MAX_TEXTURES];
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// STATIC - Gets the maximum size of hardware textures
|
||||
//
|
||||
//===========================================================================
|
||||
int FHardwareTexture::GetTexDimension(int value)
|
||||
{
|
||||
if (value > gl.max_texturesize) return gl.max_texturesize;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Quick'n dirty image rescaling.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define DIRECT_PALETTE -2
|
||||
|
||||
#include "tarray.h"
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
||||
class FCanvasTexture;
|
||||
class AActor;
|
||||
|
@ -49,7 +50,11 @@ public:
|
|||
|
||||
static unsigned int lastbound[MAX_TEXTURES];
|
||||
|
||||
static int GetTexDimension(int value);
|
||||
static int GetTexDimension(int value)
|
||||
{
|
||||
if (value > gl.max_texturesize) return gl.max_texturesize;
|
||||
return value;
|
||||
}
|
||||
|
||||
static void InitGlobalState() { for (int i = 0; i < MAX_TEXTURES; i++) lastbound[i] = 0; }
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
|||
if (translation <= 0) translation = -translation;
|
||||
else
|
||||
{
|
||||
alphatrans = (gl.glslversion == 0 && translation == TRANSLATION(TRANSLATION_Standard, 8));
|
||||
alphatrans = (gl.legacyMode && translation == TRANSLATION(TRANSLATION_Standard, 8));
|
||||
translation = GLTranslationPalette::GetInternalTranslation(translation);
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
|||
if (hwtex)
|
||||
{
|
||||
// Texture has become invalid
|
||||
if ((!tex->bHasCanvas && (!tex->bWarped || gl.glslversion == 0)) && tex->CheckModified())
|
||||
if ((!tex->bHasCanvas && (!tex->bWarped || gl.legacyMode)) && tex->CheckModified())
|
||||
{
|
||||
Clean(true);
|
||||
hwtex = CreateHwTexture();
|
||||
|
@ -325,7 +325,7 @@ const FHardwareTexture *FGLTexture::Bind(int texunit, int clampmode, int transla
|
|||
if (!tex->bHasCanvas)
|
||||
{
|
||||
buffer = CreateTexBuffer(translation, w, h, hirescheck, true, alphatrans);
|
||||
if (tex->bWarped && gl.glslversion == 0 && w*h <= 256*256) // do not software-warp larger textures, especially on the old systems that still need this fallback.
|
||||
if (tex->bWarped && gl.legacyMode && w*h <= 256*256) // do not software-warp larger textures, especially on the old systems that still need this fallback.
|
||||
{
|
||||
// need to do software warping
|
||||
FWarpTexture *wt = static_cast<FWarpTexture*>(tex);
|
||||
|
@ -489,7 +489,7 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
|
|||
mSpriteU[0] = mSpriteV[0] = 0.f;
|
||||
mSpriteU[1] = mSpriteV[1] = 1.f;
|
||||
|
||||
FTexture *basetex = (tx->bWarped && gl.glslversion == 0)? tx : tx->GetRedirect(false);
|
||||
FTexture *basetex = (tx->bWarped && gl.legacyMode)? tx : tx->GetRedirect(false);
|
||||
// allow the redirect only if the textute is not expanded or the scale matches.
|
||||
if (!expanded || (tx->Scale.X == basetex->Scale.X && tx->Scale.Y == basetex->Scale.Y))
|
||||
{
|
||||
|
|
1229
src/gl/xbr/xbrz.cpp
Normal file
1229
src/gl/xbr/xbrz.cpp
Normal file
File diff suppressed because it is too large
Load diff
102
src/gl/xbr/xbrz.h
Normal file
102
src/gl/xbr/xbrz.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// * *
|
||||
// * An explicit permission was granted to use xBRZ in combination with ZDoom *
|
||||
// * and derived projects as long as it is used for non-commercial purposes. *
|
||||
// * *
|
||||
// * Backported to C++98 by Alexey Lysiuk *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef XBRZ_HEADER_3847894708239054
|
||||
#define XBRZ_HEADER_3847894708239054
|
||||
|
||||
#include <cstddef> //size_t
|
||||
#include <stdint.h> //uint32_t
|
||||
#include <limits>
|
||||
#include "xbrz_config.h"
|
||||
|
||||
namespace xbrz
|
||||
{
|
||||
/*
|
||||
-------------------------------------------------------------------------
|
||||
| xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju |
|
||||
-------------------------------------------------------------------------
|
||||
using a modified approach of xBR:
|
||||
http://board.byuu.org/viewtopic.php?f=10&t=2248
|
||||
- new rule set preserving small image features
|
||||
- highly optimized for performance
|
||||
- support alpha channel
|
||||
- support multithreading
|
||||
- support 64-bit architectures
|
||||
- support processing image slices
|
||||
- support scaling up to 6xBRZ
|
||||
*/
|
||||
|
||||
enum ColorFormat //from high bits -> low bits, 8 bit per channel
|
||||
{
|
||||
RGB, //8 bit for each red, green, blue, upper 8 bits unused
|
||||
ARGB, //including alpha channel, BGRA byte order on little-endian machines
|
||||
};
|
||||
|
||||
/*
|
||||
-> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally processing a half-open slice of rows [yFirst, yLast) only
|
||||
-> support for source/target pitch in bytes!
|
||||
-> if your emulator changes only a few image slices during each cycle (e.g. DOSBox) then there's no need to run xBRZ on the complete image:
|
||||
Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the additional range the xBRZ algorithm is using during analysis)
|
||||
Caveat: If there are multiple changed slices, make sure they do not overlap after adding these additional rows in order to avoid a memory race condition
|
||||
in the target image data if you are using multiple threads for processing each enlarged slice!
|
||||
|
||||
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap!
|
||||
- there is a minor inefficiency for the first row of a slice, so avoid processing single rows only; suggestion: process 8-16 rows at least
|
||||
*/
|
||||
#ifdef max
|
||||
#undef max
|
||||
#endif
|
||||
void scale(size_t factor, //valid range: 2 - 6
|
||||
const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
|
||||
ColorFormat colFmt,
|
||||
const ScalerCfg& cfg = ScalerCfg(),
|
||||
int yFirst = 0, int yLast = std::numeric_limits<int>::max()); //slice of source image
|
||||
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight);
|
||||
|
||||
enum SliceType
|
||||
{
|
||||
NN_SCALE_SLICE_SOURCE,
|
||||
NN_SCALE_SLICE_TARGET,
|
||||
};
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, int srcPitch, //pitch in bytes!
|
||||
uint32_t* trg, int trgWidth, int trgHeight, int trgPitch,
|
||||
SliceType st, int yFirst, int yLast);
|
||||
|
||||
//parameter tuning
|
||||
bool equalColorTest(uint32_t col1, uint32_t col2, ColorFormat colFmt, double luminanceWeight, double equalColorTolerance);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//########################### implementation ###########################
|
||||
inline
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight)
|
||||
{
|
||||
nearestNeighborScale(src, srcWidth, srcHeight, srcWidth * sizeof(uint32_t),
|
||||
trg, trgWidth, trgHeight, trgWidth * sizeof(uint32_t),
|
||||
NN_SCALE_SLICE_TARGET, 0, trgHeight);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
45
src/gl/xbr/xbrz_config.h
Normal file
45
src/gl/xbr/xbrz_config.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// * *
|
||||
// * An explicit permission was granted to use xBRZ in combination with ZDoom *
|
||||
// * and derived projects as long as it is used for non-commercial purposes. *
|
||||
// * *
|
||||
// * Backported to C++98 by Alexey Lysiuk *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef XBRZ_CONFIG_HEADER_284578425345
|
||||
#define XBRZ_CONFIG_HEADER_284578425345
|
||||
|
||||
//do NOT include any headers here! used by xBRZ_dll!!!
|
||||
|
||||
namespace xbrz
|
||||
{
|
||||
struct ScalerCfg
|
||||
{
|
||||
ScalerCfg() :
|
||||
luminanceWeight(1),
|
||||
equalColorTolerance(30),
|
||||
dominantDirectionThreshold(3.6),
|
||||
steepDirectionThreshold(2.2),
|
||||
newTestAttribute(0) {}
|
||||
|
||||
double luminanceWeight;
|
||||
double equalColorTolerance;
|
||||
double dominantDirectionThreshold;
|
||||
double steepDirectionThreshold;
|
||||
double newTestAttribute; //unused; test new parameters
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
45
src/gl/xbr/xbrz_config_old.h
Normal file
45
src/gl/xbr/xbrz_config_old.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// * *
|
||||
// * An explicit permission was granted to use xBRZ in combination with ZDoom *
|
||||
// * and derived projects as long as it is used for non-commercial purposes. *
|
||||
// * *
|
||||
// * Backported to C++98 by Alexey Lysiuk *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef __XBRZ_CONFIG_OLD_HEADER_INCLUDED__
|
||||
#define __XBRZ_CONFIG_OLD_HEADER_INCLUDED__
|
||||
|
||||
//do NOT include any headers here! used by xBRZ_dll!!!
|
||||
|
||||
namespace xbrz_old
|
||||
{
|
||||
struct ScalerCfg
|
||||
{
|
||||
ScalerCfg() :
|
||||
luminanceWeight_(1),
|
||||
equalColorTolerance_(30),
|
||||
dominantDirectionThreshold(3.6),
|
||||
steepDirectionThreshold(2.2),
|
||||
newTestAttribute_(0) {}
|
||||
|
||||
double luminanceWeight_;
|
||||
double equalColorTolerance_;
|
||||
double dominantDirectionThreshold;
|
||||
double steepDirectionThreshold;
|
||||
double newTestAttribute_; //unused; test new parameters
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
1365
src/gl/xbr/xbrz_old.cpp
Normal file
1365
src/gl/xbr/xbrz_old.cpp
Normal file
File diff suppressed because it is too large
Load diff
92
src/gl/xbr/xbrz_old.h
Normal file
92
src/gl/xbr/xbrz_old.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
// ****************************************************************************
|
||||
// * This file is part of the HqMAME project. It is distributed under *
|
||||
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
|
||||
// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved *
|
||||
// * *
|
||||
// * Additionally and as a special exception, the author gives permission *
|
||||
// * to link the code of this program with the MAME library (or with modified *
|
||||
// * versions of MAME that use the same license as MAME), and distribute *
|
||||
// * linked combinations including the two. You must obey the GNU General *
|
||||
// * Public License in all respects for all of the code used other than MAME. *
|
||||
// * If you modify this file, you may extend this exception to your version *
|
||||
// * of the file, but you are not obligated to do so. If you do not wish to *
|
||||
// * do so, delete this exception statement from your version. *
|
||||
// * *
|
||||
// * An explicit permission was granted to use xBRZ in combination with ZDoom *
|
||||
// * and derived projects as long as it is used for non-commercial purposes. *
|
||||
// * *
|
||||
// * Backported to C++98 by Alexey Lysiuk *
|
||||
// ****************************************************************************
|
||||
|
||||
#ifndef __XBRZ_OLD_HEADER_INCLUDED__
|
||||
#define __XBRZ_OLD_HEADER_INCLUDED__
|
||||
|
||||
#include <cstddef> //size_t
|
||||
#include <stdint.h> //uint32_t
|
||||
#include <limits>
|
||||
#include "xbrz_config_old.h"
|
||||
|
||||
namespace xbrz_old
|
||||
{
|
||||
/*
|
||||
-------------------------------------------------------------------------
|
||||
| xBRZ: "Scale by rules" - high quality image upscaling filter by Zenju |
|
||||
-------------------------------------------------------------------------
|
||||
using a modified approach of xBR:
|
||||
http://board.byuu.org/viewtopic.php?f=10&t=2248
|
||||
- new rule set preserving small image features
|
||||
- support multithreading
|
||||
- support 64 bit architectures
|
||||
- support processing image slices
|
||||
*/
|
||||
|
||||
/*
|
||||
-> map source (srcWidth * srcHeight) to target (scale * width x scale * height) image, optionally processing a half-open slice of rows [yFirst, yLast) only
|
||||
-> color format: ARGB (BGRA byte order), alpha channel unused
|
||||
-> support for source/target pitch in bytes!
|
||||
-> if your emulator changes only a few image slices during each cycle (e.g. Dosbox) then there's no need to run xBRZ on the complete image:
|
||||
Just make sure you enlarge the source image slice by 2 rows on top and 2 on bottom (this is the additional range the xBRZ algorithm is using during analysis)
|
||||
Caveat: If there are multiple changed slices, make sure they do not overlap after adding these additional rows in order to avoid a memory race condition
|
||||
if you are using multiple threads for processing each enlarged slice!
|
||||
|
||||
THREAD-SAFETY: - parts of the same image may be scaled by multiple threads as long as the [yFirst, yLast) ranges do not overlap!
|
||||
- there is a minor inefficiency for the first row of a slice, so avoid processing single rows only
|
||||
|
||||
|
||||
*/
|
||||
void scale(size_t factor, //valid range: 2 - 5
|
||||
const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight,
|
||||
const ScalerCfg& cfg = ScalerCfg(),
|
||||
int yFirst = 0, int yLast = std::numeric_limits<int>::max()); //slice of source image
|
||||
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight);
|
||||
|
||||
enum SliceType
|
||||
{
|
||||
NN_SCALE_SLICE_SOURCE,
|
||||
NN_SCALE_SLICE_TARGET,
|
||||
};
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight, int srcPitch, //pitch in bytes!
|
||||
uint32_t* trg, int trgWidth, int trgHeight, int trgPitch,
|
||||
SliceType st, int yFirst, int yLast);
|
||||
|
||||
//parameter tuning
|
||||
bool equalColor(uint32_t col1, uint32_t col2, double luminanceWeight, double equalColorTolerance);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//########################### implementation ###########################
|
||||
inline
|
||||
void nearestNeighborScale(const uint32_t* src, int srcWidth, int srcHeight,
|
||||
uint32_t* trg, int trgWidth, int trgHeight)
|
||||
{
|
||||
nearestNeighborScale(src, srcWidth, srcHeight, srcWidth * sizeof(uint32_t),
|
||||
trg, trgWidth, trgHeight, trgWidth * sizeof(uint32_t),
|
||||
NN_SCALE_SLICE_TARGET, 0, trgHeight);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -4449,6 +4449,9 @@ enum EACSFunctions
|
|||
-106 : KickFromGame(2),
|
||||
*/
|
||||
|
||||
ACSF_CheckClass = 200,
|
||||
ACSF_DamageActor, // [arookas]
|
||||
|
||||
// ZDaemon
|
||||
ACSF_GetTeamScore = 19620, // (int team)
|
||||
ACSF_SetTeamScore, // (int team, int value)
|
||||
|
@ -6028,6 +6031,21 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
return false;
|
||||
}
|
||||
|
||||
case ACSF_CheckClass:
|
||||
{
|
||||
const char *clsname = FBehavior::StaticLookupString(args[0]);
|
||||
return !!PClass::FindActor(clsname);
|
||||
}
|
||||
|
||||
case ACSF_DamageActor: // [arookas] wrapper around P_DamageMobj
|
||||
{
|
||||
// (target, ptr_select1, inflictor, ptr_select2, amount, damagetype)
|
||||
AActor* target = COPY_AAPTR(SingleActorFromTID(args[0], activator), args[1]);
|
||||
AActor* inflictor = COPY_AAPTR(SingleActorFromTID(args[2], activator), args[3]);
|
||||
FName damagetype(FBehavior::StaticLookupString(args[5]));
|
||||
return P_DamageMobj(target, inflictor, inflictor, args[4], damagetype);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -390,6 +390,11 @@ void AActor::Serialize(FArchive &arc)
|
|||
arc << SpriteRotation;
|
||||
}
|
||||
|
||||
if (SaveVersion >= 4550)
|
||||
{
|
||||
arc << alternative;
|
||||
}
|
||||
|
||||
{
|
||||
FString tagstr;
|
||||
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||
|
@ -1807,6 +1812,11 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
mo->Vel.X *= fac;
|
||||
mo->Vel.Y *= fac;
|
||||
}
|
||||
const double VELOCITY_THRESHOLD = 5000; // don't let it move faster than this. Fixed point overflowed at 32768 but that's too much to make this safe.
|
||||
if (mo->Vel.LengthSquared() >= VELOCITY_THRESHOLD*VELOCITY_THRESHOLD)
|
||||
{
|
||||
mo->Vel.MakeResize(VELOCITY_THRESHOLD);
|
||||
}
|
||||
move = mo->Vel;
|
||||
// [RH] Carrying sectors didn't work with low speeds in BOOM. This is
|
||||
// because BOOM relied on the speed being fast enough to accumulate
|
||||
|
|
|
@ -458,23 +458,14 @@ CocoaWindow* CreateCocoaWindow(const NSUInteger styleMask)
|
|||
return window;
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
CocoaVideo::CocoaVideo()
|
||||
: m_window(CreateCocoaWindow(STYLE_MASK_WINDOWED))
|
||||
, m_width(-1)
|
||||
, m_height(-1)
|
||||
, m_fullscreen(false)
|
||||
, m_hiDPI(false)
|
||||
enum OpenGLProfile
|
||||
{
|
||||
memset(&m_modeIterator, 0, sizeof m_modeIterator);
|
||||
|
||||
// Set attributes for OpenGL context
|
||||
Core,
|
||||
Legacy
|
||||
};
|
||||
|
||||
NSOpenGLPixelFormat* CreatePixelFormat(const OpenGLProfile profile)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attributes[16];
|
||||
size_t i = 0;
|
||||
|
||||
|
@ -491,17 +482,59 @@ CocoaVideo::CocoaVideo()
|
|||
attributes[i++] = NSOpenGLPFAAllowOfflineRenderers;
|
||||
}
|
||||
|
||||
if (NSAppKitVersionNumber >= AppKit10_7)
|
||||
if (NSAppKitVersionNumber >= AppKit10_7 && OpenGLProfile::Core == profile)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersion3_2Core;
|
||||
const char* const glversion = Args->CheckValue("-glversion");
|
||||
|
||||
if (nullptr != glversion)
|
||||
{
|
||||
const double version = strtod(glversion, nullptr) + 0.01;
|
||||
if (version < 3.2)
|
||||
{
|
||||
profile = NSOpenGLProfileVersionLegacy;
|
||||
}
|
||||
}
|
||||
|
||||
attributes[i++] = NSOpenGLPFAOpenGLProfile;
|
||||
attributes[i++] = NSOpenGLProfileVersion3_2Core;
|
||||
attributes[i++] = profile;
|
||||
}
|
||||
|
||||
attributes[i] = NSOpenGLPixelFormatAttribute(0);
|
||||
|
||||
// Create OpenGL context and view
|
||||
return [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||
}
|
||||
|
||||
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||
} // unnamed namespace
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
CocoaVideo::CocoaVideo()
|
||||
: m_window(CreateCocoaWindow(STYLE_MASK_WINDOWED))
|
||||
, m_width(-1)
|
||||
, m_height(-1)
|
||||
, m_fullscreen(false)
|
||||
, m_hiDPI(false)
|
||||
{
|
||||
memset(&m_modeIterator, 0, sizeof m_modeIterator);
|
||||
|
||||
// Create OpenGL pixel format
|
||||
|
||||
NSOpenGLPixelFormat* pixelFormat = CreatePixelFormat(OpenGLProfile::Core);
|
||||
|
||||
if (nil == pixelFormat)
|
||||
{
|
||||
pixelFormat = CreatePixelFormat(OpenGLProfile::Legacy);
|
||||
|
||||
if (nil == pixelFormat)
|
||||
{
|
||||
I_FatalError("Cannot OpenGL create pixel format, graphics hardware is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
// Create OpenGL context and view
|
||||
|
||||
const NSRect contentRect = [m_window contentRectForFrameRect:[m_window frame]];
|
||||
NSOpenGLView* glView = [[CocoaView alloc] initWithFrame:contentRect
|
||||
|
|
187
src/posix/osx/i_specialpaths.mm
Normal file
187
src/posix/osx/i_specialpaths.mm
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
** i_specialpaths.mm
|
||||
** Gets special system folders where data should be stored. (macOS version)
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2013-2016 Randy Heit
|
||||
** Copyright 2016 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 <CoreServices/CoreServices.h>
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "m_misc.h"
|
||||
#include "version.h" // for GAMENAME
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCachePath macOS
|
||||
//
|
||||
// Returns the path for cache GL nodes.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCachePath(bool create)
|
||||
{
|
||||
FString path;
|
||||
|
||||
char pathstr[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX))
|
||||
{
|
||||
path = pathstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = progdir;
|
||||
}
|
||||
path += "/zdoom/cache";
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetAutoexecPath macOS
|
||||
//
|
||||
// Returns the expected location of autoexec.cfg.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetAutoexecPath()
|
||||
{
|
||||
FString path;
|
||||
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/autoexec.cfg";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCajunPath macOS
|
||||
//
|
||||
// Returns the location of the Cajun Bot definitions.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCajunPath(const char *botfilename)
|
||||
{
|
||||
FString path;
|
||||
|
||||
// Just copies the Windows code. Should this be more Mac-specific?
|
||||
path << progdir << "zcajun/" << botfilename;
|
||||
if (!FileExists(path))
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetConfigPath macOS
|
||||
//
|
||||
// Returns the path to the config file. On Windows, this can vary for reading
|
||||
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
|
||||
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetConfigPath(bool for_reading)
|
||||
{
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kPreferencesFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
FString path;
|
||||
path << cpath << "/" GAMENAMELOWERCASE ".ini";
|
||||
return path;
|
||||
}
|
||||
// Ungh.
|
||||
return GAMENAMELOWERCASE ".ini";
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetScreenshotsPath macOS
|
||||
//
|
||||
// Returns the path to the default screenshots directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetScreenshotsPath()
|
||||
{
|
||||
FString path;
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/Screenshots/";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = "~/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetSavegamesPath macOS
|
||||
//
|
||||
// Returns the path to the default save games directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetSavegamesPath()
|
||||
{
|
||||
FString path;
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/Savegames/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
200
src/posix/unix/i_specialpaths.cpp
Normal file
200
src/posix/unix/i_specialpaths.cpp
Normal file
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
** i_specialpaths.cpp
|
||||
** Gets special system folders where data should be stored. (Unix version)
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2013-2016 Randy Heit
|
||||
** Copyright 2016 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 <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "i_system.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
#include "version.h" // for GAMENAME
|
||||
|
||||
|
||||
FString GetUserFile (const char *file)
|
||||
{
|
||||
FString path;
|
||||
struct stat info;
|
||||
|
||||
path = NicePath("~/" GAME_DIR "/");
|
||||
|
||||
if (stat (path, &info) == -1)
|
||||
{
|
||||
struct stat extrainfo;
|
||||
|
||||
// Sanity check for ~/.config
|
||||
FString configPath = NicePath("~/.config/");
|
||||
if (stat (configPath, &extrainfo) == -1)
|
||||
{
|
||||
if (mkdir (configPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
||||
{
|
||||
I_FatalError ("Failed to create ~/.config directory:\n%s", strerror(errno));
|
||||
}
|
||||
}
|
||||
else if (!S_ISDIR(extrainfo.st_mode))
|
||||
{
|
||||
I_FatalError ("~/.config must be a directory");
|
||||
}
|
||||
|
||||
// This can be removed after a release or two
|
||||
// Transfer the old zdoom directory to the new location
|
||||
bool moved = false;
|
||||
FString oldpath = NicePath("~/." GAMENAMELOWERCASE "/");
|
||||
if (stat (oldpath, &extrainfo) != -1)
|
||||
{
|
||||
if (rename(oldpath, path) == -1)
|
||||
{
|
||||
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
|
||||
oldpath.GetChars(), path.GetChars());
|
||||
}
|
||||
else
|
||||
moved = true;
|
||||
}
|
||||
|
||||
if (!moved && mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
||||
{
|
||||
I_FatalError ("Failed to create %s directory:\n%s",
|
||||
path.GetChars(), strerror (errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!S_ISDIR(info.st_mode))
|
||||
{
|
||||
I_FatalError ("%s must be a directory", path.GetChars());
|
||||
}
|
||||
}
|
||||
path += file;
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCachePath Unix
|
||||
//
|
||||
// Returns the path for cache GL nodes.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCachePath(bool create)
|
||||
{
|
||||
// Don't use GAME_DIR and such so that ZDoom and its child ports can
|
||||
// share the node cache.
|
||||
FString path = NicePath("~/.config/zdoom/cache");
|
||||
if (create)
|
||||
{
|
||||
CreatePath(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetAutoexecPath Unix
|
||||
//
|
||||
// Returns the expected location of autoexec.cfg.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetAutoexecPath()
|
||||
{
|
||||
return GetUserFile("autoexec.cfg");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCajunPath Unix
|
||||
//
|
||||
// Returns the location of the Cajun Bot definitions.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCajunPath(const char *botfilename)
|
||||
{
|
||||
FString path;
|
||||
|
||||
// Check first in ~/.config/zdoom/botfilename.
|
||||
path = GetUserFile(botfilename);
|
||||
if (!FileExists(path))
|
||||
{
|
||||
// Then check in SHARE_DIR/botfilename.
|
||||
path = SHARE_DIR;
|
||||
path << botfilename;
|
||||
if (!FileExists(path))
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetConfigPath Unix
|
||||
//
|
||||
// Returns the path to the config file. On Windows, this can vary for reading
|
||||
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
|
||||
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetConfigPath(bool for_reading)
|
||||
{
|
||||
return GetUserFile(GAMENAMELOWERCASE ".ini");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetScreenshotsPath Unix
|
||||
//
|
||||
// Returns the path to the default screenshots directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetScreenshotsPath()
|
||||
{
|
||||
return NicePath("~/" GAME_DIR "/screenshots/");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetSavegamesPath Unix
|
||||
//
|
||||
// Returns the path to the default save games directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetSavegamesPath()
|
||||
{
|
||||
return NicePath("~/" GAME_DIR);
|
||||
}
|
|
@ -76,6 +76,7 @@
|
|||
#include "d_player.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "templates.h"
|
||||
#include "math/cmath.h"
|
||||
|
||||
AActor *SingleActorFromTID(int tid, AActor *defactor);
|
||||
|
@ -4501,7 +4502,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS)
|
|||
else { target = viewport; viewport = self; }
|
||||
}
|
||||
|
||||
if (fov > 0 && (fov < 360.))
|
||||
fov = MIN<DAngle>(fov, 360.);
|
||||
|
||||
if (fov > 0)
|
||||
{
|
||||
DAngle an = absangle(viewport->AngleTo(target), viewport->Angles.Yaw);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ const char *GetVersionString();
|
|||
|
||||
// Use 4500 as the base git save version, since it's higher than the
|
||||
// SVN revision ever got.
|
||||
#define SAVEVER 4549
|
||||
#define SAVEVER 4550
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
|
@ -1,27 +1,46 @@
|
|||
#ifdef __APPLE__
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
/*
|
||||
** i_specialpaths.cpp
|
||||
** Gets special system folders where data should be stored. (Windows version)
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2013-2016 Randy Heit
|
||||
** Copyright 2016 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.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <lmcons.h>
|
||||
#include <shlobj.h>
|
||||
#define USE_WINDOWS_DWORD
|
||||
#endif
|
||||
|
||||
#include "cmdlib.h"
|
||||
#include "m_misc.h"
|
||||
|
||||
#if !defined(__APPLE__) && !defined(_WIN32)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "i_system.h"
|
||||
#endif
|
||||
|
||||
#include "version.h" // for GAMENAME
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "i_system.h"
|
||||
|
||||
typedef HRESULT (WINAPI *GKFP)(REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR *);
|
||||
|
@ -323,314 +342,3 @@ FString M_GetSavegamesPath()
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCachePath Mac OS X
|
||||
//
|
||||
// Returns the path for cache GL nodes.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCachePath(bool create)
|
||||
{
|
||||
FString path;
|
||||
|
||||
char pathstr[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kApplicationSupportFolderType, create ? kCreateFolder : 0, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)pathstr, PATH_MAX))
|
||||
{
|
||||
path = pathstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = progdir;
|
||||
}
|
||||
path += "/zdoom/cache";
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetAutoexecPath Mac OS X
|
||||
//
|
||||
// Returns the expected location of autoexec.cfg.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetAutoexecPath()
|
||||
{
|
||||
FString path;
|
||||
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/autoexec.cfg";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCajunPath Mac OS X
|
||||
//
|
||||
// Returns the location of the Cajun Bot definitions.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCajunPath(const char *botfilename)
|
||||
{
|
||||
FString path;
|
||||
|
||||
// Just copies the Windows code. Should this be more Mac-specific?
|
||||
path << progdir << "zcajun/" << botfilename;
|
||||
if (!FileExists(path))
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetConfigPath Mac OS X
|
||||
//
|
||||
// Returns the path to the config file. On Windows, this can vary for reading
|
||||
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
|
||||
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetConfigPath(bool for_reading)
|
||||
{
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kPreferencesFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
FString path;
|
||||
path << cpath << "/" GAMENAMELOWERCASE ".ini";
|
||||
return path;
|
||||
}
|
||||
// Ungh.
|
||||
return GAMENAMELOWERCASE ".ini";
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetScreenshotsPath Mac OS X
|
||||
//
|
||||
// Returns the path to the default screenshots directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetScreenshotsPath()
|
||||
{
|
||||
FString path;
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/Screenshots/";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = "~/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetSavegamesPath Mac OS X
|
||||
//
|
||||
// Returns the path to the default save games directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetSavegamesPath()
|
||||
{
|
||||
FString path;
|
||||
char cpath[PATH_MAX];
|
||||
FSRef folder;
|
||||
|
||||
if (noErr == FSFindFolder(kUserDomain, kDocumentsFolderType, kCreateFolder, &folder) &&
|
||||
noErr == FSRefMakePath(&folder, (UInt8*)cpath, PATH_MAX))
|
||||
{
|
||||
path << cpath << "/" GAME_DIR "/Savegames/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
#else // Linux, et al.
|
||||
|
||||
|
||||
FString GetUserFile (const char *file)
|
||||
{
|
||||
FString path;
|
||||
struct stat info;
|
||||
|
||||
path = NicePath("~/" GAME_DIR "/");
|
||||
|
||||
if (stat (path, &info) == -1)
|
||||
{
|
||||
struct stat extrainfo;
|
||||
|
||||
// Sanity check for ~/.config
|
||||
FString configPath = NicePath("~/.config/");
|
||||
if (stat (configPath, &extrainfo) == -1)
|
||||
{
|
||||
if (mkdir (configPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
||||
{
|
||||
I_FatalError ("Failed to create ~/.config directory:\n%s", strerror(errno));
|
||||
}
|
||||
}
|
||||
else if (!S_ISDIR(extrainfo.st_mode))
|
||||
{
|
||||
I_FatalError ("~/.config must be a directory");
|
||||
}
|
||||
|
||||
// This can be removed after a release or two
|
||||
// Transfer the old zdoom directory to the new location
|
||||
bool moved = false;
|
||||
FString oldpath = NicePath("~/." GAMENAMELOWERCASE "/");
|
||||
if (stat (oldpath, &extrainfo) != -1)
|
||||
{
|
||||
if (rename(oldpath, path) == -1)
|
||||
{
|
||||
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
|
||||
oldpath.GetChars(), path.GetChars());
|
||||
}
|
||||
else
|
||||
moved = true;
|
||||
}
|
||||
|
||||
if (!moved && mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
||||
{
|
||||
I_FatalError ("Failed to create %s directory:\n%s",
|
||||
path.GetChars(), strerror (errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!S_ISDIR(info.st_mode))
|
||||
{
|
||||
I_FatalError ("%s must be a directory", path.GetChars());
|
||||
}
|
||||
}
|
||||
path += file;
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCachePath Unix
|
||||
//
|
||||
// Returns the path for cache GL nodes.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCachePath(bool create)
|
||||
{
|
||||
// Don't use GAME_DIR and such so that ZDoom and its child ports can
|
||||
// share the node cache.
|
||||
FString path = NicePath("~/.config/zdoom/cache");
|
||||
if (create)
|
||||
{
|
||||
CreatePath(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetAutoexecPath Unix
|
||||
//
|
||||
// Returns the expected location of autoexec.cfg.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetAutoexecPath()
|
||||
{
|
||||
return GetUserFile("autoexec.cfg");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetCajunPath Unix
|
||||
//
|
||||
// Returns the location of the Cajun Bot definitions.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetCajunPath(const char *botfilename)
|
||||
{
|
||||
FString path;
|
||||
|
||||
// Check first in ~/.config/zdoom/botfilename.
|
||||
path = GetUserFile(botfilename);
|
||||
if (!FileExists(path))
|
||||
{
|
||||
// Then check in SHARE_DIR/botfilename.
|
||||
path = SHARE_DIR;
|
||||
path << botfilename;
|
||||
if (!FileExists(path))
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetConfigPath Unix
|
||||
//
|
||||
// Returns the path to the config file. On Windows, this can vary for reading
|
||||
// vs writing. i.e. If $PROGDIR/zdoom-<user>.ini does not exist, it will try
|
||||
// to read from $PROGDIR/zdoom.ini, but it will never write to zdoom.ini.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetConfigPath(bool for_reading)
|
||||
{
|
||||
return GetUserFile(GAMENAMELOWERCASE ".ini");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetScreenshotsPath Unix
|
||||
//
|
||||
// Returns the path to the default screenshots directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetScreenshotsPath()
|
||||
{
|
||||
return NicePath("~/" GAME_DIR "/screenshots/");
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// M_GetSavegamesPath Unix
|
||||
//
|
||||
// Returns the path to the default save games directory.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FString M_GetSavegamesPath()
|
||||
{
|
||||
return NicePath("~/" GAME_DIR);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -748,11 +748,9 @@ bool Win32GLVideo::InitHardware (HWND Window, int multisample)
|
|||
}
|
||||
|
||||
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
const char *lm = Args->CheckValue("-buffermethod");
|
||||
if (lm != NULL)
|
||||
{
|
||||
if (!stricmp(lm, "clientarray")) prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
}
|
||||
const char *version = Args->CheckValue("-glversion");
|
||||
|
||||
if (version != nullptr && strcmp(version, "3.0") < 0) prof = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
|
||||
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
||||
{
|
||||
|
|
|
@ -2594,7 +2594,6 @@ GLTEXMNU_RESIZETEX = "Resize textures";
|
|||
GLTEXMNU_RESIZESPR = "Resize sprites";
|
||||
GLTEXMNU_RESIZEFNT = "Resize fonts";
|
||||
GLTEXMNU_PRECACHETEX = "Precache GL textures";
|
||||
GLTEXMNU_CAMTEXOFFSCR = "Camera textures offscreen";
|
||||
GLTEXMNU_TRIMSPREDGE = "Trim sprite edges";
|
||||
GLTEXMNU_SORTDRAWLIST = "Sort draw lists by texture";
|
||||
|
||||
|
@ -2605,9 +2604,6 @@ GLLIGHTMNU_LIGHTDEFS = "Enable light definitions";
|
|||
GLLIGHTMNU_CLIPLIGHTS = "Clip lights";
|
||||
GLLIGHTMNU_LIGHTSPRITES = "Lights affect sprites";
|
||||
GLLIGHTMNU_LIGHTPARTICLES = "Lights affect particles";
|
||||
GLLIGHTMNU_FORCEADDITIVE = "Force additive lighting";
|
||||
GLLIGHTMNU_LIGHTINTENSITY = "Light intensity";
|
||||
GLLIGHTMNU_LIGHTSIZE = "Light size";
|
||||
|
||||
// OpenGL Preferences
|
||||
GLPREFMNU_TITLE = "OPENGL PREFERENCES";
|
||||
|
|
|
@ -134,6 +134,12 @@ OptionValue "HqResizeModes"
|
|||
7, "$OPTVAL_HQ2XMMX"
|
||||
8, "$OPTVAL_HQ3XMMX"
|
||||
9, "$OPTVAL_HQ4XMMX"
|
||||
10, "xBRZ 2x"
|
||||
11, "xBRZ 3x"
|
||||
12, "xBRZ 4x"
|
||||
13, "xBRZ_old 2x"
|
||||
14, "xBRZ_old 3x"
|
||||
15, "xBRZ_old 4x"
|
||||
}
|
||||
|
||||
OptionValue "FogMode"
|
||||
|
@ -179,7 +185,6 @@ OptionMenu "GLTextureGLOptions"
|
|||
Option "$GLTEXMNU_RESIZESPR", gl_texture_hqresize_sprites, "OnOff"
|
||||
Option "$GLTEXMNU_RESIZEFNT", gl_texture_hqresize_fonts, "OnOff"
|
||||
Option "$GLTEXMNU_PRECACHETEX", gl_precache, "YesNo"
|
||||
Option "$GLTEXMNU_CAMTEXOFFSCR", gl_usefb, "OnOff"
|
||||
Option "$GLTEXMNU_TRIMSPREDGE", gl_trimsprites, "OnOff"
|
||||
Option "$GLTEXMNU_SORTDRAWLIST", gl_sort_textures, "YesNo"
|
||||
}
|
||||
|
@ -192,9 +197,6 @@ OptionMenu "GLLightOptions"
|
|||
Option "$GLLIGHTMNU_CLIPLIGHTS", gl_lights_checkside, "YesNo"
|
||||
Option "$GLLIGHTMNU_LIGHTSPRITES", gl_light_sprites, "YesNo"
|
||||
Option "$GLLIGHTMNU_LIGHTPARTICLES", gl_light_particles, "YesNo"
|
||||
Option "$GLLIGHTMNU_FORCEADDITIVE", gl_lights_additive, "YesNo"
|
||||
Slider "$GLLIGHTMNU_LIGHTINTENSITY", gl_lights_intensity, 0.0, 1.0, 0.1
|
||||
Slider "$GLLIGHTMNU_LIGHTSIZE", gl_lights_size, 0.0, 2.0, 0.1
|
||||
}
|
||||
|
||||
OptionMenu "GLPrefOptions"
|
||||
|
|
16
wadsrc/static/shaders/glsl/colormap.fp
Normal file
16
wadsrc/static/shaders/glsl/colormap.fp
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
in vec2 TexCoord;
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec4 uFixedColormapStart;
|
||||
uniform vec4 uFixedColormapRange;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 frag = texture(tex, TexCoord);
|
||||
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
|
||||
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
|
||||
FragColor = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a);
|
||||
}
|
||||
|
|
@ -51,32 +51,6 @@ vec4 desaturate(vec4 texel)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
#ifdef GLSL12_COMPATIBLE
|
||||
vec4 getTexel(vec2 st)
|
||||
{
|
||||
vec4 texel = texture(tex, st);
|
||||
|
||||
//
|
||||
// Apply texture modes
|
||||
//
|
||||
if (uTextureMode != 0)
|
||||
{
|
||||
if (uTextureMode == 1) texel.rgb = vec3(1.0,1.0,1.0);
|
||||
else if (uTextureMode == 2) texel.a = 1.0;
|
||||
else if (uTextureMode == 3) texel = vec4(1.0-texel.r, 1.0-texel.b, 1.0-texel.g, texel.a);
|
||||
else if (uTextureMode == 4) texel = vec4(1.0, 1.0, 1.0, texel.r*texel.a);
|
||||
else if (uTextureMode == 5)
|
||||
{
|
||||
if (st.t < 0.0 || st.t > 1.0)
|
||||
{
|
||||
texel.a = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
texel *= uObjectColor;
|
||||
return desaturate(texel);
|
||||
}
|
||||
#else
|
||||
vec4 getTexel(vec2 st)
|
||||
{
|
||||
vec4 texel = texture(tex, st);
|
||||
|
@ -113,7 +87,6 @@ vec4 getTexel(vec2 st)
|
|||
|
||||
return desaturate(texel);
|
||||
}
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -69,22 +69,15 @@ uniform sampler2D PaletteLUT;
|
|||
|
||||
vec3 Tonemap(vec3 color)
|
||||
{
|
||||
ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 255.0 + 0.5);
|
||||
#if __VERSION__ < 130
|
||||
int index = (c.r / 4 * 64 + c.g / 4) * 64 + c.b / 4;
|
||||
float tx = mod(index, 512) / 512.0;
|
||||
float ty = float(index / 512) / 512.0;
|
||||
return texture2D(PaletteLUT, vec2(tx, ty)).rgb;
|
||||
#else
|
||||
int index = ((c.r >> 2) * 64 + (c.g >> 2)) * 64 + (c.b >> 2);
|
||||
ivec3 c = ivec3(clamp(color.rgb, vec3(0.0), vec3(1.0)) * 63.0 + 0.5);
|
||||
int index = (c.r * 64 + c.g) * 64 + c.b;
|
||||
int tx = index % 512;
|
||||
int ty = index / 512;
|
||||
return texelFetch(PaletteLUT, ivec2(tx, ty), 0).rgb;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Tonemap mode define is missing"
|
||||
#error Tonemap mode define is missing
|
||||
#endif
|
||||
|
||||
void main()
|
||||
|
|
Loading…
Reference in a new issue