Initial commit

This commit is contained in:
Brian Harris
2012-11-26 12:58:24 -06:00
parent a5214f79ef
commit 5016f605b8
1115 changed files with 587266 additions and 0 deletions

682
COPYING.txt Normal file
View File

@@ -0,0 +1,682 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, 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
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
ADDITIONAL TERMS APPLICABLE TO THE Doom 3 BFG Edition GPL Source Code.
The following additional terms ("Additional Terms") supplement and modify
the GNU General Public License, Version 3 ("GPL") applicable to the Doom 3
BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). In addition
to the terms and conditions of the GPL, the Doom 3 BFG Edition Source Code is
subject to the further restrictions below.
1. Replacement of Section 15. Section 15 of the GPL shall be deleted in its
entirety and replaced with the following:
"15. Disclaimer of Warranty.
THE PROGRAM IS PROVIDED WITHOUT ANY WARRANTIES, WHETHER EXPRESSED OR IMPLIED,
INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, TITLE AND MERCHANTABILITY. THE PROGRAM IS BEING
DELIVERED OR MADE AVAILABLE "AS IS", "WITH ALL FAULTS" AND WITHOUT WARRANTY OR
REPRESENTATION. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST
OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION."
2. Replacement of Section 16. Section 16 of the GPL shall be deleted in its
entirety and replaced with the following:
"16. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES SHALL ANY COPYRIGHT HOLDER OR ITS AFFILIATES, OR ANY
OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE
LIABLE TO YOU, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, FOR ANY
DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, CONSEQUENTIAL OR PUNITIVE DAMAGES ARISING FROM, OUT OF OR IN
CONNECTION WITH THE USE OR INABILITY TO USE THE PROGRAM OR OTHER DEALINGS WITH
THE PROGRAM(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
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), WHETHER OR NOT ANY COPYRIGHT
HOLDER OR SUCH OTHER PARTY RECEIVES NOTICE OF ANY SUCH DAMAGES AND WHETHER
OR NOT SUCH DAMAGES COULD HAVE BEEN FORESEEN."
3. LEGAL NOTICES; NO TRADEMARK LICENSE; ORIGIN. You must reproduce faithfully
all trademark, copyright and other proprietary and legal notices on any copies
of the Program or any other required author attributions. This license does
not grant you rights to use any copyright holder or any other partys name,
logo, or trademarks. Neither the name of the copyright holder or its
affiliates, or any other party who modifies and/or conveys the Program may be
used to endorse or promote products derived from this software without
specific prior written permission. The origin of the Program must not be
misrepresented; you must not claim that you wrote the original Program.
Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original Program.
4. INDEMNIFICATION. IF YOU CONVEY A COVERED WORK AND AGREE WITH ANY RECIPIENT
OF THAT COVERED WORK THAT YOU WILL ASSUME ANY LIABILITY FOR THAT COVERED WORK,
YOU HEREBY AGREE TO INDEMNIFY, DEFEND AND HOLD HARMLESS THE OTHER LICENSORS
AND AUTHORS OF THAT COVERED WORK FOR ANY DAMAEGS, DEMANDS, CLAIMS, LOSSES,
CAUSES OF ACTION, LAWSUITS, JUDGMENTS EXPENSES (INCLUDING WITHOUT LIMITATION
REASONABLE ATTORNEYS' FEES AND EXPENSES) OR ANY OTHER LIABLITY ARISING FROM,
RELATED TO OR IN CONNECTION WITH YOUR ASSUMPTIONS OF LIABILITY.

257
README.txt Normal file
View File

@@ -0,0 +1,257 @@
Doom 3 BFG Edition GPL Source Code
==================================
This file contains the following sections:
GENERAL NOTES
LICENSE
GENERAL NOTES
=============
Game data and patching:
-----------------------
This source release does not contain any game data, the game data is still
covered by the original EULA and must be obeyed as usual.
You must patch the game to the latest version.
Note that Doom 3 BFG Edition is available from the Steam store at
http://store.steampowered.com/app/208200/
Compiling on win32:
-------------------
A project file for Microsoft Visual Studio 2010 is provided in neo\doom3.sln
We expect the solution file is compatible with the Express releases
You will need the Microsoft DirectX SDK installed as well.
If it does not reside in "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)"
you will need to update the project files accordingly.
Steam:
------
The Doom 3 BFG Edition GPL Source Code release does not include functionality for integrating with
Steam. This includes roaming profiles, achievements, leaderboards, matchmaking, the overlay, or
any other Steam features.
Bink:
-----
The Doom 3 BFG Edition GPL Source Code release does not include functionality for rendering Bink Videos.
Back End Rendering of Stencil Shadows:
--------------------------------------
The Doom 3 BFG Edition GPL Source Code release does not include functionality enabling rendering
of stencil shadows via the "depth fail" method, a functionality commonly known as "Carmack's Reverse".
Other platforms, updated source code, security issues:
------------------------------------------------------
If you have obtained this source code several weeks after the time of release,
it is likely that you can find modified and improved versions of the engine in
various open source projects across the internet.
Depending what is your interest with the source code, those may be a better starting point.
LICENSE
=======
See COPYING.txt for the GNU GENERAL PUBLIC LICENSE
ADDITIONAL TERMS: The Doom 3 BFG Edition GPL Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU GPL which accompanied the Doom 3 BFG Edition GPL Source Code. If not, please request a copy in writing from id Software at id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
EXCLUDED CODE: The code described below and contained in the Doom 3 BFG Edition GPL Source Code release is not part of the Program covered by the GPL and is expressly excluded from its terms. You are solely responsible for obtaining from the copyright holder a license for such code and complying with the applicable license terms.
JPEG library
-----------------------------------------------------------------------------
neo/renderer/jpeg-6/*
Copyright (C) 1991-1995, Thomas G. Lane
Permission is hereby granted to use, copy, modify, and distribute this
software (or portions thereof) for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code for this software is distributed, then this
README file must be included, with this copyright and no-warranty notice
unaltered; and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
(2) If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
(3) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
These conditions apply to any software derived from or based on the IJG code,
not just to the unmodified library. If you use our work, you ought to
acknowledge us.
NOTE: unfortunately the README that came with our copy of the library has
been lost, so the one from release 6b is included instead. There are a few
'glue type' modifications to the library to make it easier to use from
the engine, but otherwise the dependency can be easily cleaned up to a
better release of the library.
zlib library
---------------------------------------------------------------------------
neo/framework/zlib/*
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will 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, an acknowledgment in the product documentation would be
appreciated but is not required.
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 or altered from any source distribution.
Base64 implementation
---------------------------------------------------------------------------
neo/idlib/Base64.cpp
Copyright (c) 1996 Lars Wirzenius. All rights reserved.
June 14 2003: TTimo <ttimo@idsoftware.com>
modified + endian bug fixes
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=197039
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.
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.
IO for uncompress .zip files using zlib
---------------------------------------------------------------------------
neo/framework/Unzip.cpp
neo/framework/Unzip.h
Copyright (C) 1998 Gilles Vollant
zlib is Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will 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, an acknowledgment in the product documentation would be
appreciated but is not required.
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 or altered from any source distribution.
MD4 Message-Digest Algorithm
-----------------------------------------------------------------------------
neo/idlib/hashing/MD4.cpp
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD4 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD4 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
MD5 Message-Digest Algorithm
-----------------------------------------------------------------------------
neo/idlib/hashing/MD5.cpp
This code implements the MD5 message-digest algorithm.
The algorithm is due to Ron Rivest. This code was
written by Colin Plumb in 1993, no copyright is claimed.
This code is in the public domain; do with it what you wish.
CRC32 Checksum
-----------------------------------------------------------------------------
neo/idlib/hashing/CRC32.cpp
Copyright (C) 1995-1998 Mark Adler
OpenGL headers
---------------------------------------------------------------------------
neo/renderer/OpenGL/glext.h
neo/renderer/OpenGL/wglext.h
Copyright (c) 2007-2012 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
Timidity
---------------------------------------------------------------------------
doomclassic/timidity/*
Copyright (c) 1995 Tuukka Toivonen
From http://www.cgs.fi/~tt/discontinued.html :
If you'd like to continue hacking on TiMidity, feel free. I'm
hereby extending the TiMidity license agreement: you can now
select the most convenient license for your needs from (1) the
GNU GPL, (2) the GNU LGPL, or (3) the Perl Artistic License.

1
base/default.cfg Normal file
View File

@@ -0,0 +1 @@
# empty file

View File

@@ -0,0 +1,60 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr
uniform sampler2D samp2 : register(s2); // Cb
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );
float Y = tex2D( samp0, fragment.texcoord0.xy ).x;
float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;
float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;
float3 p = ( YScalar * Y );
p += ( crc * Cr ) + ( crb * Cb ) + adj;
result.color.xyz = p;
result.color.w = 1.0;
result.color *= rpColor;
}

View File

@@ -0,0 +1,51 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // Y
uniform sampler2D samp1 : register(s1); // Cr
uniform sampler2D samp2 : register(s2); // Cb
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float3 crc = float3( 1.595794678, -0.813476563, 0 );
const float3 crb = float3( 0, -0.391448975, 2.017822266 );
const float3 adj = float3( -0.87065506, 0.529705048f, -1.081668854f );
const float3 YScalar = float3( 1.164123535f, 1.164123535f, 1.164123535f );
float Y = tex2D( samp0, fragment.texcoord0.xy ).x;
float Cr = tex2D( samp1, fragment.texcoord0.xy ).x;
float Cb = tex2D( samp2, fragment.texcoord0.xy ).x;
float3 p = ( YScalar * Y );
p += ( crc * Cr ) + ( crb * Cb ) + adj;
float4 binkImage;
binkImage.xyz = p;
binkImage.w = 1.0;
float4 color = ( binkImage * fragment.color ) + fragment.texcoord1;
result.color.xyz = color.xyz * color.w;
result.color.w = color.w;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.xy = vertex.texcoord.xy;
result.texcoord1 = ( swizzleColor( vertex.color2 ) * 2 ) - 1;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,46 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = idtex2Dproj( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 binormal : BINORMAL;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
result.texcoord0.z = 0.0;
result.texcoord0.w = dot4( vertex.position, rpTexGen0Q );
result.texcoord1.x = dot4( vertex.position, rpTexGen1S );
result.texcoord1.y = 0.5;
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
float4 maskSample = tex2D( samp2, fragment.texcoord1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord1 );
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScale
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
//center scale
const float4 centerScale = rpUser0;
result.texcoord0 = CenterScale( vertex.texcoord, centerScale.xy );
// pass through texcoords
result.texcoord1 = vertex.texcoord;
}

View File

@@ -0,0 +1,58 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
float2 texcoord2 : TEXCOORD2_centroid;
//float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 redTint = float4( 1, 0.98, 0.98, 1 );
float4 accumSample = tex2D( samp0, fragment.texcoord0 ) * redTint;
float4 maskSample = tex2D( samp2, fragment.texcoord1 );
float4 tint = float4( 1.0, 0.8, 0.8, 1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord2 ) * tint;
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,69 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex0
uniform float4 rpUser1 : register( c129 ); //rpRotateTex0
uniform float4 rpUser2 : register( c130 ); //rpCenterScaleTex1
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
const float4 centerScaleTex0 = rpUser0;
const float4 rotateTex0 = rpUser1;
const float4 centerScaleTex1 = rpUser2;
//center scale and rotate for _accum
float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex0.xy );
result.texcoord0 = Rotate2D( tc0, rotateTex0.xy );
//center scale for mask
result.texcoord1 = CenterScale( vertex.texcoord, centerScaleTex1.xy );
// pass through for currentrender
result.texcoord2 = vertex.texcoord;
}

View File

@@ -0,0 +1,70 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
float2 texcoord2 : TEXCOORD2_centroid;
float2 texcoord3 : TEXCOORD3_centroid;
float2 texcoord4 : TEXCOORD4;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float colorFactor = fragment.texcoord4.x;
float4 color0 = float4( 1.0f - colorFactor, 1.0f - colorFactor, 1.0f, 1.0f );
float4 color1 = float4( 1.0f, 0.95f - colorFactor, 0.95f, 0.5f );
float4 color2 = float4( 0.015f, 0.015f, 0.015f, 0.01f );
float4 accumSample0 = tex2D( samp0, fragment.texcoord0 ) * color0;
float4 accumSample1 = tex2D( samp0, fragment.texcoord1 ) * color1;
float4 accumSample2 = tex2D( samp0, fragment.texcoord2 ) * color2;
float4 maskSample = tex2D( samp2, fragment.texcoord3 );
float4 tint = float4( 0.8, 0.5, 0.5, 1 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord3 ) * tint;
// blend of the first 2 accumulation samples
float4 accumColor = lerp( accumSample0, accumSample1, 0.5f );
// add thrid sample
accumColor += accumSample2;
accumColor = lerp( accumColor, currentRenderSample, maskSample.a );
result.color = accumColor;
}

View File

@@ -0,0 +1,76 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register( c128 ); //rpCenterScaleTex
uniform float4 rpUser1 : register( c129 ); //rpRotateTex
uniform float4 rpUser2 : register( c130 ); //rpColorFactor
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float2 texcoord3 : TEXCOORD3;
float2 texcoord4 : TEXCOORD4;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
//_accum 1
const float4 centerScaleTex = rpUser0;
const float4 rotateTex = rpUser1;
float2 tc0 = CenterScale( vertex.texcoord, centerScaleTex.xy );
result.texcoord0 = Rotate2D( tc0, rotateTex.xy );
// accum 2
result.texcoord1 = Rotate2D( tc0, float2( rotateTex.z, -rotateTex.w ) );
// accum 3
result.texcoord2 = Rotate2D( tc0, rotateTex.zw );
// pass through for currentrender
result.texcoord3 = vertex.texcoord;
// pass through the color fator
const float4 colorFactor = rpUser2;
result.texcoord4 = colorFactor.xx;
}

View File

@@ -0,0 +1,51 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); //_accum
uniform sampler2D samp1 : register(s1); //_currentRender
uniform sampler2D samp2 : register(s2); //mask
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 accumSample = tex2D( samp0, fragment.texcoord0 );
float4 currentRenderSample = tex2D( samp1, fragment.texcoord0 );
float4 maskSample = tex2D( samp2, fragment.texcoord0 );
result.color = lerp( accumSample, currentRenderSample, maskSample.a );
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// pass through texcoords
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,67 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float3 texcoord2 : TEXCOORD2_centroid;
float3 texcoord3 : TEXCOORD3_centroid;
float3 texcoord4 : TEXCOORD4_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;
globalNormal.x = dot3( localNormal, fragment.texcoord2 );
globalNormal.y = dot3( localNormal, fragment.texcoord3 );
globalNormal.z = dot3( localNormal, fragment.texcoord4 );
float3 globalEye = normalize( fragment.texcoord1 );
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,80 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float3 texcoord2 : TEXCOORD2;
float3 texcoord3 : TEXCOORD3;
float3 texcoord4 : TEXCOORD4;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 normal = vertex.normal * 2.0 - 1.0;
float4 tangent = vertex.tangent * 2.0 - 1.0;
float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord.xy;
float4 toEye = rpLocalViewOrigin - vertex.position;
result.texcoord1.x = dot3( toEye, rpModelMatrixX );
result.texcoord1.y = dot3( toEye, rpModelMatrixY );
result.texcoord1.z = dot3( toEye, rpModelMatrixZ );
result.texcoord2.x = dot3( tangent, rpModelMatrixX );
result.texcoord3.x = dot3( tangent, rpModelMatrixY );
result.texcoord4.x = dot3( tangent, rpModelMatrixZ );
result.texcoord2.y = dot3( binormal, rpModelMatrixX );
result.texcoord3.y = dot3( binormal, rpModelMatrixY );
result.texcoord4.y = dot3( binormal, rpModelMatrixZ );
result.texcoord2.z = dot3( normal, rpModelMatrixX );
result.texcoord3.z = dot3( normal, rpModelMatrixY );
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
result.color = rpColor;
}

View File

@@ -0,0 +1,67 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
uniform sampler2D samp1 : register(s1); // normal map
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float3 texcoord2 : TEXCOORD2_centroid;
float3 texcoord3 : TEXCOORD3_centroid;
float3 texcoord4 : TEXCOORD4_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 bump = tex2D( samp1, fragment.texcoord0 ) * 2.0f - 1.0f;
float3 localNormal = float3( bump.wy, 0.0f );
localNormal.z = sqrt( 1.0f - dot3( localNormal, localNormal ) );
float3 globalNormal;
globalNormal.x = dot3( localNormal, fragment.texcoord2 );
globalNormal.y = dot3( localNormal, fragment.texcoord3 );
globalNormal.z = dot3( localNormal, fragment.texcoord4 );
float3 globalEye = normalize( fragment.texcoord1 );
float3 reflectionVector = globalNormal * dot3( globalEye, globalNormal );
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,137 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float3 texcoord2 : TEXCOORD2;
float3 texcoord3 : TEXCOORD3;
float3 texcoord4 : TEXCOORD4;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord.xy;
float4 toEye = rpLocalViewOrigin - modelPosition;
result.texcoord1.x = dot3( toEye, rpModelMatrixX );
result.texcoord1.y = dot3( toEye, rpModelMatrixY );
result.texcoord1.z = dot3( toEye, rpModelMatrixZ );
result.texcoord2.x = dot3( tangent, rpModelMatrixX );
result.texcoord3.x = dot3( tangent, rpModelMatrixY );
result.texcoord4.x = dot3( tangent, rpModelMatrixZ );
result.texcoord2.y = dot3( binormal, rpModelMatrixX );
result.texcoord3.y = dot3( binormal, rpModelMatrixY );
result.texcoord4.y = dot3( binormal, rpModelMatrixZ );
result.texcoord2.z = dot3( normal, rpModelMatrixX );
result.texcoord3.z = dot3( normal, rpModelMatrixY );
result.texcoord4.z = dot3( normal, rpModelMatrixZ );
result.color = rpColor;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float4 color : COLOR;
float3 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 src = tex2D( samp0, fragment.texcoord0.xy );
float4 target = fragment.color * dot3( float3( 0.333, 0.333, 0.333 ), src );
result.color = lerp( src, target, fragment.texcoord0.z );
}

View File

@@ -0,0 +1,61 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform float4 rpUser0 : register(c128); //rpFraction
uniform float4 rpUser1 : register(c129); //rpTargetHue
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 color : COLOR0;
float3 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.color = rpUser1; // targetHue
result.texcoord0.x = vertex.texcoord.x;
result.texcoord0.y = 1.0f - vertex.texcoord.y;
result.texcoord0.z = rpUser0.x; // fraction
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = float4( 0.0, 0.0, 0.0, 1.0 );
}

View File

@@ -0,0 +1,85 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
struct PS_IN {
float4 position : VPOS;
float2 texcoord : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float2 screenTexCoord = fragment.texcoord;
// compute warp factor
float4 warpFactor = 1.0 - ( tex2D( samp1, screenTexCoord.xy ) * fragment.color );
screenTexCoord -= float2( 0.5, 0.5 );
screenTexCoord *= warpFactor.xy;
screenTexCoord += float2( 0.5, 0.5 );
// load the screen render
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
// User Renderparms start at 128 as per renderprogs.h
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord = vertex.texcoord.xy;
const float4 deformMagnitude = rpUser1;
result.color = deformMagnitude;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float3 globalNormal = normalize( fragment.texcoord1 );
float3 globalEye = normalize( fragment.texcoord0 );
float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );
reflectionVector *= globalNormal;
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,59 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float4 normal : NORMAL;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 toEye = rpLocalViewOrigin - vertex.position;
result.texcoord0 = toEye.xyz;
result.texcoord1 = vNormal.xyz;
result.color = rpColor;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0); // texture 0 is the cube map
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float3 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float3 globalNormal = normalize( fragment.texcoord1 );
float3 globalEye = normalize( fragment.texcoord0 );
float3 reflectionVector = _float3( dot3( globalEye, globalNormal ) );
reflectionVector *= globalNormal;
reflectionVector = ( reflectionVector * 2.0f ) - globalEye;
float4 envMap = texCUBE( samp0, reflectionVector );
result.color = float4( envMap.xyz, 1.0f ) * fragment.color;
}

View File

@@ -0,0 +1,105 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float3 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 vNormalSkinned;
vNormalSkinned.x = dot3( matX, vNormal );
vNormalSkinned.y = dot3( matY, vNormal );
vNormalSkinned.z = dot3( matZ, vNormal );
vNormalSkinned = normalize( vNormalSkinned );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 toEye = rpLocalViewOrigin - modelPosition;
result.texcoord0 = toEye.xyz;
result.texcoord1 = vNormalSkinned.xyz;
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
result.texcoord1.x = dot4( vertex.position, rpTexGen1S );
result.texcoord1.y = dot4( vertex.position, rpTexGen1T );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float2 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * tex2D( samp1, fragment.texcoord1 ) * rpColor;
}

View File

@@ -0,0 +1,96 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
// end of skinning
// start of fog portion
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
result.texcoord0.x = dot4( modelPosition, rpTexGen0S );
result.texcoord0.y = dot4( modelPosition, rpTexGen0T );
result.texcoord1.x = dot4( modelPosition, rpTexGen1S );
result.texcoord1.y = dot4( modelPosition, rpTexGen1T );
}

110
base/renderprogs/fxaa.pixel Normal file
View File

@@ -0,0 +1,110 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
#define FXAA_GREEN_AS_LUMA 1
#define FXAA_EARLY_EXIT 0
#include "Fxaa3_11.h"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1); // exponent bias -1
uniform sampler2D samp2 : register(s2); // exponent bias -2
uniform float4 rpUser0 : register( c128 );
uniform float4 rpUser1 : register( c129 );
uniform float4 rpUser2 : register( c130 );
uniform float4 rpUser3 : register( c131 );
uniform float4 rpUser4 : register( c132 );
uniform float4 rpUser5 : register( c133 );
uniform float4 rpUser6 : register( c134 );
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float4 FXAAQualityRCPFrame = rpUser0;
const float4 FXAAConsoleRcpFrameOpt = rpUser1;
const float4 FXAAConsoleRcpFrameOpt2 = rpUser2;
const float4 FXAAConsole360RcpFrameOpt2 = rpUser3;
const float4 FXAAQualityParms = rpUser4;
const float4 FXAAConsoleEdgeParms = rpUser5;
const float4 FXAAConsole360ConstDir = rpUser6;
// Inputs - see more info in fxaa3_11.hfile
FxaaFloat2 fxaaPos = fragment.texcoord0;
FxaaFloat4 fxaaConsolePos;
float2 halfPixelOffset = float2( 0.5, 0.5 ) * FXAAQualityRCPFrame.xy;
fxaaConsolePos.xy = fxaaPos.xy - ( halfPixelOffset );
fxaaConsolePos.zw = fxaaPos.xy + ( halfPixelOffset );
FxaaFloat2 fxaaQualityRcpFrame = FXAAQualityRCPFrame.xy;
FxaaFloat4 fxaaConsoleRcpFrameOpt = FXAAConsoleRcpFrameOpt;
FxaaFloat4 fxaaConsoleRcpFrameOpt2 = FXAAConsoleRcpFrameOpt2;
FxaaFloat4 fxaaConsole360RcpFrameOpt2 = FXAAConsole360RcpFrameOpt2;
// Quality parms
FxaaFloat fxaaQualitySubpix = FXAAQualityParms.x;
FxaaFloat fxaaQualityEdgeThreshold = FXAAQualityParms.y;
FxaaFloat fxaaQualityEdgeThresholdMin = FXAAQualityParms.z;
// Console specific Parms
FxaaFloat fxaaConsoleEdgeSharpness = FXAAConsoleEdgeParms.x;
FxaaFloat fxaaConsoleEdgeThreshold = FXAAConsoleEdgeParms.y;
FxaaFloat fxaaConsoleEdgeThresholdMin = FXAAConsoleEdgeParms.z;
// 360 specific parms these have to come from a constant register so that the compiler
// does not unoptimize the shader
FxaaFloat4 fxaaConsole360ConstDir = FXAAConsole360ConstDir;
float4 colorSample = FxaaPixelShader( fxaaPos,
fxaaConsolePos,
samp0,
samp1,
samp2,
fxaaQualityRcpFrame,
fxaaConsoleRcpFrameOpt,
fxaaConsoleRcpFrameOpt2,
fxaaConsole360RcpFrameOpt2,
fxaaQualitySubpix,
fxaaQualityEdgeThreshold,
fxaaQualityEdgeThresholdMin,
fxaaConsoleEdgeSharpness,
fxaaConsoleEdgeThreshold,
fxaaConsoleEdgeThresholdMin,
fxaaConsole360ConstDir );
result.color = colorSample;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.texcoord0 = vertex.texcoord;
}

176
base/renderprogs/global.inc Normal file
View File

@@ -0,0 +1,176 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
uniform float4 rpScreenCorrectionFactor : register(c0);
uniform float4 rpWindowCoord : register(c1);
uniform float4 rpDiffuseModifier : register(c2);
uniform float4 rpSpecularModifier : register(c3);
uniform float4 rpLocalLightOrigin : register(c4);
uniform float4 rpLocalViewOrigin : register(c5);
uniform float4 rpLightProjectionS : register(c6);
uniform float4 rpLightProjectionT : register(c7);
uniform float4 rpLightProjectionQ : register(c8);
uniform float4 rpLightFalloffS : register(c9);
uniform float4 rpBumpMatrixS : register(c10);
uniform float4 rpBumpMatrixT : register(c11);
uniform float4 rpDiffuseMatrixS : register(c12);
uniform float4 rpDiffuseMatrixT : register(c13);
uniform float4 rpSpecularMatrixS : register(c14);
uniform float4 rpSpecularMatrixT : register(c15);
uniform float4 rpVertexColorModulate : register(c16);
uniform float4 rpVertexColorAdd : register(c17);
uniform float4 rpColor : register(c18);
uniform float4 rpViewOrigin : register(c19);
uniform float4 rpGlobalEyePos : register(c20);
uniform float4 rpMVPmatrixX : register(c21);
uniform float4 rpMVPmatrixY : register(c22);
uniform float4 rpMVPmatrixZ : register(c23);
uniform float4 rpMVPmatrixW : register(c24);
uniform float4 rpModelMatrixX : register(c25);
uniform float4 rpModelMatrixY : register(c26);
uniform float4 rpModelMatrixZ : register(c27);
uniform float4 rpModelMatrixW : register(c28);
uniform float4 rpProjectionMatrixX : register(c29);
uniform float4 rpProjectionMatrixY : register(c30);
uniform float4 rpProjectionMatrixZ : register(c31);
uniform float4 rpProjectionMatrixW : register(c32);
uniform float4 rpModelViewMatrixX : register(c33);
uniform float4 rpModelViewMatrixY : register(c34);
uniform float4 rpModelViewMatrixZ : register(c35);
uniform float4 rpModelViewMatrixW : register(c36);
uniform float4 rpTextureMatrixS : register(c37);
uniform float4 rpTextureMatrixT : register(c38);
uniform float4 rpTexGen0S : register(c39);
uniform float4 rpTexGen0T : register(c40);
uniform float4 rpTexGen0Q : register(c41);
uniform float4 rpTexGen0Enabled : register(c42);
uniform float4 rpTexGen1S : register(c43);
uniform float4 rpTexGen1T : register(c44);
uniform float4 rpTexGen1Q : register(c45);
uniform float4 rpTexGen1Enabled : register(c46);
uniform float4 rpWobbleSkyX : register(c47);
uniform float4 rpWobbleSkyY : register(c48);
uniform float4 rpWobbleSkyZ : register(c49);
uniform float4 rpOverbright : register(c50);
uniform float4 rpEnableSkinning : register(c51);
uniform float4 rpAlphaTest : register(c52);
static float dot2( float2 a, float2 b ) { return dot( a, b ); }
static float dot3( float3 a, float3 b ) { return dot( a, b ); }
static float dot3( float3 a, float4 b ) { return dot( a, b.xyz ); }
static float dot3( float4 a, float3 b ) { return dot( a.xyz, b ); }
static float dot3( float4 a, float4 b ) { return dot( a.xyz, b.xyz ); }
static float dot4( float4 a, float4 b ) { return dot( a, b ); }
static float dot4( float2 a, float4 b ) { return dot( float4( a, 0, 1 ), b ); }
// ----------------------
// YCoCg Color Conversion
// ----------------------
static const half4 matrixRGB1toCoCg1YX = half4( 0.50, 0.0, -0.50, 0.50196078 ); // Co
static const half4 matrixRGB1toCoCg1YY = half4( -0.25, 0.5, -0.25, 0.50196078 ); // Cg
static const half4 matrixRGB1toCoCg1YZ = half4( 0.0, 0.0, 0.0, 1.0 ); // 1.0
static const half4 matrixRGB1toCoCg1YW = half4( 0.25, 0.5, 0.25, 0.0 ); // Y
static const half4 matrixCoCg1YtoRGB1X = half4( 1.0, -1.0, 0.0, 1.0 );
static const half4 matrixCoCg1YtoRGB1Y = half4( 0.0, 1.0, -0.50196078, 1.0 ); // -0.5 * 256.0 / 255.0
static const half4 matrixCoCg1YtoRGB1Z = half4( -1.0, -1.0, 1.00392156, 1.0 ); // +1.0 * 256.0 / 255.0
static half3 ConvertYCoCgToRGB( half4 YCoCg ) {
half3 rgbColor;
YCoCg.z = ( YCoCg.z * 31.875 ) + 1.0; //z = z * 255.0/8.0 + 1.0
YCoCg.z = 1.0 / YCoCg.z;
YCoCg.xy *= YCoCg.z;
rgbColor.x = dot4( YCoCg, matrixCoCg1YtoRGB1X );
rgbColor.y = dot4( YCoCg, matrixCoCg1YtoRGB1Y );
rgbColor.z = dot4( YCoCg, matrixCoCg1YtoRGB1Z );
return rgbColor;
}
static float2 CenterScale( float2 inTC, float2 centerScale ) {
float scaleX = centerScale.x;
float scaleY = centerScale.y;
float4 tc0 = float4( scaleX, 0, 0, 0.5 - ( 0.5f * scaleX ) );
float4 tc1 = float4( 0, scaleY, 0, 0.5 - ( 0.5f * scaleY ) );
float2 finalTC;
finalTC.x = dot4( inTC, tc0 );
finalTC.y = dot4( inTC, tc1 );
return finalTC;
}
static float2 Rotate2D( float2 inTC, float2 cs ) {
float sinValue = cs.y;
float cosValue = cs.x;
float4 tc0 = float4( cosValue, -sinValue, 0, ( -0.5f * cosValue ) + ( 0.5f * sinValue ) + 0.5f );
float4 tc1 = float4( sinValue, cosValue, 0, ( -0.5f * sinValue ) + ( -0.5f * cosValue ) + 0.5f );
float2 finalTC;
finalTC.x = dot4( inTC, tc0 );
finalTC.y = dot4( inTC, tc1 );
return finalTC;
}
// better noise function available at https://github.com/ashima/webgl-noise
float rand( float2 co ) {
return frac( sin( dot( co.xy, float2( 12.9898, 78.233 ) ) ) * 43758.5453 );
}
#define _half2( x ) half2( x )
#define _half3( x ) half3( x )
#define _half4( x ) half4( x )
#define _float2( x ) float2( x )
#define _float3( x ) float3( x )
#define _float4( x ) float4( x )
#define VPOS WPOS
static float4 idtex2Dproj( sampler2D samp, float4 texCoords ) { return tex2Dproj( samp, texCoords.xyw ); }
static float4 swizzleColor( float4 c ) { return c; }
static float2 vposToScreenPosTexCoord( float2 vpos ) { return vpos.xy * rpWindowCoord.xy; }
#define BRANCH
#define IFANY

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = ( tex2D( samp0, fragment.texcoord0 ) * fragment.color ) + fragment.texcoord1;
result.color.xyz = color.xyz * color.w;
result.color.w = color.w;
}

View File

@@ -0,0 +1,56 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0.xy = vertex.texcoord.xy;
result.texcoord1 = ( swizzleColor( vertex.color2 ) * 2 ) - 1;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 texcoord2 : TEXCOORD2_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the distortion map
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
// kill the pixel if the distortion wound up being very small
mask.xy -= 0.01f;
clip( mask );
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
localNormal *= mask.xy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord2.xy );
screenTexCoord = saturate( screenTexCoord );
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,84 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 );
// texture 1 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord1 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;
// texture 2 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate R1. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4 ( vec, rpProjectionMatrixW );
// don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0 );
x /= w;
//x = x * ( 1.0f / ( w + 0.00001f ) );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02 );
const float4 deformMagnitude = rpUser1;
result.texcoord2 = x * deformMagnitude;
}

View File

@@ -0,0 +1,68 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
uniform sampler2D samp2 : register(s2); // texture 2 is the mask texture
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
float4 texcoord2 : TEXCOORD2_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the distortion map
float4 mask = tex2D( samp2, fragment.texcoord0.xy );
// kill the pixel if the distortion wound up being very small
mask.xy *= fragment.color.xy;
mask.xy -= 0.01f;
clip( mask );
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord1.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
localNormal *= mask.xy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord2.xy );
screenTexCoord = saturate( screenTexCoord );
result.color = tex2D( samp0, screenTexCoord );
}

View File

@@ -0,0 +1,86 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
// texture 0 takes the texture coordinates unmodified
result.texcoord0 = float4( vertex.texcoord, 0 , 0 );
// texture 1 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord1 = float4( vertex.texcoord, 0, 0 ) + textureScroll;
// texture 2 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ );
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4 ( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4( vec, rpProjectionMatrixW );
// don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0f );
x /= w;
//x = x * ( 1.0f / w );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02f );
const float4 deformMagnitude = rpUser1;
result.texcoord2 = x * deformMagnitude;
result.color = swizzleColor( vertex.color );
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 0 is _current Render
uniform sampler2D samp1 : register(s1); // texture 1 is the per-surface bump map
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 texcoord1 : TEXCOORD1_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// load the filtered normal map and convert to -1 to 1 range
float4 bumpMap = ( tex2D( samp1, fragment.texcoord0.xy ) * 2.0f ) - 1.0f;
float2 localNormal = bumpMap.wy;
// calculate the screen texcoord in the 0.0 to 1.0 range
float2 screenTexCoord = vposToScreenPosTexCoord( fragment.position.xy );
screenTexCoord += ( localNormal * fragment.texcoord1.xy );
screenTexCoord = saturate( screenTexCoord );
// load the screen render
result.color = tex2D( samp0, screenTexCoord.xy );
}

View File

@@ -0,0 +1,82 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
// User Renderparms start at 128 as per renderprogs.h
uniform float4 rpUser0 : register(c128); // rpScroll
uniform float4 rpUser1 : register(c129); // rpDeformMagnitude
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
};
void main( VS_IN vertex, out VS_OUT result ) {
#include "skinning.inc"
//texture 0 takes the texture coordinates and adds a scroll
const float4 textureScroll = rpUser0;
result.texcoord0 = float4( vertex.texcoord.xy, 0, 0 ) + textureScroll;
//texture 1 takes the deform magnitude and scales it by the projection distance
float4 vec = float4( 0, 1, 0, 1 );
vec.z = dot4( modelPosition, rpModelViewMatrixZ ); // this is the modelview matrix
// magicProjectionAdjust is a magic scalar that scales the projection since we changed from
// using the X axis to the Y axis to calculate x. It is an approximation to closely match
// what the original game did
const float magicProjectionAdjust = 0.43f;
float x = dot4( vec, rpProjectionMatrixY ) * magicProjectionAdjust;
float w = dot4( vec, rpProjectionMatrixW );
//don't let the recip get near zero for polygons that cross the view plane
w = max( w, 1.0 );
x /= w;
//x = x * ( 1.0f / w );
// clamp the distance so the the deformations don't get too wacky near the view
x = min( x, 0.02 );
const float4 deformMagnitude = rpUser1;
result.texcoord1 = x * deformMagnitude;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord0 : TEXCOORD0_centroid;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
half3 lightVector = normalize( fragment.texcoord0.xyz );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,120 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float3 vNormal = vertex.normal.xyz * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - vertex.position;
//result.texcoord0
result.texcoord0.x = dot3( vTangent.xyz, toLight );
result.texcoord0.y = dot3( vBinormal, toLight );
result.texcoord0.z = dot3( vNormal, toLight );
result.texcoord0.w = 1.0f;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( vertex.position, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( vertex.position, rpLightProjectionS );
result.texcoord3.y = dot4( vertex.position, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( vertex.position, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - vertex.position );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( vTangent.xyz, halfAngleVector );
result.texcoord6.y = dot3( vBinormal, halfAngleVector );
result.texcoord6.z = dot3( vNormal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );
half3 lightVector = normalize( ambientLightVector );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,113 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 normal = vertex.normal * 2.0 - 1.0;
float4 tangent = vertex.tangent * 2.0 - 1.0;
float3 binormal = cross( normal.xyz, tangent.xyz ) * tangent.w;
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - vertex.position;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( vertex.position, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( vertex.position, rpLightProjectionS );
result.texcoord3.y = dot4( vertex.position, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( vertex.position, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - vertex.position );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
const half3 ambientLightVector = half3( 0.5f, 9.5f - 0.385f, 0.8925f );
half3 lightVector = normalize( ambientLightVector );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,171 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - modelPosition;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( modelPosition, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( modelPosition, rpLightProjectionS );
result.texcoord3.y = dot4( modelPosition, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,78 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // texture 1 is the per-surface bump map
uniform sampler2D samp1 : register(s1); // texture 2 is the light falloff texture
uniform sampler2D samp2 : register(s2); // texture 3 is the light projection texture
uniform sampler2D samp3 : register(s3); // texture 4 is the per-surface diffuse map
uniform sampler2D samp4 : register(s4); // texture 5 is the per-surface specular map
struct PS_IN {
half4 position : VPOS;
half4 texcoord0 : TEXCOORD0_centroid;
half4 texcoord1 : TEXCOORD1_centroid;
half4 texcoord2 : TEXCOORD2_centroid;
half4 texcoord3 : TEXCOORD3_centroid;
half4 texcoord4 : TEXCOORD4_centroid;
half4 texcoord5 : TEXCOORD5_centroid;
half4 texcoord6 : TEXCOORD6_centroid;
half4 color : COLOR0;
};
struct PS_OUT {
half4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
half4 bumpMap = tex2D( samp0, fragment.texcoord1.xy );
half4 lightFalloff = idtex2Dproj( samp1, fragment.texcoord2 );
half4 lightProj = idtex2Dproj( samp2, fragment.texcoord3 );
half4 YCoCG = tex2D( samp3, fragment.texcoord4.xy );
half4 specMap = tex2D( samp4, fragment.texcoord5.xy );
half3 lightVector = normalize( fragment.texcoord0.xyz );
half3 diffuseMap = ConvertYCoCgToRGB( YCoCG );
half3 localNormal;
localNormal.xy = bumpMap.wy - 0.5;
localNormal.z = sqrt( abs( dot( localNormal.xy, localNormal.xy ) - 0.25 ) );
localNormal = normalize( localNormal );
const half specularPower = 10.0f;
half hDotN = dot3( normalize( fragment.texcoord6.xyz ), localNormal );
half3 specularContribution = _half3( pow( hDotN, specularPower ) );
half3 diffuseColor = diffuseMap * rpDiffuseModifier.xyz;
half3 specularColor = specMap.xyz * specularContribution * rpSpecularModifier.xyz;
half3 lightColor = dot3( lightVector, localNormal ) * lightProj.xyz * lightFalloff.xyz;
result.color.xyz = ( diffuseColor + specularColor ) * lightColor * fragment.color.xyz;
result.color.w = 1.0;
}

View File

@@ -0,0 +1,185 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float4 texcoord3 : TEXCOORD3;
float4 texcoord4 : TEXCOORD4;
float4 texcoord5 : TEXCOORD5;
float4 texcoord6 : TEXCOORD6;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vNormal = vertex.normal * 2.0 - 1.0;
float4 vTangent = vertex.tangent * 2.0 - 1.0;
float3 vBinormal = cross( vNormal.xyz, vTangent.xyz ) * vTangent.w;
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float3 normal;
normal.x = dot3( matX, vNormal );
normal.y = dot3( matY, vNormal );
normal.z = dot3( matZ, vNormal );
normal = normalize( normal );
float3 tangent;
tangent.x = dot3( matX, vTangent );
tangent.y = dot3( matY, vTangent );
tangent.z = dot3( matZ, vTangent );
tangent = normalize( tangent );
float3 binormal;
binormal.x = dot3( matX, vBinormal );
binormal.y = dot3( matY, vBinormal );
binormal.z = dot3( matZ, vBinormal );
binormal = normalize( binormal );
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light in R0
float4 toLight = rpLocalLightOrigin - modelPosition;
//--------------------------------------------------------------
//result.texcoord0 is the direction to the light in tangent space
result.texcoord0.x = dot3( tangent, toLight );
result.texcoord0.y = dot3( binormal, toLight );
result.texcoord0.z = dot3( normal, toLight );
result.texcoord0.w = 1.0f;
//textures 1 takes the base coordinates by the texture matrix
result.texcoord1 = defaultTexCoord;
result.texcoord1.x = dot4( vertex.texcoord.xy, rpBumpMatrixS );
result.texcoord1.y = dot4( vertex.texcoord.xy, rpBumpMatrixT );
//# texture 2 has one texgen
result.texcoord2 = defaultTexCoord;
result.texcoord2.x = dot4( modelPosition, rpLightFalloffS );
//# texture 3 has three texgens
result.texcoord3.x = dot4( modelPosition, rpLightProjectionS );
result.texcoord3.y = dot4( modelPosition, rpLightProjectionT );
result.texcoord3.z = 0.0f;
result.texcoord3.w = dot4( modelPosition, rpLightProjectionQ );
//# textures 4 takes the base coordinates by the texture matrix
result.texcoord4 = defaultTexCoord;
result.texcoord4.x = dot4( vertex.texcoord.xy, rpDiffuseMatrixS );
result.texcoord4.y = dot4( vertex.texcoord.xy, rpDiffuseMatrixT );
//# textures 5 takes the base coordinates by the texture matrix
result.texcoord5 = defaultTexCoord;
result.texcoord5.x = dot4( vertex.texcoord.xy, rpSpecularMatrixS );
result.texcoord5.y = dot4( vertex.texcoord.xy, rpSpecularMatrixT );
//# texture 6's texcoords will be the halfangle in texture space
//# calculate normalized vector to light in R0
toLight = normalize( toLight );
//# calculate normalized vector to viewer in R1
float4 toView = normalize( rpLocalViewOrigin - modelPosition );
//# add together to become the half angle vector in object space (non-normalized)
float4 halfAngleVector = toLight + toView;
//# put into texture space
result.texcoord6.x = dot3( tangent, halfAngleVector );
result.texcoord6.y = dot3( binormal, halfAngleVector );
result.texcoord6.z = dot3( normal, halfAngleVector );
result.texcoord6.w = 1.0f;
// for joint transformation of the tangent space, we use color and
// color2 for weighting information, so hopefully there aren't any
// effects that need vertex color...
result.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );
//# generate the vertex color, which can be 1.0, color, or 1.0 - color
//# for 1.0 : env[16] = 0, env[17] = 1
//# for color : env[16] = 1, env[17] = 0
//# for 1.0-color : env[16] = -1, env[17] = 1
// result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,92 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0); // view color
uniform sampler2D samp1 : register(s1); // view depth
struct PS_IN {
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
#if 0
if ( fragment.texcoord0.x < 0.5 ) {
// only draw on half the screen for comparison
discard;
}
#endif
// don't motion blur the hands, which were drawn with alpha = 0
if ( tex2D( samp0, fragment.texcoord0 ).w == 0.0 ) {
discard;
}
// derive clip space from the depth buffer and screen position
float windowZ = tex2D( samp1, fragment.texcoord0 ).x;
float3 ndc = float3( fragment.texcoord0 * 2.0 - 1.0, windowZ * 2.0 - 1.0 );
float clipW = -rpProjectionMatrixZ.w / ( -rpProjectionMatrixZ.z - ndc.z );
float4 clip = float4( ndc * clipW, clipW );
// convert from clip space this frame to clip space previous frame
float4 reClip;
reClip.x = dot( rpMVPmatrixX, clip );
reClip.y = dot( rpMVPmatrixY, clip );
reClip.z = dot( rpMVPmatrixZ, clip );
reClip.w = dot( rpMVPmatrixW, clip );
// convert to NDC values
float2 prevTexCoord;
prevTexCoord.x = ( reClip.x / reClip.w ) * 0.5 + 0.5;
prevTexCoord.y = ( reClip.y / reClip.w ) * 0.5 + 0.5;
// sample along the line from prevTexCoord to fragment.texcoord0
float2 texCoord = prevTexCoord; //fragment.texcoord0;
float2 delta = ( fragment.texcoord0 - prevTexCoord );
float3 sum = float3( 0.0 );
float goodSamples = 0;
float samples = rpOverbright.x;
for ( float i = 0 ; i < samples ; i = i + 1 ) {
float2 pos = fragment.texcoord0 + delta * ( ( i / ( samples - 1 ) ) - 0.5 );
float4 color = tex2D( samp0, pos );
// only take the values that are not part of the weapon
sum += color.xyz * color.w;
goodSamples += color.w;
}
float invScale = 1.0 / goodSamples;
result.color = float4( sum * invScale, 1.0 );
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float2 tCoords = fragment.texcoord0;
result.color = tex2D( samp0, tCoords );
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
//result.position.x = vertex.position; //dot4( vertex.position, rpMVPmatrixX );
//result.position.y = dot4( vertex.position, rpMVPmatrixY );
//result.position.z = dot4( vertex.position, rpMVPmatrixZ );
//result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vPos = vertex.position - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 vPos = vertex.position - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,91 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 vertexPosition = vertex.position;
vertexPosition.w = 1.0;
float4 modelPosition;
modelPosition.x = dot4( matX, vertexPosition );
modelPosition.y = dot4( matY, vertexPosition );
modelPosition.z = dot4( matZ, vertexPosition );
modelPosition.w = vertex.position.w;
float4 vPos = modelPosition - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,38 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,91 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 vertexPosition = vertex.position;
vertexPosition.w = 1.0;
float4 modelPosition;
modelPosition.x = dot4( matX, vertexPosition );
modelPosition.y = dot4( matY, vertexPosition );
modelPosition.z = dot4( matZ, vertexPosition );
modelPosition.w = vertex.position.w;
float4 vPos = modelPosition - rpLocalLightOrigin;
vPos = ( vPos.wwww * rpLocalLightOrigin ) + vPos;
result.position.x = dot4( vPos, rpMVPmatrixX );
result.position.y = dot4( vPos, rpMVPmatrixY );
result.position.z = dot4( vPos, rpMVPmatrixZ );
result.position.w = dot4( vPos, rpMVPmatrixW );
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
uniform sampler2D samp0 : register(s0);
static float2 screenPosToTexcoord( float2 pos, float4 bias_scale ) { return ( pos * bias_scale.zw + bias_scale.xy ); }
void main( PS_IN fragment, out PS_OUT result ) {
const float renderWidth = 1280.0f;
const float renderHeight = 720.0f;
const float4 positionToViewTexture = float4( 0.5f / renderWidth, 0.5f / renderHeight, 1.0f / renderWidth, 1.0f / renderHeight );
float interpolatedZOverW = ( 1.0 - ( fragment.texcoord0.z / fragment.texcoord0.w ) );
float3 pos;
pos.z = 1.0 / interpolatedZOverW;
pos.xy = pos.z * ( 2.0 * screenPosToTexcoord( fragment.position.xy, positionToViewTexture ) - 1.0 );
float3 normal = normalize( cross( ddy( pos ), ddx( pos ) ) );
// light is above and to the right in the eye plane
float3 L = normalize( float3( 1.0, 1.0, 0.0 ) - pos );
result.color.xyz = _float3( dot3( normal, L ) * 0.75 );
result.color.w = 1.0;
}

View File

@@ -0,0 +1,53 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
float4 position;
position.x = dot4( vertex.position, rpMVPmatrixX );
position.y = dot4( vertex.position, rpMVPmatrixY );
position.z = dot4( vertex.position, rpMVPmatrixZ );
position.w = dot4( vertex.position, rpMVPmatrixW );
result.position = position;
result.texcoord0 = position;
}

View File

@@ -0,0 +1,71 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
float4 modelPosition = vertex.position;
BRANCH if ( rpEnableSkinning.x > 0.0 ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
}
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;
}

View File

@@ -0,0 +1,54 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.position.xyz - rpLocalViewOrigin.xyz;
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_OUT {
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.color = rpColor;
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
}

View File

@@ -0,0 +1,49 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
uniform sampler2D samp1 : register(s1);
struct PS_IN {
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// texcoords will run from 0 to 1 across the entire screen
if ( fract( fragment.position.y * 0.5 ) < 0.5 ) {
result.color = tex2D( samp0, vec2( fragment.texcoord0 ) );
} else {
result.color = tex2D( samp1, vec2( fragment.texcoord0 ) );
}
}

View File

@@ -0,0 +1,48 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,74 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
/*
This shader will cover a square block of pixel coordinates, but some of them might
be scissored off if the edges of the screen or the midpoint divider are visible through
the optics.
*/
uniform sampler2D samp0 : register(s0);
struct PS_IN {
vec4 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
const float screenWarp_range = 1.45;
const vec2 warpCenter = vec2( 0.5, 0.5 );
vec2 centeredTexcoord = fragment.texcoord0.xy - warpCenter;
float radialLength = length( centeredTexcoord );
vec2 radialDir = normalize( centeredTexcoord );
// get it down into the 0 - PI/2 range
float range = screenWarp_range;
float scaledRadialLength = radialLength * range;
float tanScaled = tan( scaledRadialLength );
float rescaleValue = tan( 0.5 * range );
// If radialLength was 0.5, we want rescaled to also come out
// as 0.5, so the edges of the rendered image are at the edges
// of the warped image.
float rescaled = tanScaled / rescaleValue;
vec2 warped = warpCenter + vec2( 0.5, 0.5 ) * radialDir * rescaled;
result.color = tex2D( samp0, warped );
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float4 texcoord : TEXCOORD0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0: TEXCOORD0; // 0 to 1 box
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
result.texcoord0 = vertex.texcoord;
}

View File

@@ -0,0 +1,44 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = tex2D( samp0, fragment.texcoord0 ) * rpColor;
}

View File

@@ -0,0 +1,58 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;
clip( color.a - rpAlphaTest.x );
result.color = color;
}

View File

@@ -0,0 +1,62 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( vertex.position, rpTexGen0S );
result.texcoord0.y = dot4( vertex.position, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,47 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float2 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
float4 color = tex2D( samp0, fragment.texcoord0 ) * fragment.color;
clip( color.a - rpAlphaTest.x );
result.color = color;
}

View File

@@ -0,0 +1,100 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform matrices_ubo { float4 matrices[408]; };
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR0;
float4 color2 : COLOR1;
};
struct VS_OUT {
float4 position : POSITION;
float2 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
//--------------------------------------------------------------
// GPU transformation of the normal / binormal / bitangent
//
// multiplying with 255.1 give us the same result and is faster than floor( w * 255 + 0.5 )
//--------------------------------------------------------------
const float w0 = vertex.color2.x;
const float w1 = vertex.color2.y;
const float w2 = vertex.color2.z;
const float w3 = vertex.color2.w;
float4 matX, matY, matZ; // must be float4 for vec4
float joint = vertex.color.x * 255.1 * 3;
matX = matrices[int(joint+0)] * w0;
matY = matrices[int(joint+1)] * w0;
matZ = matrices[int(joint+2)] * w0;
joint = vertex.color.y * 255.1 * 3;
matX += matrices[int(joint+0)] * w1;
matY += matrices[int(joint+1)] * w1;
matZ += matrices[int(joint+2)] * w1;
joint = vertex.color.z * 255.1 * 3;
matX += matrices[int(joint+0)] * w2;
matY += matrices[int(joint+1)] * w2;
matZ += matrices[int(joint+2)] * w2;
joint = vertex.color.w * 255.1 * 3;
matX += matrices[int(joint+0)] * w3;
matY += matrices[int(joint+1)] * w3;
matZ += matrices[int(joint+2)] * w3;
float4 modelPosition;
modelPosition.x = dot4( matX, vertex.position );
modelPosition.y = dot4( matY, vertex.position );
modelPosition.z = dot4( matZ, vertex.position );
modelPosition.w = 1.0;
result.position.x = dot4( modelPosition, rpMVPmatrixX );
result.position.y = dot4( modelPosition, rpMVPmatrixY );
result.position.z = dot4( modelPosition, rpMVPmatrixZ );
result.position.w = dot4( modelPosition, rpMVPmatrixW );
// compute oldschool texgen or multiply by texture matrix
BRANCH if ( rpTexGen0Enabled.x > 0.0 ) {
result.texcoord0.x = dot4( modelPosition, rpTexGen0S );
result.texcoord0.y = dot4( modelPosition, rpTexGen0T );
} else {
result.texcoord0.x = dot4( vertex.texcoord.xy, rpTextureMatrixS );
result.texcoord0.y = dot4( vertex.texcoord.xy, rpTextureMatrixT );
}
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,52 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform sampler2D samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float4 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
// we always do a projective texture lookup so that we can support texgen
// materials without a separate shader. Basic materials will have texture
// coordinates with w = 1 which will result in a NOP projection when tex2Dproj
// gets called.
float4 texSample = idtex2Dproj( samp0, fragment.texcoord0 );
result.color = texSample * fragment.color;
}

View File

@@ -0,0 +1,66 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float4 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float4 tc0;
tc0.x = dot4( vertex.position, rpTexGen0S );
tc0.y = dot4( vertex.position, rpTexGen0T );
tc0.z = 0.0f;
tc0.w = dot4( vertex.position, rpTexGen0Q );
// multiply the texture matrix in
result.texcoord0.x = dot4( tc0, rpTextureMatrixS );
result.texcoord0.y = dot4( tc0, rpTextureMatrixT );
result.texcoord0.zw = tc0.zw;
// compute vertex modulation
float4 vertexColor = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
result.color = vertexColor * rpColor;
}

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
uniform samplerCUBE samp0 : register(s0);
struct PS_IN {
float4 position : VPOS;
float3 texcoord0 : TEXCOORD0_centroid;
float4 color : COLOR0;
};
struct PS_OUT {
float4 color : COLOR;
};
void main( PS_IN fragment, out PS_OUT result ) {
result.color = texCUBE( samp0, fragment.texcoord0 ) * fragment.color;
}

View File

@@ -0,0 +1,57 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
float2 texcoord : TEXCOORD0;
float4 normal : NORMAL;
float4 tangent : TANGENT;
float4 color : COLOR0;
};
struct VS_OUT {
float4 position : POSITION;
float3 texcoord0 : TEXCOORD0;
float4 color : COLOR0;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position.x = dot4( vertex.position, rpMVPmatrixX );
result.position.y = dot4( vertex.position, rpMVPmatrixY );
result.position.z = dot4( vertex.position, rpMVPmatrixZ );
result.position.w = dot4( vertex.position, rpMVPmatrixW );
float3 t0 = vertex.position.xyz - rpLocalViewOrigin.xyz;
result.texcoord0.x = dot3( t0, rpWobbleSkyX );
result.texcoord0.y = dot3( t0, rpWobbleSkyY );
result.texcoord0.z = dot3( t0, rpWobbleSkyZ );
result.color = ( swizzleColor( vertex.color ) * rpVertexColorModulate ) + rpVertexColorAdd;
}

View File

@@ -0,0 +1,39 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct PS_OUT {
float depth : DEPTH;
float4 color : COLOR;
};
void main( out PS_OUT result ) {
result.depth = 1;
result.color = float4( 0.0, 0.0, 0.0, 0.0 );
}

View File

@@ -0,0 +1,42 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "global.inc"
struct VS_IN {
float4 position : POSITION;
};
struct VS_OUT {
float4 position : POSITION;
};
void main( VS_IN vertex, out VS_OUT result ) {
result.position = vertex.position;
result.position.z = -1.0;
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>$(SolutionDir)..\build\$(PlatformName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)..\build\$(PlatformName)\$(Configuration)\intermediate\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)Main;$(SolutionDir);$(DXSDK_DIR)\Include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<PreprocessorDefinitions>_D3XP;CTF;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
</Project>

View File

@@ -0,0 +1,147 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "DoomLeaderboards.h"
#include "tech5/engine/framework/precompiled.h"
#include "tech5\engine\sys\sys_stats.h"
#include "../doomengine/source/doomdef.h"
#include <map>
static columnDef_t columnDefTime[] = {
{ "Time", 64, AGGREGATE_MIN, STATS_COLUMN_DISPLAY_TIME_MILLISECONDS }
};
const static int NUMLEVELS_ULTIMATE_DOOM = 36;
const static int NUMLEVELS_DOOM2_HELL_ON_EARTH = 32;
const static int NUMLEVELS_FINALDOOM_TNT = 32;
const static int NUMLEVELS_FINALDOOM_PLUTONIA = 32;
const static int NUMLEVELS_DOOM2_MASTER_LEVELS = 21;
const static int NUMLEVELS_DOOM2_NERVE = 9;
const static int NUM_LEVEL_LIST[] = {
NUMLEVELS_ULTIMATE_DOOM,
NUMLEVELS_DOOM2_HELL_ON_EARTH,
NUMLEVELS_FINALDOOM_TNT,
NUMLEVELS_FINALDOOM_PLUTONIA,
NUMLEVELS_DOOM2_MASTER_LEVELS,
NUMLEVELS_DOOM2_NERVE
};
/*
========================
GenerateLeaderboard ID
Generates a Leaderboard ID based on current Expansion + episode + map + skill + Type
Expansion is the base value that the leaderboard ID comes from
========================
*/
const int GenerateLeaderboardID( int expansion, int episode, int map, int skill ) {
int realMapNumber = ( episode * map - 1 );
if( common->GetGameSKU() == GAME_SKU_DOOM1_BFG ) {
// Doom levels start at 620 .. yeah.. hack.
int block = 615;
int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ;
return block + mapAndSkill;
} else if( common->GetGameSKU() == GAME_SKU_DOOM2_BFG ) {
if( expansion == 1 ) {
// Doom 2 Levels start at 800.. Yep.. another hack.
int block = 795;
int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ;
return block + mapAndSkill;
} else {
// Nerve Levels start at 960... another hack!
int block = 955;
int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ;
return block + mapAndSkill;
}
} else {
// DCC Content
int block = 0;
if( expansion > 0 ){
for( int expi = 0; expi < expansion; expi++ ) {
block += NUM_LEVEL_LIST[ expi ] * ( (int)sk_nightmare + 1);
}
}
int mapAndSkill = ( realMapNumber * ( (int)sk_nightmare + 1 ) ) + skill ;
return block + mapAndSkill;
}
}
/*
========================
InitLeaderboards
Generates all the possible leaderboard definitions
and stores into an STL Map, with leaderboard ID as the Hash/key value.
========================
*/
void InitLeaderboards() {
for( int expi = 0; expi < ARRAY_COUNT( NUM_LEVEL_LIST ); expi++ ) {
for( int udi = 1; udi <= NUM_LEVEL_LIST[expi] ; udi++ ) {
for( int skilli = 0; skilli <= sk_nightmare; skilli++ ) {
// Create the Time Trial leaderboard for each level.
int timeTrial_leaderboardID = GenerateLeaderboardID( expi, 1, udi, skilli );
leaderboardDefinition_t * timeTrial_Leaderboard = new leaderboardDefinition_t( timeTrial_leaderboardID, ARRAY_COUNT( columnDefTime ), columnDefTime, RANK_LEAST_FIRST, false, true );
}
}
}
}
/*
========================
GenerateLeaderboard
Generates a Leaderboard based on current Expansion + episode + map + skill + Type
Expansion is the base value that the leaderboard ID comes from
========================
*/
const leaderboardDefinition_t * GetLeaderboard( int expansion, int episode, int map, int skill ) {
int leaderboardID = GenerateLeaderboardID( expansion, episode, map, skill );
return Sys_FindLeaderboardDef( leaderboardID );;
}

View File

@@ -0,0 +1,45 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef __DOOM_LEADERBOARDS_H__
#define __DOOM_LEADERBOARDS_H__
#include "sys\sys_stats_misc.h"
enum Leaderboard_type_t {
LEADERBOARD_TYPE_TIME_TRIAL,
LEADERBOARD_TYPE_FRAGS,
LEADERBOARD_MAX_TYPES
};
void InitLeaderboards();
const leaderboardDefinition_t * GetLeaderboard( int expansion, int episode, int map, int skill );
#endif // __DOOM_LEADERBOARDS_H__

102
doomclassic/doom/Main.h Normal file
View File

@@ -0,0 +1,102 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef _MAIN_H_
#define _MAIN_H_
#include "idlib/precompiled.h"
#include "../doom/doomlib.h"
#include "../doom/doominterface.h"
#include "../doom/globaldata.h"
// DHM - Nerve :: Enable demo recording for game clips
#define _DEMO_RECORDING
#ifdef _DEBUG
#define safeOutputDebug(x) printf( "%s", x );
#else
#define safeOutputDebug(x)
#endif
struct SplitscreenData {
int PLAYERCOUNT;
int globalSkill;
int globalEpisode;
int globalLevel;
int globalTimeLimit;
int globalFragLimit;
};
void DL_InitNetworking( DoomInterface *pdi );
extern int PLAYERCOUNT;
extern bool globalNetworking;
extern bool debugOutput;
extern BOOL globalLicenseFullGame;
extern int globalRichPresenceState; // values from spa.h X_CONTEXT_PRESENCE
extern int globalNeedUpsell;
// PS3
//extern HXUISTRINGTABLE globalStrings; // gStrings for short
extern bool globalPauseTime;
enum MenuStates{
MENU_NONE,
MENU_XBOX_SYSTEM,
MENU_PAUSE,
MENU_UPSELL,
MENU_UPSELL_INVITE,
MENU_ENDLEVEL_UPSELL,
MENU_ERROR_MESSAGE,
MENU_ERROR_MESSAGE_FATAL,
MENU_END_LEVEL,
MENU_END_EPISODE,
MENU_END_CAST,
MENU_END_LEVEL_COOP,
MENU_END_LEVEL_DM,
MENU_END_GAME_LOBBY,
MENU_END_GAME_LOBBY_PLAYER,
MENU_LOBBY,
MENU_LOBBY_PLAYER,
MENU_INVITE,
MENU_COUNT
};
typedef struct {
int maxPing;
const wchar_t * image;
} PingImage_t;
extern PingImage_t pingsImages[];
#endif

View File

@@ -0,0 +1,166 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "Precompiled.h"
#include "../Main/Main.h"
#include <sys/types.h>
#include <sys/socket.h>
#include "tech5/engine/sys/sys_lobby.h"
bool useTech5Packets = true;
#if 1
struct networkitem
{
int source;
int size;
char buffer[256*64];
};
std::queue< networkitem > networkstacks[4];
//sockaddr_in sockaddrs[4];
int DoomLibRecv( char* buff, DWORD *numRecv )
{
//int player = DoomInterface::CurrentPlayer();
int player = ::g->consoleplayer;
if (networkstacks[player].empty())
return -1;
networkitem item = networkstacks[player].front();
memcpy( buff, item.buffer, item.size );
*numRecv = item.size;
//*source = sockaddrs[item.source];
networkstacks[player].pop();
return 1;
}
void I_Printf(char *error, ...);
int DoomLibSend( const char* buff, DWORD size, sockaddr_in *target, int toNode )
{
int i;
i = DoomLib::RemoteNodeToPlayerIndex( toNode );
//I_Printf( "DoomLibSend %d --> %d: %d\n", ::g->consoleplayer, i, size );
networkitem item;
item.source = DoomInterface::CurrentPlayer();
item.size = size;
memcpy( item.buffer, buff, size );
networkstacks[i].push( item );
return 1;
}
int DoomLibSendRemote()
{
if ( gameLocal == NULL ) {
return 0;
}
int curPlayer = DoomLib::GetPlayer();
for (int player = 0; player < gameLocal->Interface.GetNumPlayers(); ++player)
{
DoomLib::SetPlayer( player );
for( int i = 0; i < 4; i++ ) {
//Check if it is remote
int node = DoomLib::PlayerIndexToRemoteNode( i );
if ( ::g->sendaddress[node].sin_addr.s_addr == ::g->sendaddress[0].sin_addr.s_addr ) {
continue;
}
while(!networkstacks[i].empty()) {
networkitem item = networkstacks[i].front();
int c;
//WSABUF buffer;
//DWORD num_sent;
//buffer.buf = (char*)&item.buffer;
//buffer.len = item.size;
if ( useTech5Packets ) {
idLobby & lobby = static_cast< idLobby & >( session->GetGameLobbyBase() );
lobbyUser_t * user = lobby.GetLobbyUser( i );
if ( user != NULL ) {
lobby.SendConnectionLess( user->address, idLobby::OOB_GENERIC_GAME_DATA, (const byte *)(&item.buffer[0] ), item.size );
}
} else {
c = sendto( ::g->sendsocket, &item.buffer, item.size, MSG_DONTWAIT, (sockaddr*)&::g->sendaddress[node], sizeof(::g->sendaddress[node]) );
//c = WSASendTo(::g->sendsocket, &buffer, 1, &num_sent, 0, (sockaddr*)&::g->sendaddress[node], sizeof(::g->sendaddress[node]), 0, 0);
}
networkstacks[i].pop();
}
}
}
DoomLib::SetPlayer(curPlayer);
return 1;
}
void DL_InitNetworking( DoomInterface *pdi )
{
// DHM - Nerve :: Clear out any old splitscreen packets that may be lingering.
for ( int i = 0; i<4; i++ ) {
while ( !networkstacks[i].empty() ) {
networkstacks[i].pop();
}
}
/*sockaddrs[0].sin_addr.s_addr = inet_addr("0.0.0.1" );
sockaddrs[1].sin_addr.s_addr = inet_addr("0.0.0.2" );
sockaddrs[2].sin_addr.s_addr = inet_addr("0.0.0.3" );
sockaddrs[3].sin_addr.s_addr = inet_addr("0.0.0.4" );*/
pdi->SetNetworking( DoomLibRecv, DoomLibSend, DoomLibSendRemote );
}
#else
void DL_InitNetworking( DoomInterface *pdi ) {
}
#endif

View File

@@ -0,0 +1,649 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "PlayerProfile.h"
#include "PS3_Includes.h"
#include "PSN/PS3_Session.h"
const int32 FRAMEWORK_PROFILE_VER = 1;
// Store master volume settings in archived cvars, becausue we want them to apply
// even if a user isn't signed in.
// The range is from 0 to 15, which matches the setting in vanilla DOOM.
idCVar s_volume_sound( "s_volume_sound", "8", CVAR_ARCHIVE | CVAR_INTEGER, "sound volume", 0, 15 );
idCVar s_volume_midi( "s_volume_midi", "8", CVAR_ARCHIVE | CVAR_INTEGER, "music volume", 0, 15 );
/*
================================================
idProfileMgr
================================================
*/
/*
========================
idProfileMgr
========================
*/
idProfileMgr::idProfileMgr() :
profileSaveProcessor( new (TAG_SAVEGAMES) idSaveGameProcessorSaveProfile ),
profileLoadProcessor( new (TAG_SAVEGAMES) idSaveGameProcessorLoadProfile ),
profile( NULL ),
handle( 0 ) {
}
/*
================================================
~idProfileMgr
================================================
*/
idProfileMgr::~idProfileMgr() {
delete profileSaveProcessor;
profileSaveProcessor = NULL;
delete profileLoadProcessor;
profileLoadProcessor = NULL;
}
/*
========================
idProfileMgr::Init
========================
*/
void idProfileMgr::Init( idPlayerProfile * profile_ ) {
profile = profile_;
handle = 0;
}
/*
========================
idProfileMgr::Pump
========================
*/
void idProfileMgr::Pump() {
// profile can be NULL if we forced the user to register as in the case of map-ing into a level from the press start screen
if ( profile == NULL ) {
return;
}
// See if we are done with saving/loading the profile
bool saving = profile->GetState() == idPlayerProfile::SAVING;
bool loading = profile->GetState() == idPlayerProfile::LOADING;
if ( ( saving || loading ) && psn_session->GetSaveGameManager()->IsSaveGameCompletedFromHandle( handle ) ) {
profile->SetState( idPlayerProfile::IDLE );
if ( saving ) {
// Done saving
} else if ( loading ) {
// Done loading
const idSaveLoadParms & parms = profileLoadProcessor->GetParms();
if ( parms.GetError() == SAVEGAME_E_FOLDER_NOT_FOUND || parms.GetError() == SAVEGAME_E_FILE_NOT_FOUND ) {
profile->SaveSettings();
} else if ( parms.GetError() != SAVEGAME_E_NONE ) {
profile->SetState( idPlayerProfile::ERR );
}
}
}
// See if we need to save/load the profile
if ( profile->GetRequestedState() == idPlayerProfile::SAVE_REQUESTED ) {
SaveSettings();
profile->SetRequestedState( idPlayerProfile::IDLE );
} else if ( profile->GetRequestedState() == idPlayerProfile::LOAD_REQUESTED ) {
LoadSettings();
profile->SetRequestedState( idPlayerProfile::IDLE );
}
}
/*
========================
idProfileMgr::GetProfile
========================
*/
idPlayerProfile * idProfileMgr::GetProfile() {
if ( profile == NULL ) {
return NULL;
}
bool loading = ( profile->GetState() == idPlayerProfile::LOADING ) || ( profile->GetRequestedState() == idPlayerProfile::LOAD_REQUESTED );
if ( loading ) {
return NULL;
}
return profile;
}
/*
========================
idProfileMgr::SaveSettings
========================
*/
void idProfileMgr::SaveSettings() {
if ( profile != NULL && saveGame_enable.GetBool() ) {
// Issue the async save...
if ( profileSaveProcessor->InitSaveProfile( profile, "" ) ) {
handle = psn_session->GetSaveGameManager()->ExecuteProcessor( profileSaveProcessor );
profile->SetState( idPlayerProfile::SAVING );
}
} else {
// If not able to save the profile, just change the state and leave
if ( profile == NULL ) {
idLib::Warning( "Not saving profile, profile is NULL." );
}
if ( !saveGame_enable.GetBool() ) {
idLib::Warning( "Skipping profile save because saveGame_enable = 0" );
}
}
}
/*
========================
idProfileMgr::LoadSettings
========================
*/
void idProfileMgr::LoadSettings() {
if ( profile != NULL && saveGame_enable.GetBool() ) {
if ( profileLoadProcessor->InitLoadProfile( profile, "" ) ) {
// Skip the not found error because this might be the first time to play the game!
profileLoadProcessor->SetSkipSystemErrorDialogMask( SAVEGAME_E_FOLDER_NOT_FOUND | SAVEGAME_E_FILE_NOT_FOUND );
handle = psn_session->GetSaveGameManager()->ExecuteProcessor( profileLoadProcessor );
profile->SetState( idPlayerProfile::LOADING );
}
} else {
// If not able to save the profile, just change the state and leave
if ( profile == NULL ) {
idLib::Warning( "Not loading profile, profile is NULL." );
}
if ( !saveGame_enable.GetBool() ) {
idLib::Warning( "Skipping profile load because saveGame_enable = 0" );
}
}
}
/*
================================================
idSaveGameProcessorSaveProfile
================================================
*/
/*
========================
idSaveGameProcessorSaveProfile::idSaveGameProcessorSaveProfile
========================
*/
idSaveGameProcessorSaveProfile::idSaveGameProcessorSaveProfile() {
profileFile = NULL;
profile = NULL;
}
/*
========================
idSaveGameProcessorSaveProfile::InitSaveProfile
========================
*/
bool idSaveGameProcessorSaveProfile::InitSaveProfile( idPlayerProfile * profile_, const char * folder ) {
// Serialize the profile and pass a file to the processor
profileFile = new (TAG_SAVEGAMES) idFile_Memory( SAVEGAME_PROFILE_FILENAME );
profileFile->MakeWritable();
profileFile->SetMaxLength( MAX_PROFILE_SIZE );
idTempArray< byte > buffer( MAX_PROFILE_SIZE );
idBitMsg msg;
msg.InitWrite( buffer.Ptr(), MAX_PROFILE_SIZE );
idSerializer ser( msg, true );
profile_->SerializeSettings( ser );
profileFile->Write( msg.GetReadData(), msg.GetSize() );
profileFile->MakeReadOnly();
idList< idSaveFileEntry > files;
files.Append( idSaveFileEntry( profileFile, SAVEGAMEFILE_BINARY | SAVEGAMEFILE_AUTO_DELETE, SAVEGAME_PROFILE_FILENAME ) );
idSaveGameDetails description;
if ( !idSaveGameProcessor::Init() ) {
return false;
}
if ( files.Num() == 0 ) {
idLib::Warning( "No files to save." );
return false;
}
// Setup save system
parms.directory = AddSaveFolderPrefix( folder, idSaveGameManager::PACKAGE_PROFILE );
parms.mode = SAVEGAME_MBF_SAVE | SAVEGAME_MBF_HIDDEN; // do NOT delete the existing files
parms.saveFileType = SAVEFILE_TYPE_AUTO;
for ( int i = 0; i < files.Num(); ++i ) {
parms.files.Append( files[i] );
}
description.title = idLocalization::GetString( "#str_savegame_title" );
description.subTitle = idLocalization::GetString( "#str_savegame_profile_heading" );
description.summary = idLocalization::GetString( "#str_savegame_profile_desc" );
// Add static image as the thumbnail
staticScreenshotFile = new (TAG_SAVEGAMES) idFile_Memory( "image" );
// Open up the Image file and Make it a memory file.
void* thumbImage = NULL;
int imagesize = fileSystem->ReadFile( "base/textures/PROFILE.PNG", &thumbImage ); // This file lives at USRData.. i think.
staticScreenshotFile->MakeWritable();
staticScreenshotFile->Write( thumbImage, imagesize );
staticScreenshotFile->MakeReadOnly();
parms.files.Append( idSaveFileEntry( staticScreenshotFile, SAVEGAMEFILE_THUMB, "image" ) );
fileSystem->FreeFile( thumbImage );
this->parms.description = description;
parms.description.slotName = folder;
// TODO:KC - what was the purpose of this?
// JAF idKeyInput::SetUserDeviceNumForBind( profile_->GetDeviceNumForProfile() );
profile = profile_;
return true;
}
/*
========================
idSaveGameProcessorSaveProfile::Process
========================
*/
bool idSaveGameProcessorSaveProfile::Process() {
// Files already setup for save, just execute as normal files
// Platform-specific implementation
// This will start a worker thread for async operation.
// It will always signal when it's completed.
Sys_ExecuteSavegameCommandAsync( &parms );
return false;
}
/*
================================================
idSaveGameProcessorLoadProfile
================================================
*/
/*
========================
idSaveGameProcessorLoadProfile::idSaveGameProcessorLoadProfile
========================
*/
idSaveGameProcessorLoadProfile::idSaveGameProcessorLoadProfile() {
profileFile = NULL;
profile = NULL;
}
/*
========================
idSaveGameProcessorLoadProfile::~idSaveGameProcessorLoadProfile
========================
*/
idSaveGameProcessorLoadProfile::~idSaveGameProcessorLoadProfile() {
}
/*
========================
idSaveGameProcessorLoadProfile::InitLoadFiles
========================
*/
bool idSaveGameProcessorLoadProfile::InitLoadProfile( idPlayerProfile * profile_, const char * folder_ ) {
if ( !idSaveGameProcessor::Init() ) {
return false;
}
parms.directory = AddSaveFolderPrefix( folder_, idSaveGameManager::PACKAGE_PROFILE );
parms.description.slotName = folder_;
parms.mode = SAVEGAME_MBF_LOAD | SAVEGAME_MBF_HIDDEN;
parms.saveFileType = SAVEFILE_TYPE_AUTO;
profileFile = new (TAG_SAVEGAMES) idFile_Memory( SAVEGAME_PROFILE_FILENAME );
parms.files.Append( idSaveFileEntry( profileFile, SAVEGAMEFILE_BINARY, SAVEGAME_PROFILE_FILENAME ) );
profile = profile_;
return true;
}
/*
========================
idSaveGameProcessorLoadProfile::Process
========================
*/
bool idSaveGameProcessorLoadProfile::Process() {
Sys_ExecuteSavegameCommandAsync( &parms );
return false;
}
/*
========================
idSaveGameProcessorLoadProfile::PostProcess
========================
*/
void idSaveGameProcessorLoadProfile::PostProcess() {
// Serialize the loaded profile
bool foundProfile = profileFile->Length() > 0;
if ( foundProfile ) {
idTempArray< byte> buffer( MAX_PROFILE_SIZE );
// Serialize settings from this buffer
profileFile->MakeReadOnly();
profileFile->ReadBigArray( buffer.Ptr(), profileFile->Length() );
idBitMsg msg;
msg.InitRead( buffer.Ptr(), (int)buffer.Size() );
idSerializer ser( msg, false );
profile->SerializeSettings( ser );
// JAF idKeyInput::SetUserDeviceNumForBind( profile->GetDeviceNumForProfile() );
} else {
parms.errorCode = SAVEGAME_E_FILE_NOT_FOUND;
}
delete profileFile;
}
/*
========================
Contains data that needs to be saved out on a per player profile basis, global for the lifetime of the player so
the data can be shared across computers.
- HUD tint colors
- key bindings
- etc...
========================
*/
/*
========================
idPlayerProfile::idPlayerProfile
========================
*/
idPlayerProfile::idPlayerProfile() {
SetDefaults();
// Don't have these in SetDefaults because they're used for state management and SetDefaults is called when
// loading the profile
state = IDLE;
requestedState = IDLE;
}
/*
========================
idPlayerProfile::SetDefaults
========================
*/
void idPlayerProfile::SetDefaults() {
achievementBits = 0;
seenInstallMessage = false;
stats.SetNum( MAX_PLAYER_PROFILE_STATS );
for ( int i = 0; i < MAX_PLAYER_PROFILE_STATS; ++i ) {
stats[i].i = 0;
}
deviceNum = 0;
state = IDLE;
requestedState = IDLE;
frameScaleX = 0.85f;
frameScaleY = 0.85f;
}
/*
========================
idPlayerProfile::Init
========================
*/
void idPlayerProfile::Init() {
SetDefaults();
}
/*
========================
idPlayerProfile::~idPlayerProfile
========================
*/
idPlayerProfile::~idPlayerProfile() {
}
/*
========================
idPlayerProfile::SerializeSettings
========================
*/
bool idPlayerProfile::SerializeSettings( idSerializer & ser ) {
int flags = cvarSystem->GetModifiedFlags();
// Default to current tag/version
int32 tag = GetProfileTag();
int32 version = FRAMEWORK_PROFILE_VER;
// Serialize tag/version
ser.SerializePacked( tag );
if ( tag != GetProfileTag() ) {
idLib::Warning( "Profile tag did not match, profile will be re-initialized" );
SetDefaults();
SaveSettings(); // Flag the profile to save so we have the latest version stored
return false;
}
ser.SerializePacked( version );
if ( version != FRAMEWORK_PROFILE_VER ) {
// For now, don't allow profiles with invalid versions load
// We could easily support old version by doing a few version checks below to pick and choose what we load as well.
idLib::Warning( "Profile version did not match. Profile will be replaced" );
SetDefaults();
SaveSettings(); // Flag the profile to save so we have the latest version stored
return false;
}
// Serialize audio settings
SERIALIZE_BOOL( ser, seenInstallMessage );
// New setting to save to make sure that we have or haven't seen this achievement before used to pass TRC R149d
ser.Serialize( achievementBits );
ser.Serialize( frameScaleX );
ser.Serialize( frameScaleY );
SERIALIZE_BOOL( ser, alwaysRun );
// we save all the cvar-based settings in the profile even though some cvars are archived
// so that we are consistent and don't miss any or get affected when the archive flag is changed
SERIALIZE_CVAR_INT( ser, s_volume_sound );
SERIALIZE_CVAR_INT( ser, s_volume_midi );
// Don't trigger profile save due to modified archived cvars during profile load
cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE ); // must clear because set() is an OR operation, not assignment...
cvarSystem->SetModifiedFlags( flags );
return true;
}
/*
========================
idPlayerProfile::GetLevel
========================
*/
int idPlayerProfile::GetLevel() const {
return 1;
}
/*
========================
idPlayerProfile::StatSetInt
========================
*/
void idPlayerProfile::StatSetInt( int s, int v ) {
stats[s].i = v;
}
/*
========================
idPlayerProfile::StatSetFloat
========================
*/
void idPlayerProfile::StatSetFloat( int s, float v ) {
stats[s].f = v;
}
/*
========================
idPlayerProfile::StatGetInt
========================
*/
int idPlayerProfile::StatGetInt( int s ) const {
return stats[s].i;
}
/*
========================
idPlayerProfile::StatGetFloat
========================
*/
float idPlayerProfile::StatGetFloat( int s ) const {
return stats[s].f;
}
/*
========================
idPlayerProfile::SaveSettings
========================
*/
void idPlayerProfile::SaveSettings() {
if ( state != SAVING ) {
if ( GetRequestedState() == IDLE ) {
SetRequestedState( SAVE_REQUESTED );
}
}
}
/*
========================
idPlayerProfile::SaveSettings
========================
*/
void idPlayerProfile::LoadSettings() {
if ( state != LOADING ) {
if ( verify( GetRequestedState() == IDLE ) ) {
SetRequestedState( LOAD_REQUESTED );
}
}
}
/*
========================
idPlayerProfile::SetAchievementBit
========================
*/
void idPlayerProfile::SetAchievementBit( const int id ) {
if ( id > 63 ) {
assert( false ); // FIXME: add another set of achievement bit flags
return;
}
achievementBits |= (int64)1 << id;
}
/*
========================
idPlayerProfile::ClearAchievementBit
========================
*/
void idPlayerProfile::ClearAchievementBit( const int id ) {
if ( id > 63 ) {
assert( false ); // FIXME: add another set of achievement bit flags
return;
}
achievementBits &= ~( (int64)1 << id );
}
/*
========================
idPlayerProfile::GetAchievementBit
========================
*/
bool idPlayerProfile::GetAchievementBit( const int id ) const {
if ( id > 63 ) {
assert( false ); // FIXME: add another set of achievement bit flags
return false;
}
return ( achievementBits & (int64)1 << id ) != 0;
}
/*
========================
Returns the value stored in the music volume cvar.
========================
*/
int idPlayerProfile::GetMusicVolume() const {
return s_volume_midi.GetInteger();
}
/*
========================
Returns the value stored in the sound volume cvar.
========================
*/
int idPlayerProfile::GetSoundVolume() const {
return s_volume_sound.GetInteger();
}
/*
========================
Sets the music volume cvar.
========================
*/
void idPlayerProfile::SetMusicVolume( int volume ) {
s_volume_midi.SetInteger( volume );
}
/*
========================
Sets the sound volume cvar.
========================
*/
void idPlayerProfile::SetSoundVolume( int volume ) {
s_volume_sound.SetInteger( volume );
}

View File

@@ -0,0 +1,267 @@
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 BFG Edition Source Code 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#ifndef __PLAYERPROFILE_H__
#define __PLAYERPROFILE_H__
#include "Precompiled.h"
#include "Serializer.h"
//#include "SaveGameManager.h"
#define MAX_PROFILE_SIZE ( 1024 * 1000 ) // High number for the key bindings
#define SAVEGAME_PROFILE_FILENAME "_PROF"
extern idCVar s_volume_sound;
extern idCVar s_volume_midi;
class idSaveGameProcessorSaveProfile;
class idSaveGameProcessorLoadProfile;
class idPlayerProfile;
/*
================================================
idProfileMgr
================================================
*/
class idProfileMgr {
public:
idProfileMgr();
~idProfileMgr();
// Called the first time it's asked to load
void Init( idPlayerProfile * profile );
void Pump();
idPlayerProfile * GetProfile();
private:
void LoadSettings();
void SaveSettings();
private:
idSaveGameProcessorSaveProfile * profileSaveProcessor;
idSaveGameProcessorLoadProfile * profileLoadProcessor;
idPlayerProfile * profile;
saveGameHandle_t handle;
};
/*
================================================
idSaveGameProcessorSaveProfile
================================================
*/
class idSaveGameProcessorSaveProfile : public idSaveGameProcessor {
public:
DEFINE_CLASS( idSaveGameProcessorSaveProfile );
idSaveGameProcessorSaveProfile();
bool InitSaveProfile( idPlayerProfile * profile, const char * folder );
virtual bool Process();
private:
idFile_Memory * profileFile;
idFile_Memory * staticScreenshotFile;
idPlayerProfile * profile;
};
/*
================================================
idSaveGameProcessorLoadProfile
================================================
*/
class idSaveGameProcessorLoadProfile: public idSaveGameProcessor {
public:
DEFINE_CLASS( idSaveGameProcessorLoadProfile );
idSaveGameProcessorLoadProfile();
~idSaveGameProcessorLoadProfile();
bool InitLoadProfile( idPlayerProfile * profile, const char * folder );
virtual bool Process();
virtual void PostProcess();
private:
idFile_Memory * profileFile;
idPlayerProfile * profile;
};
/*
================================================
profileStatValue_t
================================================
*/
union profileStatValue_t {
int i;
float f;
};
/*
================================================
idPlayerProfile
The general rule for using cvars for settings is that if you want the player's profile settings to affect the startup
of the game before there is a player associated with the game, use cvars. Example: video & volume settings.
================================================
*/
class idPlayerProfile {
public:
static const int MAX_PLAYER_PROFILE_STATS = 500;
enum state_t {
IDLE = 0,
SAVING,
LOADING,
SAVE_REQUESTED,
LOAD_REQUESTED,
ERR
};
enum displayMode_t {
DISPLAY_INVALID = -1,
DISPLAY_WINDOWED,
DISPLAY_FULLSCREEN,
MAX_DISPLAY_MODES
};
enum syncTypes_t {
SYNC_INVALID = -1,
SYNC_TEAR,
SYNC_ON,
SYNC_SMART,
MAX_SYNC_COUNT,
};
public:
idPlayerProfile(); // don't instantiate. we static_cast the child all over the place
virtual ~idPlayerProfile();
//------------------------
// each game can override but call the parent serialize first
//------------------------
virtual void SetDefaults();
virtual void Init();
virtual bool SerializeSettings( idSerializer & ser );
//------------------------
// each game must override, not an abstract method because we have a static object as a hack... ugh.
//------------------------
virtual int32 GetProfileTag() { return -1; }
int GetDeviceNumForProfile() { return deviceNum; }
void SetDeviceNumForProfile( int num ) { deviceNum = num; }
//------------------------
void SaveSettings();
void LoadSettings();
state_t GetState() const { return state; }
state_t GetRequestedState() const { return requestedState; }
//------------------------
// settings
//------------------------
float GetFrameScaleX() const { return frameScaleX; }
float GetFrameScaleY() const { return frameScaleY; }
void SetFrameScaleX( float scale ) { frameScaleX = scale; }
void SetFrameScaleY( float scale ) { frameScaleY = scale; }
int GetMusicVolume() const;
int GetSoundVolume() const;
void SetMusicVolume( int volume );
void SetSoundVolume( int volume );
bool GetAlwaysRun() const { return alwaysRun; }
void SetAlwaysRun( bool set ) { alwaysRun = set; }
//------------------------
// misc
//------------------------
virtual int GetLevel() const;
void ClearAchievementBit( const int id ); // Should only be called by idLocalUser
bool GetAchievementBit( const int id ) const;
void SetAchievementBit( const int id ); // Should only be called by idLocalUser
bool GetSeenInstallMessage() const { return seenInstallMessage; }
void SetSeenInstallMessage( bool seen ) { seenInstallMessage = seen; }
bool HasSavedGame() const { return hasSavedGame; }
void SetHasSavedGame() { hasSavedGame = true; }
protected:
friend class idLocalUser;
friend class idProfileMgr;
// used by idLocalUser and internally
void StatSetInt( int s, int v );
void StatSetFloat( int s, float v );
int StatGetInt( int s ) const;
float StatGetFloat( int s ) const;
private:
void SetState( state_t value ) { state = value; }
void SetRequestedState( state_t value ) { requestedState = value; }
protected:
//------------------------
// settings
//------------------------
bool alwaysRun;
int musicVolume;
int soundVolume;
//------------------------
// video settings
//------------------------
float frameScaleX;
float frameScaleY;
//------------------------
// state management
//------------------------
state_t state;
state_t requestedState;
//------------------------
// stats are stored in the profile
//------------------------
idStaticList< profileStatValue_t, MAX_PLAYER_PROFILE_STATS > stats;
//------------------------
// misc
//------------------------
int deviceNum;
bool seenInstallMessage;
uint64 achievementBits;
bool hasSavedGame;
};
#endif

Some files were not shown because too many files have changed in this diff Show More