Compare commits
41 commits
Author | SHA1 | Date | |
---|---|---|---|
|
48d5773f3d | ||
|
cdfcc60e9a | ||
|
ba89779ffb | ||
|
523f8d4aed | ||
|
40cf552716 | ||
|
e2c6ee493a | ||
|
f664a51977 | ||
|
3f79287af5 | ||
|
0558c1c8bc | ||
|
1e17dd4061 | ||
|
ece44600d1 | ||
|
fce0464da5 | ||
|
6d7e750185 | ||
|
28f8745efb | ||
|
5bf996feca | ||
|
cb1c8d1397 | ||
|
f39d4ebde2 | ||
|
34f50517d9 | ||
|
3b35b7db5a | ||
|
b8ffed9a79 | ||
|
f8d2e095a8 | ||
|
058d7ccac9 | ||
|
ec004c058a | ||
|
85a8e592d4 | ||
|
0f401598c6 | ||
|
5ce1078d61 | ||
|
ec228f855e | ||
|
34d7a2bbfd | ||
|
138673efb8 | ||
|
e15b661894 | ||
|
2838832544 | ||
|
774099a7b2 | ||
|
4d65a8f78e | ||
|
5b2bf904de | ||
|
1b879e8373 | ||
|
b033c5fd0e | ||
|
17833f427b | ||
|
6eaeefd267 | ||
|
14b1bfc1fc | ||
|
f7d5c33bbc | ||
|
ec89b4807f |
22
.gitignore
vendored
|
@ -28,20 +28,16 @@ $RECYCLE.BIN/
|
|||
*.class
|
||||
projects/Android/build/*
|
||||
assets/oculussig*
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/android_gradle_build.json
|
||||
Projects/Android/.cxx/*
|
||||
*.json
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/arm64-v8a/ndkBuild_build_output.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_output.txt
|
||||
Projects/Android/.gradle/*
|
||||
Projects/Android/.externalNativeBuild/*
|
||||
*.bin
|
||||
Projects/Android/.gradle/4.4/fileHashes/fileHashes.lock
|
||||
Projects/Android/.gradle/*
|
||||
*.ser
|
||||
Projects/Android/.idea/codeStyles/Project.xml
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/armeabi-v7a/ndkBuild_build_command.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/debug/armeabi-v7a/ndkBuild_build_output.txt
|
||||
Projects/Android/.externalNativeBuild/ndkBuild/release/arm64-v8a/ndkBuild_build_output.txt
|
||||
Projects/Android/.gradle/4.6/fileHashes/fileHashes.lock
|
||||
Projects/Android/.gradle/vcsWorkingDirs/gc.properties
|
||||
Projects/Android/.idea/*
|
||||
drbeef-release-key.keystore
|
||||
assets/pak6.pak
|
||||
Projects/Android/Android.iml
|
||||
Projects/Projects.iml
|
||||
VrSamples-Quake2Quest.iml
|
||||
|
|
125
LICENSE.md
|
@ -1,125 +0,0 @@
|
|||
#GNU GENERAL PUBLIC LICENSE
|
||||
#Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
#NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE 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.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
How to Apply These Terms to Your New Programs
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the program's name and an idea of what it does.
|
||||
Copyright (C) yyyy name of author
|
||||
|
||||
This program 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 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome
|
||||
to redistribute it under certain conditions; type `show c'
|
||||
for details.
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright
|
||||
interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written
|
||||
by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
|
|
@ -1,151 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id=":VrSamples:Quake2Quest:Projects:Android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":VrSamples:Quake2Quest:Projects:Android" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="native-android-gradle" name="Native-Android-Gradle">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
|
||||
<afterSyncTasks>
|
||||
<task>generateDebugSources</task>
|
||||
</afterSyncTasks>
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/../../res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/../../assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/android" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/client" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/game" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/linux" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/null" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/qcommon" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/ref_gl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/jni/src/server" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.externalNativeBuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-main-apk-res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndkBuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/../../assets">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../assets" type="java-resource" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/../../java">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../java" isTestSource="false" />
|
||||
</content>
|
||||
<content url="file://$MODULE_DIR$/../../res">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../res" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 24 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat-24.2.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:24.2.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-24.2.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android-android-24" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.quake2quest"
|
||||
android:versionCode="6"
|
||||
android:versionName="0.6.0" android:installLocation="auto" >
|
||||
android:versionCode="20"
|
||||
android:versionName="1.0.9" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
@ -16,8 +16,10 @@
|
|||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<application android:allowBackup="false" android:icon="@drawable/ic_qquest" android:label="@string/quake2quest">
|
||||
<application android:allowBackup="false" android:icon="@drawable/ic_qquest" android:label="@string/quake2quest" android:extractNativeLibs="true">
|
||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
|
||||
|
||||
<!-- The activity is the built-in NativeActivity framework class. -->
|
||||
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
|
||||
<!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition. -->
|
||||
|
|
|
@ -17,10 +17,10 @@ android {
|
|||
// override app plugin abiFilters for both 32 and 64-bit support
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
abiFilters 'armeabi-v7a','arm64-v8a'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
ndkBuild {
|
||||
abiFilters 'armeabi-v7a','arm64-v8a'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
}
|
||||
minSdkVersion 24
|
||||
|
|
14
Projects/Android/gradle.properties
Normal file
|
@ -0,0 +1,14 @@
|
|||
## For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
#
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx1024m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
#
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
#Sun Nov 15 17:22:31 GMT 2020
|
||||
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
|
|
@ -1,6 +1,6 @@
|
|||
#Sat Jul 27 06:47:04 BST 2019
|
||||
#Sun Sep 04 22:16:08 BST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -1 +1,9 @@
|
|||
include $(call all-subdir-makefiles)
|
||||
include $(GL4ES_PATH)/Android.mk
|
||||
include $(SUPPORT_LIBS)/openal/Android.mk
|
||||
include $(SUPPORT_LIBS)/jpeg8d/Android.mk
|
||||
include $(SUPPORT_LIBS)/libzip/Android.mk
|
||||
include $(SUPPORT_LIBS)/libpng/Android.mk
|
||||
include $(SUPPORT_LIBS)/sigc++/Android.mk
|
||||
include $(TOP_DIR)/quake2/Android.mk
|
||||
include $(TOP_DIR)/quake2/Android_game.mk
|
||||
include $(TOP_DIR)/quake2/Android_gl1.mk
|
||||
|
|
|
@ -10,11 +10,13 @@ APP_CFLAGS += -Wl,--no-undefined
|
|||
|
||||
APPLICATIONMK_PATH = $(call my-dir)
|
||||
|
||||
GL4ES_PATH := $(APPLICATIONMK_PATH)/gl4es
|
||||
TOP_DIR := $(APPLICATIONMK_PATH)
|
||||
SUPPORT_LIBS := $(APPLICATIONMK_PATH)/SupportLibs
|
||||
GL4ES_PATH := $(SUPPORT_LIBS)/gl4es
|
||||
|
||||
APP_ALLOW_MISSING_DEPS=true
|
||||
|
||||
APP_MODULES := gl4es quake2
|
||||
APP_MODULES := yquake2 yquake2_game gl4es yquake2_gl1
|
||||
APP_STL := c++_shared
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
#include <EGL/eglext.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3ext.h>
|
||||
#include <GLES/gl2ext.h>
|
||||
|
||||
|
||||
#include "VrApi.h"
|
||||
|
@ -39,12 +40,14 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
#include "VrApi_Input.h"
|
||||
#include "VrApi_Types.h"
|
||||
|
||||
#include "../gl4es/src/gl/loader.h"
|
||||
#include <src/gl/loader.h>
|
||||
|
||||
#include <src/client/header/client.h>
|
||||
|
||||
#include "VrCompositor.h"
|
||||
#include "VrInput.h"
|
||||
|
||||
#include "../quake2/src/client/client.h"
|
||||
#include "../quake2/src/client/header/client.h"
|
||||
|
||||
#if !defined( EGL_OPENGL_ES3_BIT_KHR )
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
|
||||
|
@ -73,13 +76,15 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
|
|||
#endif
|
||||
|
||||
//Let's go to the maximum!
|
||||
int CPU_LEVEL = 2;
|
||||
int GPU_LEVEL = 3;
|
||||
int NUM_MULTI_SAMPLES = 1;
|
||||
float SS_MULTIPLIER = 1.25f;
|
||||
int CPU_LEVEL = 4;
|
||||
int GPU_LEVEL = 4;
|
||||
int NUM_MULTI_SAMPLES = 2;
|
||||
float SS_MULTIPLIER = 1.1f;
|
||||
|
||||
vec2_t cylinderSize = {1280, 720};
|
||||
|
||||
jclass clazz;
|
||||
|
||||
float radians(float deg) {
|
||||
return (deg * M_PI) / 180.0;
|
||||
}
|
||||
|
@ -98,10 +103,28 @@ char **argv;
|
|||
int argc=0;
|
||||
|
||||
extern cvar_t *r_lefthand;
|
||||
extern cvar_t *cl_paused;
|
||||
|
||||
cvar_t *vr_snapturn_angle;
|
||||
cvar_t *vr_walkdirection;
|
||||
cvar_t *vr_weapon_pitchadjust;
|
||||
cvar_t *vr_lasersight;
|
||||
cvar_t *vr_control_scheme;
|
||||
cvar_t *vr_height_adjust;
|
||||
cvar_t *vr_worldscale;
|
||||
cvar_t *vr_weaponscale;
|
||||
cvar_t *vr_weapon_stabilised;
|
||||
cvar_t *vr_comfort_mask;
|
||||
cvar_t *vr_turn_deadzone;
|
||||
cvar_t *vr_framerate;
|
||||
cvar_t *vr_use_wheels;
|
||||
char **refresh_names;
|
||||
float *refresh_values;
|
||||
|
||||
enum control_scheme {
|
||||
RIGHT_HANDED_DEFAULT = 0,
|
||||
LEFT_HANDED_DEFAULT = 10,
|
||||
LEFT_HANDED_SWITCH_STICKS = 11,
|
||||
GAMEPAD = 20 //Not implemented, someone else can do this!
|
||||
};
|
||||
|
||||
|
@ -133,7 +156,7 @@ void Qcommon_Init (int argc, char **argv);
|
|||
bool useScreenLayer()
|
||||
{
|
||||
//TODO
|
||||
return (showingScreenLayer || (cls.state != ca_connected && cls.state != ca_active) || cls.key_dest != key_game);
|
||||
return (showingScreenLayer || (cls.state != ca_connected && cls.state != ca_active) || cls.key_dest != key_game) || cl.cinematictime != 0;
|
||||
}
|
||||
|
||||
int runStatus = -1;
|
||||
|
@ -486,16 +509,16 @@ static void ovrFramebuffer_Clear( ovrFramebuffer * frameBuffer )
|
|||
|
||||
static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum colorFormat, const int width, const int height, const int multisamples )
|
||||
{
|
||||
LOAD_GLES2(glBindTexture);
|
||||
LOAD_GLES2(glTexParameteri);
|
||||
LOAD_GLES2(glGenRenderbuffers);
|
||||
LOAD_GLES2(glBindRenderbuffer);
|
||||
LOAD_GLES2(glRenderbufferStorage);
|
||||
LOAD_GLES2(glGenFramebuffers);
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
LOAD_GLES2(glFramebufferRenderbuffer);
|
||||
LOAD_GLES2(glFramebufferTexture2D);
|
||||
LOAD_GLES2(glCheckFramebufferStatus);
|
||||
//LOAD_GLES2(glBindTexture);
|
||||
//LOAD_GLES2(glTexParameteri);
|
||||
//LOAD_GLES2(glGenRenderbuffers);
|
||||
//LOAD_GLES2(glBindRenderbuffer);
|
||||
//LOAD_GLES2(glRenderbufferStorage);
|
||||
//LOAD_GLES2(glGenFramebuffers);
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
//LOAD_GLES2(glFramebufferRenderbuffer);
|
||||
//LOAD_GLES2(glFramebufferTexture2D);
|
||||
//LOAD_GLES2(glCheckFramebufferStatus);
|
||||
|
||||
frameBuffer->Width = width;
|
||||
frameBuffer->Height = height;
|
||||
|
@ -506,36 +529,64 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co
|
|||
frameBuffer->DepthBuffers = (GLuint *)malloc( frameBuffer->TextureSwapChainLength * sizeof( GLuint ) );
|
||||
frameBuffer->FrameBuffers = (GLuint *)malloc( frameBuffer->TextureSwapChainLength * sizeof( GLuint ) );
|
||||
|
||||
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glRenderbufferStorageMultisampleEXT =
|
||||
(PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)eglGetProcAddress("glRenderbufferStorageMultisampleEXT");
|
||||
PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC glFramebufferTexture2DMultisampleEXT =
|
||||
(PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT");
|
||||
|
||||
for ( int i = 0; i < frameBuffer->TextureSwapChainLength; i++ )
|
||||
{
|
||||
// Create the color buffer texture.
|
||||
const GLuint colorTexture = vrapi_GetTextureSwapChainHandle( frameBuffer->ColorTextureSwapChain, i );
|
||||
GLenum colorTextureTarget = GL_TEXTURE_2D;
|
||||
GL( gles_glBindTexture( colorTextureTarget, colorTexture ) );
|
||||
GL( glBindTexture( colorTextureTarget, colorTexture ) );
|
||||
// Just clamp to edge. However, this requires manually clearing the border
|
||||
// around the layer to clear the edge texels.
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ) );
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ) );
|
||||
GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ) );
|
||||
GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ) );
|
||||
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) );
|
||||
GL( gles_glTexParameteri( colorTextureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) );
|
||||
GL( gles_glBindTexture( colorTextureTarget, 0 ) );
|
||||
GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR ) );
|
||||
GL( glTexParameteri( colorTextureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR ) );
|
||||
GL( glBindTexture( colorTextureTarget, 0 ) );
|
||||
|
||||
if (multisamples > 1 && glRenderbufferStorageMultisampleEXT != NULL && glFramebufferTexture2DMultisampleEXT != NULL)
|
||||
{
|
||||
|
||||
// Create multisampled depth buffer.
|
||||
GL(glGenRenderbuffers(1, &frameBuffer->DepthBuffers[i]));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
GL(glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, multisamples, GL_DEPTH_COMPONENT24, width, height));
|
||||
GL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
|
||||
|
||||
// Create the frame buffer.
|
||||
GL(glGenFramebuffers(1, &frameBuffer->FrameBuffers[i]));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer->FrameBuffers[i]));
|
||||
GL(glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0, multisamples));
|
||||
GL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i]));
|
||||
GL(GLenum renderFramebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
GL(glBindFramebuffer(GL_FRAMEBUFFER, 0));
|
||||
if (renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE)
|
||||
{
|
||||
ALOGE("OVRHelper::Incomplete frame buffer object: %s", GlFrameBufferStatusString(renderFramebufferStatus));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Create depth buffer.
|
||||
GL( gles_glGenRenderbuffers( 1, &frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( gles_glBindRenderbuffer( GL_RENDERBUFFER, 0 ) );
|
||||
GL( glGenRenderbuffers( 1, &frameBuffer->DepthBuffers[i] ) );
|
||||
GL( glBindRenderbuffer( GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( glBindRenderbuffer( GL_RENDERBUFFER, 0 ) );
|
||||
|
||||
// Create the frame buffer.
|
||||
GL( gles_glGenFramebuffers( 1, &frameBuffer->FrameBuffers[i] ) );
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[i] ) );
|
||||
GL( gles_glFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( gles_glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0 ) );
|
||||
GL( GLenum renderFramebufferStatus = gles_glCheckFramebufferStatus( GL_DRAW_FRAMEBUFFER ) );
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
GL( glGenFramebuffers( 1, &frameBuffer->FrameBuffers[i] ) );
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[i] ) );
|
||||
GL( glFramebufferRenderbuffer( GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, frameBuffer->DepthBuffers[i] ) );
|
||||
GL( glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0 ) );
|
||||
GL( GLenum renderFramebufferStatus = glCheckFramebufferStatus( GL_DRAW_FRAMEBUFFER ) );
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
if ( renderFramebufferStatus != GL_FRAMEBUFFER_COMPLETE )
|
||||
{
|
||||
ALOGE( "Incomplete frame buffer object: %s", GlFrameBufferStatusString( renderFramebufferStatus ) );
|
||||
|
@ -550,11 +601,11 @@ static bool ovrFramebuffer_Create( ovrFramebuffer * frameBuffer, const GLenum co
|
|||
|
||||
void ovrFramebuffer_Destroy( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glDeleteFramebuffers);
|
||||
LOAD_GLES2(glDeleteRenderbuffers);
|
||||
//LOAD_GLES2(glDeleteFramebuffers);
|
||||
//LOAD_GLES2(glDeleteRenderbuffers);
|
||||
|
||||
GL( gles_glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) );
|
||||
GL( gles_glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) );
|
||||
GL( glDeleteFramebuffers( frameBuffer->TextureSwapChainLength, frameBuffer->FrameBuffers ) );
|
||||
GL( glDeleteRenderbuffers( frameBuffer->TextureSwapChainLength, frameBuffer->DepthBuffers ) );
|
||||
|
||||
vrapi_DestroyTextureSwapChain( frameBuffer->ColorTextureSwapChain );
|
||||
|
||||
|
@ -566,14 +617,14 @@ void ovrFramebuffer_Destroy( ovrFramebuffer * frameBuffer )
|
|||
|
||||
void ovrFramebuffer_SetCurrent( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->TextureSwapChainIndex] ) );
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->TextureSwapChainIndex] ) );
|
||||
}
|
||||
|
||||
void ovrFramebuffer_SetNone()
|
||||
{
|
||||
LOAD_GLES2(glBindFramebuffer);
|
||||
GL( gles_glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 ) );
|
||||
}
|
||||
|
||||
void ovrFramebuffer_Resolve( ovrFramebuffer * frameBuffer )
|
||||
|
@ -595,19 +646,19 @@ void ovrFramebuffer_Advance( ovrFramebuffer * frameBuffer )
|
|||
|
||||
void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
LOAD_GLES2(glEnable);
|
||||
LOAD_GLES2(glDisable);
|
||||
LOAD_GLES2(glViewport);
|
||||
LOAD_GLES2(glScissor);
|
||||
LOAD_GLES2(glClearColor);
|
||||
LOAD_GLES2(glClear);
|
||||
//LOAD_GLES2(glEnable);
|
||||
//LOAD_GLES2(glDisable);
|
||||
//LOAD_GLES2(glViewport);
|
||||
//LOAD_GLES2(glScissor);
|
||||
//LOAD_GLES2(glClearColor);
|
||||
//LOAD_GLES2(glClear);
|
||||
|
||||
GL( gles_glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
|
||||
// Explicitly clear the border texels to black because OpenGL-ES does not support GL_CLAMP_TO_BORDER.
|
||||
// Clear to fully opaque black.
|
||||
GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
GL( glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
|
||||
//Glide comfort mask in and out
|
||||
static float currentVLevel = 0.0f;
|
||||
|
@ -627,21 +678,21 @@ void ovrFramebuffer_ClearEdgeTexels( ovrFramebuffer * frameBuffer )
|
|||
float height = useMask ? (frameBuffer->Height / 2.0f) * currentVLevel : 1;
|
||||
|
||||
// bottom
|
||||
GL( gles_glScissor( 0, 0, frameBuffer->Width, width ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, 0, frameBuffer->Width, width ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// top
|
||||
GL( gles_glScissor( 0, frameBuffer->Height - height, frameBuffer->Width, height ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, frameBuffer->Height - height, frameBuffer->Width, height ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// left
|
||||
GL( gles_glScissor( 0, 0, width, frameBuffer->Height ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( 0, 0, width, frameBuffer->Height ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
// right
|
||||
GL( gles_glScissor( frameBuffer->Width - width, 0, width, frameBuffer->Height ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
GL( glScissor( frameBuffer->Width - width, 0, width, frameBuffer->Height ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT ) );
|
||||
|
||||
|
||||
GL( gles_glScissor( 0, 0, 0, 0 ) );
|
||||
GL( gles_glDisable( GL_SCISSOR_TEST ) );
|
||||
GL( glScissor( 0, 0, 0, 0 ) );
|
||||
GL( glDisable( GL_SCISSOR_TEST ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -660,7 +711,7 @@ void ovrRenderer_Clear( ovrRenderer * renderer )
|
|||
{
|
||||
ovrFramebuffer_Clear( &renderer->FrameBuffer[eye] );
|
||||
}
|
||||
renderer->ProjectionMatrix = ovrMatrix4f_CreateIdentity();
|
||||
|
||||
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
|
||||
}
|
||||
|
||||
|
@ -669,9 +720,6 @@ void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ov
|
|||
{
|
||||
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
|
||||
|
||||
//Now using a symmetrical render target, based on the horizontal FOV
|
||||
vrFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
|
||||
// Create the render Textures.
|
||||
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
|
||||
{
|
||||
|
@ -681,11 +729,6 @@ void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ov
|
|||
height,
|
||||
NUM_MULTI_SAMPLES );
|
||||
}
|
||||
|
||||
// Setup the projection matrix.
|
||||
renderer->ProjectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
vrFOV, vrFOV, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
}
|
||||
|
||||
void ovrRenderer_Destroy( ovrRenderer * renderer )
|
||||
|
@ -694,7 +737,6 @@ void ovrRenderer_Destroy( ovrRenderer * renderer )
|
|||
{
|
||||
ovrFramebuffer_Destroy( &renderer->FrameBuffer[eye] );
|
||||
}
|
||||
renderer->ProjectionMatrix = ovrMatrix4f_CreateIdentity();
|
||||
}
|
||||
|
||||
|
||||
|
@ -835,19 +877,6 @@ void setHMDPosition( float x, float y, float z, float yaw )
|
|||
if (!useScreenLayer())
|
||||
{
|
||||
playerYaw = yaw;
|
||||
|
||||
if (vr_enable_crouching->value > 0.0f && vr_enable_crouching->value < 0.98f) {
|
||||
//Do we trigger crouching based on player height?
|
||||
if (hmdPosition[1] < (playerHeight * vr_enable_crouching->value) &&
|
||||
ducked == DUCK_NOTDUCKED) {
|
||||
ducked = DUCK_CROUCHED;
|
||||
//sendButtonAction("+crouch", 1);
|
||||
} else if (hmdPosition[1] > (playerHeight * (vr_enable_crouching->value + 0.02f)) &&
|
||||
ducked == DUCK_CROUCHED) {
|
||||
ducked = DUCK_NOTDUCKED;
|
||||
//sendButtonAction("+crouch", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -879,6 +908,14 @@ void Android_Vibrate( float duration, int channel, float intensity )
|
|||
vibration_channel_intensity[channel] = intensity;
|
||||
}
|
||||
|
||||
void getVROrigins(vec3_t _weaponoffset, vec3_t _weaponangles, vec3_t _hmdPosition)
|
||||
{
|
||||
VectorCopy(weaponoffset, _weaponoffset);
|
||||
VectorCopy(weaponangles, _weaponangles);
|
||||
VectorCopy(hmdPosition, _hmdPosition);
|
||||
}
|
||||
|
||||
|
||||
void Qcommon_BeginFrame (int time);
|
||||
void Qcommon_Frame (int eye);
|
||||
void Qcommon_EndFrame (int time);
|
||||
|
@ -917,7 +954,7 @@ void RenderFrame( ovrRenderer * renderer, const ovrJava * java,
|
|||
time = global_time - oldtime;
|
||||
} while (time < 1);
|
||||
|
||||
Qcommon_BeginFrame (time);
|
||||
Qcommon_BeginFrame (time * 1000);
|
||||
|
||||
// Render the eye images.
|
||||
for (int eye = 0; eye < renderer->NumBuffers && isHostAlive(); eye++) {
|
||||
|
@ -948,7 +985,7 @@ void RenderFrame( ovrRenderer * renderer, const ovrJava * java,
|
|||
ovrFramebuffer_Advance(frameBuffer);
|
||||
}
|
||||
|
||||
Qcommon_EndFrame(time);
|
||||
Qcommon_EndFrame(time * 1000);
|
||||
|
||||
oldtime = global_time;
|
||||
}
|
||||
|
@ -999,8 +1036,6 @@ static void ovrApp_Clear( ovrApp * app )
|
|||
app->Java.Vm = NULL;
|
||||
app->Java.Env = NULL;
|
||||
app->Java.ActivityObject = NULL;
|
||||
app->NativeWindow = NULL;
|
||||
app->Resumed = false;
|
||||
app->Ovr = NULL;
|
||||
app->FrameIndex = 1;
|
||||
app->DisplayTime = 0;
|
||||
|
@ -1084,6 +1119,10 @@ static void ovrApp_HandleVrModeChanges( ovrApp * app )
|
|||
vrapi_SetPerfThread( app->Ovr, VRAPI_PERF_THREAD_TYPE_RENDERER, app->RenderThreadTid );
|
||||
|
||||
ALOGV( " vrapi_SetPerfThread( RENDERER, %d )", app->RenderThreadTid );
|
||||
|
||||
vrapi_SetExtraLatencyMode(app->Ovr, VRAPI_EXTRA_LATENCY_MODE_ON);
|
||||
|
||||
ALOGV( " vrapi_SetExtraLatencyMode( %d )", VRAPI_EXTRA_LATENCY_MODE_ON );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1306,6 +1345,7 @@ typedef struct
|
|||
{
|
||||
JavaVM * JavaVm;
|
||||
jobject ActivityObject;
|
||||
jclass ActivityClass;
|
||||
pthread_t Thread;
|
||||
ovrMessageQueue MessageQueue;
|
||||
ANativeWindow * NativeWindow;
|
||||
|
@ -1315,10 +1355,11 @@ long shutdownCountdown;
|
|||
|
||||
int m_width;
|
||||
int m_height;
|
||||
static ovrJava java;
|
||||
|
||||
void R_SetMode( void );
|
||||
qboolean R_SetMode( void );
|
||||
|
||||
void Android_GetScreenRes(int *width, int *height)
|
||||
void Quest_GetScreenRes(int *width, int *height)
|
||||
{
|
||||
if (useScreenLayer())
|
||||
{
|
||||
|
@ -1330,7 +1371,17 @@ void Android_GetScreenRes(int *width, int *height)
|
|||
}
|
||||
}
|
||||
|
||||
void Android_MessageBox(const char *title, const char *text)
|
||||
int Quest_GetRefresh()
|
||||
{
|
||||
return vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE );
|
||||
}
|
||||
|
||||
float getFOV()
|
||||
{
|
||||
return vrapi_GetSystemPropertyFloat( &java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_Y );
|
||||
}
|
||||
|
||||
void Quest_MessageBox(const char *title, const char *text)
|
||||
{
|
||||
ALOGE("%s %s", title, text);
|
||||
}
|
||||
|
@ -1355,18 +1406,33 @@ void VR_Init()
|
|||
|
||||
//Create Cvars
|
||||
vr_snapturn_angle = Cvar_Get( "vr_snapturn_angle", "45", CVAR_ARCHIVE);
|
||||
vr_reloadtimeoutms = Cvar_Get( "vr_reloadtimeoutms", "200", CVAR_ARCHIVE);
|
||||
vr_positional_factor = Cvar_Get( "vr_positional_factor", "2000", CVAR_ARCHIVE);
|
||||
vr_walkdirection = Cvar_Get( "vr_walkdirection", "0", CVAR_ARCHIVE);
|
||||
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
||||
vr_weapon_recoil = Cvar_Get( "vr_weapon_recoil", "0", CVAR_ARCHIVE);
|
||||
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
|
||||
vr_enable_crouching = Cvar_Get( "vr_enable_crouching", "0.85", CVAR_ARCHIVE);
|
||||
vr_height_adjust = Cvar_Get( "vr_height_adjust", "0.0", CVAR_ARCHIVE);
|
||||
vr_weaponscale = Cvar_Get( "vr_weaponscale", "0.56", CVAR_ARCHIVE);
|
||||
vr_weapon_stabilised = Cvar_Get( "vr_weapon_stabilised", "0.0", CVAR_LATCH);
|
||||
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_LATCH);
|
||||
vr_comfort_mask = Cvar_Get( "vr_comfort_mask", "0.0", CVAR_ARCHIVE);
|
||||
vr_turn_deadzone = Cvar_Get( "vr_turn_deadzone", "0.2", CVAR_ARCHIVE);
|
||||
vr_framerate = Cvar_Get( "vr_framerate", "0", CVAR_ARCHIVE);
|
||||
vr_use_wheels = Cvar_Get( "vr_use_wheels", "0", CVAR_ARCHIVE);
|
||||
|
||||
//Acquire supported refresh rates to populate options in video menu where framerate is selected
|
||||
|
||||
int refresh_num = vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_NUM_SUPPORTED_DISPLAY_REFRESH_RATES );
|
||||
float refresh_arr[refresh_num];
|
||||
int total = vrapi_GetSystemPropertyFloatArray( &java, VRAPI_SYS_PROP_SUPPORTED_DISPLAY_REFRESH_RATES, refresh_arr, refresh_num );
|
||||
|
||||
refresh_names = malloc((total+1) * sizeof (char*));
|
||||
refresh_values = malloc((total) * sizeof (float));
|
||||
for (int i = 0; i < total; i++) {
|
||||
refresh_names[i] = malloc(5 * sizeof (char*));
|
||||
sprintf(refresh_names[i],"%.0fHz", refresh_arr[i]);
|
||||
refresh_values[i] = refresh_arr[i];
|
||||
}
|
||||
refresh_names[total] = malloc(5 * sizeof (int));
|
||||
refresh_names[total] = 0;
|
||||
|
||||
//The Engine (which is a derivative of Quake) uses a very specific unit size:
|
||||
//Wolfenstein 3D, DOOM and QUAKE use the same coordinate/unit system:
|
||||
|
@ -1376,17 +1442,20 @@ void VR_Init()
|
|||
vr_worldscale = Cvar_Get( "vr_worldscale", "26.2467", CVAR_ARCHIVE);
|
||||
}
|
||||
|
||||
void M_Menu_Main_f (void);
|
||||
/* Called before SDL_main() to initialize JNI bindings in SDL library */
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
void FS_AddDirToSearchPath(char *dir, qboolean create);
|
||||
|
||||
void * AppThreadFunction( void * parm )
|
||||
{
|
||||
ovrAppThread * appThread = (ovrAppThread *)parm;
|
||||
|
||||
ovrJava java;
|
||||
java.Vm = appThread->JavaVm;
|
||||
(*java.Vm)->AttachCurrentThread( java.Vm, &java.Env, NULL );
|
||||
java.ActivityObject = appThread->ActivityObject;
|
||||
|
||||
jclass cls = (*java.Env)->GetObjectClass(java.Env, java.ActivityObject);
|
||||
|
||||
// Note that AttachCurrentThread will reset the thread name.
|
||||
prctl( PR_SET_NAME, (long)"OVR::Main", 0, 0, 0 );
|
||||
|
||||
|
@ -1422,10 +1491,11 @@ void * AppThreadFunction( void * parm )
|
|||
|
||||
ovrRenderer_Create( m_width, m_height, &appState.Renderer, &java );
|
||||
|
||||
//Always use this folder
|
||||
chdir("/sdcard/Quake2Quest");
|
||||
chdir("/sdcard");
|
||||
|
||||
for ( bool destroyed = false; destroyed == false; )
|
||||
hmdType = vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE);
|
||||
|
||||
for ( bool destroyed = false; destroyed == false; )
|
||||
{
|
||||
for ( ; ; )
|
||||
{
|
||||
|
@ -1460,7 +1530,8 @@ void * AppThreadFunction( void * parm )
|
|||
Qcommon_Init(argc, (const char**)argv);
|
||||
}
|
||||
|
||||
//M_Menu_Main_f ();
|
||||
FS_AddDirToSearchPath("/sdcard/Quake2Quest", true);
|
||||
|
||||
quake2_initialised = true;
|
||||
}
|
||||
break;
|
||||
|
@ -1603,6 +1674,23 @@ void * AppThreadFunction( void * parm )
|
|||
|
||||
ALOGV(" HMD-Position: %f, %f, %f", positionHmd.x, positionHmd.y, positionHmd.z);
|
||||
|
||||
|
||||
|
||||
|
||||
static bool s_paused = false;
|
||||
if (s_paused != (cl_paused->value == 1))
|
||||
{
|
||||
s_paused = (cl_paused->value == 1);
|
||||
|
||||
//If we switch from paused to unpaused, go full screen
|
||||
if (cl_paused->value != 1)
|
||||
{
|
||||
showingScreenLayer = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get info for tracked remotes
|
||||
acquireTrackedRemotesData(appState.Ovr, appState.DisplayTime);
|
||||
|
||||
|
@ -1615,12 +1703,16 @@ void * AppThreadFunction( void * parm )
|
|||
ovrButton_A, ovrButton_B, ovrButton_X, ovrButton_Y);
|
||||
break;
|
||||
case LEFT_HANDED_DEFAULT:
|
||||
case LEFT_HANDED_SWITCH_STICKS:
|
||||
HandleInput_Default(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, &leftRemoteTracking_new,
|
||||
&rightTrackedRemoteState_new, &rightTrackedRemoteState_old, &rightRemoteTracking_new,
|
||||
ovrButton_X, ovrButton_Y, ovrButton_A, ovrButton_B);
|
||||
break;
|
||||
}
|
||||
|
||||
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
|
||||
leftTrackedRemoteState_old = leftTrackedRemoteState_new;
|
||||
|
||||
static bool usingScreenLayer = true; //Starts off using the screen layer
|
||||
if (usingScreenLayer != useScreenLayer())
|
||||
{
|
||||
|
@ -1629,6 +1721,10 @@ void * AppThreadFunction( void * parm )
|
|||
}
|
||||
|
||||
ovrSubmitFrameDescription2 frameDesc = { 0 };
|
||||
if(vr_framerate->modified){
|
||||
vrapi_SetDisplayRefreshRate(appState.Ovr, refresh_values[(int)vr_framerate->value]);
|
||||
vr_framerate->modified = false;
|
||||
}
|
||||
if (!useScreenLayer()) {
|
||||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
|
@ -1640,7 +1736,8 @@ void * AppThreadFunction( void * parm )
|
|||
layer.Textures[eye].SwapChainIndex = frameBuffer->TextureSwapChainIndex;
|
||||
|
||||
ovrMatrix4f projectionMatrix;
|
||||
projectionMatrix = ovrMatrix4f_CreateProjectionFov(vrFOV, vrFOV,
|
||||
float fov = getFOV();
|
||||
projectionMatrix = ovrMatrix4f_CreateProjectionFov(fov, fov,
|
||||
0.0f, 0.0f, 0.1f, 0.0f);
|
||||
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&projectionMatrix);
|
||||
|
@ -1745,10 +1842,11 @@ void * AppThreadFunction( void * parm )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject )
|
||||
static void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject, jclass activityClass )
|
||||
{
|
||||
(*env)->GetJavaVM( env, &appThread->JavaVm );
|
||||
appThread->ActivityObject = (*env)->NewGlobalRef( env, activityObject );
|
||||
appThread->ActivityClass = (*env)->NewGlobalRef( env, activityClass );
|
||||
appThread->Thread = 0;
|
||||
appThread->NativeWindow = NULL;
|
||||
ovrMessageQueue_Create( &appThread->MessageQueue );
|
||||
|
@ -1764,6 +1862,7 @@ static void ovrAppThread_Destroy( ovrAppThread * appThread, JNIEnv * env )
|
|||
{
|
||||
pthread_join( appThread->Thread, NULL );
|
||||
(*env)->DeleteGlobalRef( env, appThread->ActivityObject );
|
||||
(*env)->DeleteGlobalRef( env, appThread->ActivityClass );
|
||||
ovrMessageQueue_Destroy( &appThread->MessageQueue );
|
||||
}
|
||||
|
||||
|
@ -1775,6 +1874,8 @@ Activity lifecycle
|
|||
================================================================================
|
||||
*/
|
||||
|
||||
JNIEXPORT jint JNICALL SDL_JNI_OnLoad(JavaVM* vm, void* reserved);
|
||||
|
||||
int JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
{
|
||||
JNIEnv *env;
|
||||
|
@ -1823,6 +1924,11 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onCreate( JNIEnv
|
|||
if (ss->count > 0 && ss->dval[0] > 0.0)
|
||||
{
|
||||
SS_MULTIPLIER = ss->dval[0];
|
||||
|
||||
if (SS_MULTIPLIER > 1.2F)
|
||||
{
|
||||
SS_MULTIPLIER = 1.2F;
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu->count > 0 && cpu->ival[0] > 0 && cpu->ival[0] < 10)
|
||||
|
@ -1839,7 +1945,7 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onCreate( JNIEnv
|
|||
initialize_gl4es();
|
||||
|
||||
ovrAppThread * appThread = (ovrAppThread *) malloc( sizeof( ovrAppThread ) );
|
||||
ovrAppThread_Create( appThread, env, activity );
|
||||
ovrAppThread_Create( appThread, env, activity, activityClass );
|
||||
|
||||
ovrMessageQueue_Enable( &appThread->MessageQueue, true );
|
||||
ovrMessage message;
|
||||
|
@ -1985,20 +2091,3 @@ JNIEXPORT void JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_onSurfaceDestroye
|
|||
appThread->NativeWindow = NULL;
|
||||
}
|
||||
|
||||
/*************************
|
||||
* Audio stuff
|
||||
*************************/
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_drbeef_quake2quest_GLES3JNILib_Quake2PaintAudio( JNIEnv* env, jobject thiz, jobject buf )
|
||||
{
|
||||
extern int paint_audio (void *unused, void * stream, int len);
|
||||
|
||||
void *stream;
|
||||
int len;
|
||||
|
||||
stream = (*env)->GetDirectBufferAddress( env, buf);
|
||||
len = (*env)->GetDirectBufferCapacity( env, buf);
|
||||
|
||||
return paint_audio ( NULL, stream, len );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#if !defined(vrcommon_h)
|
||||
#define vrcommon_h
|
||||
|
||||
#include <VrApi_Ext.h>
|
||||
//#include <VrApi_Ext.h>
|
||||
#include <VrApi_Input.h>
|
||||
|
||||
#include <android/log.h>
|
||||
|
@ -22,37 +22,33 @@
|
|||
#define ALOGV(...)
|
||||
#endif
|
||||
|
||||
bool quake2_initialised;
|
||||
extern bool quake2_initialised;
|
||||
|
||||
int global_time;
|
||||
extern long long global_time;
|
||||
|
||||
float playerHeight;
|
||||
float playerYaw;
|
||||
extern float playerHeight;
|
||||
extern float playerYaw;
|
||||
|
||||
bool showingScreenLayer;
|
||||
float vrFOV;
|
||||
extern bool showingScreenLayer;
|
||||
|
||||
vec3_t worldPosition;
|
||||
extern vec3_t worldPosition;
|
||||
|
||||
vec3_t hmdPosition;
|
||||
vec3_t hmdorientation;
|
||||
vec3_t positionDeltaThisFrame;
|
||||
extern vec3_t hmdPosition;
|
||||
extern vec3_t hmdorientation;
|
||||
extern vec3_t positionDeltaThisFrame;
|
||||
|
||||
#define ADJUSTED 0
|
||||
#define UNADJUSTED 1
|
||||
#define MELEE 2
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponoffset;
|
||||
extern vec3_t weaponangles;
|
||||
extern vec3_t weaponoffset;
|
||||
|
||||
vec3_t flashlightangles;
|
||||
vec3_t flashlightoffset;
|
||||
extern vec3_t flashlightangles;
|
||||
extern vec3_t flashlightoffset;
|
||||
|
||||
#define DUCK_NOTDUCKED 0
|
||||
#define DUCK_BUTTON 1
|
||||
#define DUCK_CROUCHED 2
|
||||
int ducked;
|
||||
extern int ducked;
|
||||
|
||||
bool player_moving;
|
||||
extern bool player_moving;
|
||||
|
||||
|
||||
float radians(float deg);
|
||||
|
@ -65,6 +61,6 @@ bool between(float min, float val, float max);
|
|||
void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
|
||||
void QuatToYawPitchRoll(ovrQuatf q, float pitchAdjust, vec3_t out);
|
||||
bool useScreenLayer();
|
||||
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
|
||||
void handleTrackedControllerButton(u_int32_t buttonsNew, u_int32_t buttonsOld, uint32_t button, int key);
|
||||
|
||||
#endif //vrcommon_h
|
|
@ -24,7 +24,6 @@ Filename : VrCompositor.c
|
|||
#include <VrApi.h>
|
||||
#include <VrApi_Helpers.h>
|
||||
|
||||
#include "../gl4es/src/gl/loader.h"
|
||||
#include "VrCompositor.h"
|
||||
|
||||
|
||||
|
@ -40,28 +39,23 @@ renderState
|
|||
|
||||
void getCurrentRenderState( renderState * state)
|
||||
{
|
||||
LOAD_GLES2(glGetIntegerv);
|
||||
|
||||
state->VertexBuffer = 0;
|
||||
state->IndexBuffer = 0;
|
||||
state->VertexArrayObject = 0;
|
||||
state->Program = 0;
|
||||
|
||||
gles_glGetIntegerv(GL_ARRAY_BUFFER, &state->VertexBuffer );
|
||||
gles_glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER, &state->IndexBuffer );
|
||||
gles_glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &state->VertexArrayObject );
|
||||
gles_glGetIntegerv(GL_CURRENT_PROGRAM, &state->Program );
|
||||
glGetIntegerv(GL_ARRAY_BUFFER, &state->VertexBuffer );
|
||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER, &state->IndexBuffer );
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &state->VertexArrayObject );
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &state->Program );
|
||||
}
|
||||
|
||||
void restoreRenderState( renderState * state )
|
||||
{
|
||||
LOAD_GLES2(glBindBuffer);
|
||||
LOAD_GLES2(glUseProgram);
|
||||
|
||||
GL( gles_glUseProgram( state->Program ) );
|
||||
GL( glUseProgram( state->Program ) );
|
||||
GL( glBindVertexArray( state->VertexArrayObject ) );
|
||||
GL( gles_glBindBuffer( GL_ARRAY_BUFFER, state->VertexBuffer ) );
|
||||
GL( gles_glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, state->IndexBuffer ) );
|
||||
GL( glBindBuffer( GL_ARRAY_BUFFER, state->VertexBuffer ) );
|
||||
GL( glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, state->IndexBuffer ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,10 +103,6 @@ static void ovrGeometry_Clear( ovrGeometry * geometry )
|
|||
|
||||
static void ovrGeometry_CreateGroundPlane( ovrGeometry * geometry )
|
||||
{
|
||||
LOAD_GLES2(glGenBuffers);
|
||||
LOAD_GLES2(glBindBuffer);
|
||||
LOAD_GLES2(glBufferData);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float positions[4][4];
|
||||
|
@ -163,38 +153,34 @@ static void ovrGeometry_CreateGroundPlane( ovrGeometry * geometry )
|
|||
renderState state;
|
||||
getCurrentRenderState(&state);
|
||||
|
||||
GL( gles_glGenBuffers( 1, &geometry->VertexBuffer ) );
|
||||
GL( gles_glBindBuffer( GL_ARRAY_BUFFER, geometry->VertexBuffer ) );
|
||||
GL( gles_glBufferData( GL_ARRAY_BUFFER, sizeof( cubeVertices ), &cubeVertices, GL_STATIC_DRAW ) );
|
||||
GL( glGenBuffers( 1, &geometry->VertexBuffer ) );
|
||||
GL( glBindBuffer( GL_ARRAY_BUFFER, geometry->VertexBuffer ) );
|
||||
GL( glBufferData( GL_ARRAY_BUFFER, sizeof( cubeVertices ), &cubeVertices, GL_STATIC_DRAW ) );
|
||||
|
||||
GL( gles_glGenBuffers( 1, &geometry->IndexBuffer ) );
|
||||
GL( gles_glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, geometry->IndexBuffer ) );
|
||||
GL( gles_glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof( cubeIndices ), cubeIndices, GL_STATIC_DRAW ) );
|
||||
GL( glGenBuffers( 1, &geometry->IndexBuffer ) );
|
||||
GL( glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, geometry->IndexBuffer ) );
|
||||
GL( glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof( cubeIndices ), cubeIndices, GL_STATIC_DRAW ) );
|
||||
|
||||
restoreRenderState(&state);
|
||||
}
|
||||
|
||||
static void ovrGeometry_Destroy( ovrGeometry * geometry )
|
||||
{
|
||||
LOAD_GLES2(glDeleteBuffers);
|
||||
|
||||
GL( gles_glDeleteBuffers( 1, &geometry->IndexBuffer ) );
|
||||
GL( gles_glDeleteBuffers( 1, &geometry->VertexBuffer ) );
|
||||
GL( glDeleteBuffers( 1, &geometry->IndexBuffer ) );
|
||||
GL( glDeleteBuffers( 1, &geometry->VertexBuffer ) );
|
||||
|
||||
ovrGeometry_Clear( geometry );
|
||||
}
|
||||
|
||||
static void ovrGeometry_CreateVAO( ovrGeometry * geometry )
|
||||
{
|
||||
LOAD_GLES2(glBindBuffer);
|
||||
|
||||
renderState state;
|
||||
getCurrentRenderState(&state);
|
||||
|
||||
GL( glGenVertexArrays( 1, &geometry->VertexArrayObject ) );
|
||||
GL( glBindVertexArray( geometry->VertexArrayObject ) );
|
||||
|
||||
GL( gles_glBindBuffer( GL_ARRAY_BUFFER, geometry->VertexBuffer ) );
|
||||
GL( glBindBuffer( GL_ARRAY_BUFFER, geometry->VertexBuffer ) );
|
||||
|
||||
for ( int i = 0; i < MAX_VERTEX_ATTRIB_POINTERS; i++ )
|
||||
{
|
||||
|
@ -207,7 +193,7 @@ static void ovrGeometry_CreateVAO( ovrGeometry * geometry )
|
|||
}
|
||||
}
|
||||
|
||||
GL( gles_glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, geometry->IndexBuffer ) );
|
||||
GL( glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, geometry->IndexBuffer ) );
|
||||
|
||||
restoreRenderState(&state);
|
||||
}
|
||||
|
@ -259,65 +245,49 @@ static void ovrProgram_Clear( ovrProgram * program )
|
|||
|
||||
static bool ovrProgram_Create( ovrProgram * program, const char * vertexSource, const char * fragmentSource )
|
||||
{
|
||||
LOAD_GLES2(glGetIntegerv);
|
||||
LOAD_GLES2(glCreateShader);
|
||||
LOAD_GLES2(glShaderSource);
|
||||
LOAD_GLES2(glCompileShader);
|
||||
LOAD_GLES2(glGetShaderiv);
|
||||
LOAD_GLES2(glGetShaderInfoLog);
|
||||
LOAD_GLES2(glAttachShader);
|
||||
LOAD_GLES2(glBindAttribLocation);
|
||||
LOAD_GLES2(glLinkProgram);
|
||||
LOAD_GLES2(glGetProgramiv);
|
||||
LOAD_GLES2(glGetUniformLocation);
|
||||
LOAD_GLES2(glCreateProgram);
|
||||
LOAD_GLES2(glUseProgram);
|
||||
LOAD_GLES2(glUniform1i);
|
||||
LOAD_GLES2(glGetProgramInfoLog);
|
||||
|
||||
GLint r;
|
||||
|
||||
GL( program->VertexShader = gles_glCreateShader( GL_VERTEX_SHADER ) );
|
||||
GL( program->VertexShader = glCreateShader( GL_VERTEX_SHADER ) );
|
||||
|
||||
GL( gles_glShaderSource( program->VertexShader, 1, &vertexSource, 0 ) );
|
||||
GL( gles_glCompileShader( program->VertexShader ) );
|
||||
GL( gles_glGetShaderiv( program->VertexShader, GL_COMPILE_STATUS, &r ) );
|
||||
GL( glShaderSource( program->VertexShader, 1, &vertexSource, 0 ) );
|
||||
GL( glCompileShader( program->VertexShader ) );
|
||||
GL( glGetShaderiv( program->VertexShader, GL_COMPILE_STATUS, &r ) );
|
||||
if ( r == GL_FALSE )
|
||||
{
|
||||
GLchar msg[4096];
|
||||
GL( gles_glGetShaderInfoLog( program->VertexShader, sizeof( msg ), 0, msg ) );
|
||||
GL( glGetShaderInfoLog( program->VertexShader, sizeof( msg ), 0, msg ) );
|
||||
ALOGE( "%s\n%s\n", vertexSource, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
GL( program->FragmentShader = gles_glCreateShader( GL_FRAGMENT_SHADER ) );
|
||||
GL( gles_glShaderSource( program->FragmentShader, 1, &fragmentSource, 0 ) );
|
||||
GL( gles_glCompileShader( program->FragmentShader ) );
|
||||
GL( gles_glGetShaderiv( program->FragmentShader, GL_COMPILE_STATUS, &r ) );
|
||||
GL( program->FragmentShader = glCreateShader( GL_FRAGMENT_SHADER ) );
|
||||
GL( glShaderSource( program->FragmentShader, 1, &fragmentSource, 0 ) );
|
||||
GL( glCompileShader( program->FragmentShader ) );
|
||||
GL( glGetShaderiv( program->FragmentShader, GL_COMPILE_STATUS, &r ) );
|
||||
if ( r == GL_FALSE )
|
||||
{
|
||||
GLchar msg[4096];
|
||||
GL( gles_glGetShaderInfoLog( program->FragmentShader, sizeof( msg ), 0, msg ) );
|
||||
GL( glGetShaderInfoLog( program->FragmentShader, sizeof( msg ), 0, msg ) );
|
||||
ALOGE( "%s\n%s\n", fragmentSource, msg );
|
||||
return false;
|
||||
}
|
||||
|
||||
GL( program->Program = gles_glCreateProgram() );
|
||||
GL( gles_glAttachShader( program->Program, program->VertexShader ) );
|
||||
GL( gles_glAttachShader( program->Program, program->FragmentShader ) );
|
||||
GL( program->Program = glCreateProgram() );
|
||||
GL( glAttachShader( program->Program, program->VertexShader ) );
|
||||
GL( glAttachShader( program->Program, program->FragmentShader ) );
|
||||
|
||||
// Bind the vertex attribute locations.
|
||||
for ( int i = 0; i < sizeof( ProgramVertexAttributes ) / sizeof( ProgramVertexAttributes[0] ); i++ )
|
||||
{
|
||||
GL( gles_glBindAttribLocation( program->Program, ProgramVertexAttributes[i].location, ProgramVertexAttributes[i].name ) );
|
||||
GL( glBindAttribLocation( program->Program, ProgramVertexAttributes[i].location, ProgramVertexAttributes[i].name ) );
|
||||
}
|
||||
|
||||
GL( gles_glLinkProgram( program->Program ) );
|
||||
GL( gles_glGetProgramiv( program->Program, GL_LINK_STATUS, &r ) );
|
||||
GL( glLinkProgram( program->Program ) );
|
||||
GL( glGetProgramiv( program->Program, GL_LINK_STATUS, &r ) );
|
||||
if ( r == GL_FALSE )
|
||||
{
|
||||
GLchar msg[4096];
|
||||
GL( gles_glGetProgramInfoLog( program->Program, sizeof( msg ), 0, msg ) );
|
||||
GL( glGetProgramInfoLog( program->Program, sizeof( msg ), 0, msg ) );
|
||||
ALOGE( "Linking program failed: %s\n", msg );
|
||||
return false;
|
||||
}
|
||||
|
@ -337,7 +307,7 @@ static bool ovrProgram_Create( ovrProgram * program, const char * vertexSource,
|
|||
}
|
||||
else
|
||||
{
|
||||
GL( program->UniformLocation[uniformIndex] = gles_glGetUniformLocation( program->Program, ProgramUniforms[i].name ) );
|
||||
GL( program->UniformLocation[uniformIndex] = glGetUniformLocation( program->Program, ProgramUniforms[i].name ) );
|
||||
program->UniformBinding[uniformIndex] = program->UniformLocation[uniformIndex];
|
||||
}
|
||||
}
|
||||
|
@ -345,17 +315,17 @@ static bool ovrProgram_Create( ovrProgram * program, const char * vertexSource,
|
|||
renderState state;
|
||||
getCurrentRenderState(&state);
|
||||
|
||||
GL( gles_glUseProgram( program->Program ) );
|
||||
GL( glUseProgram( program->Program ) );
|
||||
|
||||
// Get the texture locations.
|
||||
for ( int i = 0; i < MAX_PROGRAM_TEXTURES; i++ )
|
||||
{
|
||||
char name[32];
|
||||
sprintf( name, "Texture%i", i );
|
||||
program->Textures[i] = gles_glGetUniformLocation( program->Program, name );
|
||||
program->Textures[i] = glGetUniformLocation( program->Program, name );
|
||||
if ( program->Textures[i] != -1 )
|
||||
{
|
||||
GL( gles_glUniform1i( program->Textures[i], i ) );
|
||||
GL( glUniform1i( program->Textures[i], i ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,22 +336,19 @@ static bool ovrProgram_Create( ovrProgram * program, const char * vertexSource,
|
|||
|
||||
static void ovrProgram_Destroy( ovrProgram * program )
|
||||
{
|
||||
LOAD_GLES2(glDeleteProgram);
|
||||
LOAD_GLES2(glDeleteShader);
|
||||
|
||||
if ( program->Program != 0 )
|
||||
{
|
||||
GL( gles_glDeleteProgram( program->Program ) );
|
||||
GL( glDeleteProgram( program->Program ) );
|
||||
program->Program = 0;
|
||||
}
|
||||
if ( program->VertexShader != 0 )
|
||||
{
|
||||
GL( gles_glDeleteShader( program->VertexShader ) );
|
||||
GL( glDeleteShader( program->VertexShader ) );
|
||||
program->VertexShader = 0;
|
||||
}
|
||||
if ( program->FragmentShader != 0 )
|
||||
{
|
||||
GL( gles_glDeleteShader( program->FragmentShader ) );
|
||||
GL( glDeleteShader( program->FragmentShader ) );
|
||||
program->FragmentShader = 0;
|
||||
}
|
||||
}
|
||||
|
@ -492,21 +459,6 @@ ovrRenderer
|
|||
ovrLayerProjection2 ovrRenderer_RenderGroundPlaneToEyeBuffer( ovrRenderer * renderer, const ovrJava * java,
|
||||
const ovrScene * scene, const ovrTracking2 * tracking )
|
||||
{
|
||||
LOAD_GLES2(glEnable);
|
||||
LOAD_GLES2(glDepthMask);
|
||||
LOAD_GLES2(glDepthFunc);
|
||||
LOAD_GLES2(glViewport);
|
||||
LOAD_GLES2(glScissor);
|
||||
LOAD_GLES2(glClearColor);
|
||||
LOAD_GLES2(glClear);
|
||||
LOAD_GLES2(glDisable);
|
||||
LOAD_GLES2(glGetIntegerv);
|
||||
LOAD_GLES2(glBindBuffer);
|
||||
LOAD_GLES2(glCullFace);
|
||||
LOAD_GLES2(glDrawElements);
|
||||
LOAD_GLES2(glUseProgram);
|
||||
LOAD_GLES(glUniformMatrix4fv);
|
||||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
layer.HeadPose = tracking->HeadPose;
|
||||
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
|
||||
|
@ -526,28 +478,28 @@ ovrLayerProjection2 ovrRenderer_RenderGroundPlaneToEyeBuffer( ovrRenderer * rend
|
|||
renderState state;
|
||||
getCurrentRenderState(&state);
|
||||
|
||||
GL( gles_glUseProgram( scene->Program.Program ) );
|
||||
GL( glUseProgram( scene->Program.Program ) );
|
||||
|
||||
ovrMatrix4f viewProjMatrix = ovrMatrix4f_Multiply( &tracking->Eye[eye].ProjectionMatrix, &tracking->Eye[eye].ViewMatrix );
|
||||
glUniformMatrix4fv( scene->Program.UniformLocation[UNIFORM_VIEW_PROJ_MATRIX], 1, GL_TRUE, &viewProjMatrix.M[0][0] );
|
||||
|
||||
GL( gles_glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( gles_glDepthMask( GL_TRUE ) );
|
||||
GL( gles_glEnable( GL_DEPTH_TEST ) );
|
||||
GL( gles_glDepthFunc( GL_LEQUAL ) );
|
||||
GL( gles_glEnable( GL_CULL_FACE ) );
|
||||
GL( gles_glCullFace( GL_BACK ) );
|
||||
GL( gles_glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( gles_glScissor( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( gles_glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
GL( gles_glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) );
|
||||
GL( glEnable( GL_SCISSOR_TEST ) );
|
||||
GL( glDepthMask( GL_TRUE ) );
|
||||
GL( glEnable( GL_DEPTH_TEST ) );
|
||||
GL( glDepthFunc( GL_LEQUAL ) );
|
||||
GL( glEnable( GL_CULL_FACE ) );
|
||||
GL( glCullFace( GL_BACK ) );
|
||||
GL( glViewport( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( glScissor( 0, 0, frameBuffer->Width, frameBuffer->Height ) );
|
||||
GL( glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) );
|
||||
GL( glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) );
|
||||
|
||||
//bind buffers
|
||||
GL( gles_glBindBuffer( GL_ARRAY_BUFFER, scene->GroundPlane.VertexBuffer ) );
|
||||
GL( gles_glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, scene->GroundPlane.IndexBuffer ) );
|
||||
GL( glBindBuffer( GL_ARRAY_BUFFER, scene->GroundPlane.VertexBuffer ) );
|
||||
GL( glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, scene->GroundPlane.IndexBuffer ) );
|
||||
GL( glBindVertexArray( scene->GroundPlane.VertexArrayObject ) );
|
||||
|
||||
GL( gles_glDrawElements( GL_TRIANGLES, scene->GroundPlane.IndexCount, GL_UNSIGNED_SHORT, NULL ) );
|
||||
GL( glDrawElements( GL_TRIANGLES, scene->GroundPlane.IndexCount, GL_UNSIGNED_SHORT, NULL ) );
|
||||
|
||||
restoreRenderState(&state);
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ ovrRenderer
|
|||
typedef struct
|
||||
{
|
||||
ovrFramebuffer FrameBuffer[VRAPI_FRAME_LAYER_EYE_MAX];
|
||||
ovrMatrix4f ProjectionMatrix;
|
||||
int NumBuffers;
|
||||
} ovrRenderer;
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
cvar_t *vr_snapturn_angle;
|
||||
cvar_t *vr_reloadtimeoutms;
|
||||
cvar_t *vr_positional_factor;
|
||||
cvar_t *vr_walkdirection;
|
||||
cvar_t *vr_weapon_pitchadjust;
|
||||
cvar_t *vr_weapon_recoil;
|
||||
cvar_t *vr_lasersight;
|
||||
cvar_t *vr_control_scheme;
|
||||
cvar_t *vr_enable_crouching;
|
||||
cvar_t *vr_height_adjust;
|
||||
cvar_t *vr_worldscale;
|
||||
cvar_t *vr_weaponscale;
|
||||
cvar_t *vr_weapon_stabilised;
|
||||
cvar_t *vr_comfort_mask;
|
||||
extern cvar_t *vr_snapturn_angle;
|
||||
extern cvar_t *vr_turn_deadzone;
|
||||
extern cvar_t *vr_walkdirection;
|
||||
extern cvar_t *vr_weapon_pitchadjust;
|
||||
extern cvar_t *vr_lasersight;
|
||||
extern cvar_t *vr_control_scheme;
|
||||
extern cvar_t *vr_height_adjust;
|
||||
extern cvar_t *vr_worldscale;
|
||||
extern cvar_t *vr_weaponscale;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
extern cvar_t *vr_comfort_mask;
|
||||
extern cvar_t *vr_framerate;
|
||||
extern cvar_t *vr_use_wheels;
|
||||
extern char **refresh_names;
|
||||
extern float *refresh_values;
|
||||
|
|
|
@ -5,24 +5,26 @@
|
|||
#include "VrCommon.h"
|
||||
|
||||
//New control scheme definitions to be defined L1VR_SurfaceView.c enumeration
|
||||
enum control_scheme;
|
||||
extern enum control_scheme;
|
||||
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_new;
|
||||
ovrTracking leftRemoteTracking_new;
|
||||
extern ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
extern ovrInputStateTrackedRemote leftTrackedRemoteState_new;
|
||||
extern ovrTracking leftRemoteTracking_new;
|
||||
|
||||
ovrInputStateTrackedRemote rightTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote rightTrackedRemoteState_new;
|
||||
ovrTracking rightRemoteTracking_new;
|
||||
extern ovrInputStateTrackedRemote rightTrackedRemoteState_old;
|
||||
extern ovrInputStateTrackedRemote rightTrackedRemoteState_new;
|
||||
extern ovrTracking rightRemoteTracking_new;
|
||||
|
||||
ovrDeviceID controllerIDs[2];
|
||||
extern ovrDeviceID controllerIDs[2];
|
||||
|
||||
float remote_movementSideways;
|
||||
float remote_movementForward;
|
||||
float remote_movementUp;
|
||||
float positional_movementSideways;
|
||||
float positional_movementForward;
|
||||
float snapTurn;
|
||||
extern int hmdType;
|
||||
|
||||
extern float remote_movementSideways;
|
||||
extern float remote_movementForward;
|
||||
extern float remote_movementUp;
|
||||
extern float positional_movementSideways;
|
||||
extern float positional_movementForward;
|
||||
extern float snapTurn;
|
||||
|
||||
void sendButtonAction(const char* action, long buttonDown);
|
||||
void sendButtonActionSimple(const char* action);
|
||||
|
|
|
@ -17,12 +17,56 @@ Authors : Simon Brown
|
|||
|
||||
//keys.h
|
||||
void Key_Event (int key, qboolean down, unsigned time);
|
||||
bool quake2_initialised;
|
||||
|
||||
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key)
|
||||
long long global_time;
|
||||
|
||||
enum control_scheme;
|
||||
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_new;
|
||||
ovrTracking leftRemoteTracking_new;
|
||||
|
||||
ovrInputStateTrackedRemote rightTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote rightTrackedRemoteState_new;
|
||||
ovrTracking rightRemoteTracking_new;
|
||||
|
||||
ovrDeviceID controllerIDs[2];
|
||||
|
||||
int hmdType;
|
||||
|
||||
float remote_movementSideways;
|
||||
float remote_movementForward;
|
||||
float remote_movementUp;
|
||||
float positional_movementSideways;
|
||||
float positional_movementForward;
|
||||
float snapTurn;
|
||||
|
||||
float playerHeight;
|
||||
float playerYaw;
|
||||
|
||||
bool showingScreenLayer;
|
||||
|
||||
vec3_t worldPosition;
|
||||
|
||||
vec3_t hmdPosition;
|
||||
vec3_t hmdorientation;
|
||||
vec3_t positionDeltaThisFrame;
|
||||
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponoffset;
|
||||
|
||||
vec3_t flashlightangles;
|
||||
vec3_t flashlightoffset;
|
||||
int ducked;
|
||||
|
||||
bool player_moving;
|
||||
|
||||
void handleTrackedControllerButton(u_int32_t buttonsNew, u_int32_t buttonsOld, uint32_t button, int key)
|
||||
{
|
||||
if ((trackedRemoteState->Buttons & button) != (prevTrackedRemoteState->Buttons & button))
|
||||
if ((buttonsNew & button) != (buttonsOld & button))
|
||||
{
|
||||
Key_Event(key, (trackedRemoteState->Buttons & button) != 0, global_time);
|
||||
Key_Event(key, (buttonsNew & button) != 0, global_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +78,8 @@ static void Matrix4x4_Transform (const matrix4x4 *in, const float v[3], float ou
|
|||
out[2] = v[0] * (*in)[2][0] + v[1] * (*in)[2][1] + v[2] * (*in)[2][2] + (*in)[2][3];
|
||||
}
|
||||
|
||||
void Matrix4x4_CreateFromEntity( matrix4x4 out, const vec3_t angles, const vec3_t origin, float scale );
|
||||
|
||||
void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out)
|
||||
{
|
||||
vec3_t temp = {0.0f, 0.0f, 0.0f};
|
||||
|
|
|
@ -16,11 +16,17 @@ Authors : Simon Brown
|
|||
#include "VrInput.h"
|
||||
#include "VrCvars.h"
|
||||
|
||||
#include "../quake2/src/client/client.h"
|
||||
#include "../quake2/src/client/header/client.h"
|
||||
|
||||
extern cvar_t *cl_forwardspeed;
|
||||
extern cvar_t *sv_cheats;
|
||||
cvar_t *sv_cheats;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
extern cvar_t *vr_use_wheels;
|
||||
qboolean draw_item_wheel;
|
||||
qboolean isItems;
|
||||
vec2_t polarCursor;
|
||||
int segment;
|
||||
|
||||
|
||||
|
||||
void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew, ovrInputStateTrackedRemote *pDominantTrackedRemoteOld, ovrTracking* pDominantTracking,
|
||||
|
@ -31,48 +37,128 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//Ensure handedness is set correctly
|
||||
Cvar_Set("hand", vr_control_scheme->value < 10 ? "0" : "1");
|
||||
|
||||
//All this to allow stick and button switching!
|
||||
ovrVector2f primaryJoystickNew;
|
||||
ovrVector2f primaryJoystickOld;
|
||||
ovrVector2f secondaryJoystickNew;
|
||||
ovrVector2f secondaryJoystickOld;
|
||||
uint32_t primaryButtonsNew;
|
||||
uint32_t primaryButtonsOld;
|
||||
uint32_t secondaryButtonsNew;
|
||||
uint32_t secondaryButtonsOld;
|
||||
uint32_t primaryTouchesNew;
|
||||
uint32_t primaryTouchesOld;
|
||||
uint32_t secondaryTouchesNew;
|
||||
uint32_t secondaryTouchesOld;
|
||||
int primaryButton1;
|
||||
int primaryButton2;
|
||||
int secondaryButton1;
|
||||
int secondaryButton2;
|
||||
|
||||
if (vr_control_scheme->value == 11) // Left handed (swtiched sticks)
|
||||
{
|
||||
primaryJoystickNew = pOffTrackedRemoteNew->Joystick;
|
||||
primaryJoystickOld = pOffTrackedRemoteOld->Joystick;
|
||||
secondaryJoystickNew = pDominantTrackedRemoteNew->Joystick;
|
||||
secondaryJoystickOld = pDominantTrackedRemoteOld->Joystick;
|
||||
|
||||
primaryButtonsNew = pOffTrackedRemoteNew->Buttons;
|
||||
primaryButtonsOld = pOffTrackedRemoteOld->Buttons;
|
||||
secondaryButtonsNew = pDominantTrackedRemoteNew->Buttons;
|
||||
secondaryButtonsOld = pDominantTrackedRemoteOld->Buttons;
|
||||
|
||||
primaryTouchesNew = pDominantTrackedRemoteNew->Touches;
|
||||
primaryTouchesOld = pDominantTrackedRemoteOld->Touches;
|
||||
|
||||
secondaryTouchesNew = pOffTrackedRemoteNew->Touches;
|
||||
secondaryTouchesOld = pOffTrackedRemoteOld->Touches;
|
||||
|
||||
primaryButton1 = offButton1;
|
||||
primaryButton2 = offButton2;
|
||||
secondaryButton1 = domButton1;
|
||||
secondaryButton2 = domButton2;
|
||||
}
|
||||
else // Left and right handed
|
||||
{
|
||||
primaryJoystickNew = pDominantTrackedRemoteNew->Joystick;
|
||||
primaryJoystickOld = pDominantTrackedRemoteOld->Joystick;
|
||||
secondaryJoystickNew = pOffTrackedRemoteNew->Joystick;
|
||||
secondaryJoystickOld = pOffTrackedRemoteOld->Joystick;
|
||||
|
||||
primaryButtonsNew = pDominantTrackedRemoteNew->Buttons;
|
||||
primaryButtonsOld = pDominantTrackedRemoteOld->Buttons;
|
||||
secondaryButtonsNew = pOffTrackedRemoteNew->Buttons;
|
||||
secondaryButtonsOld = pOffTrackedRemoteOld->Buttons;
|
||||
|
||||
primaryTouchesNew = pDominantTrackedRemoteNew->Touches;
|
||||
primaryTouchesOld = pDominantTrackedRemoteOld->Touches;
|
||||
|
||||
secondaryTouchesNew = pOffTrackedRemoteNew->Touches;
|
||||
secondaryTouchesOld = pOffTrackedRemoteOld->Touches;
|
||||
|
||||
primaryButton1 = domButton1;
|
||||
primaryButton2 = domButton2;
|
||||
secondaryButton1 = offButton1;
|
||||
secondaryButton2 = offButton2;
|
||||
}
|
||||
|
||||
//Get the cvar
|
||||
sv_cheats = Cvar_Get("cheats", "0", CVAR_ARCHIVE);
|
||||
|
||||
static qboolean dominantGripPushed = false;
|
||||
static float dominantGripPushTime = 0.0f;
|
||||
static qboolean inventoryManagementMode = false;
|
||||
|
||||
//Show screen view (if in multiplayer toggle scoreboard)
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton2)) {
|
||||
|
||||
showingScreenLayer = !showingScreenLayer;
|
||||
|
||||
//Check we are in multiplayer
|
||||
if (isMultiplayer()) {
|
||||
sendButtonActionSimple("score");
|
||||
}
|
||||
}
|
||||
|
||||
//Menu button
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE);
|
||||
//Menu button - _can_ appear on either controller if user has switched them in the oculus menu
|
||||
handleTrackedControllerButton(primaryButtonsNew, primaryButtonsOld, ovrButton_Enter, K_ESCAPE);
|
||||
handleTrackedControllerButton(secondaryButtonsNew, secondaryButtonsOld, ovrButton_Enter, K_ESCAPE);
|
||||
|
||||
if (cls.key_dest == key_menu)
|
||||
{
|
||||
int leftJoyState = (pOffTrackedRemoteNew->Joystick.x > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (pOffTrackedRemoteOld->Joystick.x > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_RIGHTARROW, leftJoyState, global_time);
|
||||
//Allow both sticks and all buttons to work in the menu
|
||||
{
|
||||
int leftJoyState = (secondaryJoystickNew.x > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (secondaryJoystickOld.x > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_RIGHTARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (secondaryJoystickNew.x < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (secondaryJoystickOld.x < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_LEFTARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (secondaryJoystickNew.y < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (secondaryJoystickOld.y < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_DOWNARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (secondaryJoystickNew.y > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (secondaryJoystickOld.y > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_UPARROW, leftJoyState, global_time);
|
||||
}
|
||||
}
|
||||
leftJoyState = (pOffTrackedRemoteNew->Joystick.x < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (pOffTrackedRemoteOld->Joystick.x < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_LEFTARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (pOffTrackedRemoteNew->Joystick.y < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (pOffTrackedRemoteOld->Joystick.y < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_DOWNARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (pOffTrackedRemoteNew->Joystick.y > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (pOffTrackedRemoteOld->Joystick.y > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_UPARROW, leftJoyState, global_time);
|
||||
{
|
||||
int leftJoyState = (primaryJoystickNew.x > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (primaryJoystickOld.x > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_RIGHTARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (primaryJoystickNew.x < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (primaryJoystickOld.x < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_LEFTARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (primaryJoystickNew.y < -0.7f ? 1 : 0);
|
||||
if (leftJoyState != (primaryJoystickOld.y < -0.7f ? 1 : 0)) {
|
||||
Key_Event(K_DOWNARROW, leftJoyState, global_time);
|
||||
}
|
||||
leftJoyState = (primaryJoystickNew.y > 0.7f ? 1 : 0);
|
||||
if (leftJoyState != (primaryJoystickOld.y > 0.7f ? 1 : 0)) {
|
||||
Key_Event(K_UPARROW, leftJoyState, global_time);
|
||||
}
|
||||
}
|
||||
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton1, K_ENTER);
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, ovrButton_Trigger, K_ENTER);
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, K_ESCAPE);
|
||||
handleTrackedControllerButton(primaryButtonsNew, primaryButtonsOld, primaryButton1, K_ENTER);
|
||||
handleTrackedControllerButton(primaryButtonsNew, primaryButtonsOld, ovrButton_Trigger, K_ENTER);
|
||||
handleTrackedControllerButton(primaryButtonsNew, primaryButtonsOld, primaryButton2, K_ESCAPE);
|
||||
handleTrackedControllerButton(secondaryButtonsNew, secondaryButtonsOld, secondaryButton1, K_ENTER);
|
||||
handleTrackedControllerButton(secondaryButtonsNew, secondaryButtonsOld, ovrButton_Trigger, K_ENTER);
|
||||
handleTrackedControllerButton(secondaryButtonsNew, secondaryButtonsOld, secondaryButton2, K_ESCAPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -130,11 +216,103 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) {
|
||||
if(vr_use_wheels->value > 0) {
|
||||
{
|
||||
// weapon selection wheel
|
||||
if ((secondaryButtonsNew & secondaryButton2) !=
|
||||
(secondaryButtonsOld & secondaryButton2)) {
|
||||
sendButtonActionSimple("inven");
|
||||
inventoryManagementMode = (secondaryButtonsNew & secondaryButton2) > 0;
|
||||
}
|
||||
static qboolean active = false;
|
||||
static qboolean touching = false;
|
||||
static qboolean runTouchLogic = false;
|
||||
static int totalIcons;
|
||||
static int t_rel_t;
|
||||
static vec3_t initialAngles;
|
||||
static wheel_icon_t *iconList;
|
||||
ovrTracking *activeController;
|
||||
vec3_t currentAngles;
|
||||
vec2_t relativeAngles;
|
||||
|
||||
sendButtonActionSimple("inven");
|
||||
inventoryManagementMode = (pDominantTrackedRemoteNew->Buttons & ovrButton_GripTrigger) > 0;
|
||||
if ((primaryTouchesNew & ovrTouch_ThumbRest) &&
|
||||
!(secondaryTouchesNew & ovrTouch_ThumbRest)) {
|
||||
activeController = pDominantTracking; // regardless of handedness or stick assignment, makes sense to use the weapon hand for the weapon wheel
|
||||
iconList = weaponIcons;
|
||||
isItems = false;
|
||||
totalIcons = 11;
|
||||
active = true;
|
||||
} else if ((secondaryTouchesNew & ovrTouch_ThumbRest) &&
|
||||
!(primaryTouchesNew & ovrTouch_ThumbRest)) {
|
||||
activeController = pOffTracking; // conversely, makes sense to use the off hand for the item wheel
|
||||
iconList = itemIcons;
|
||||
isItems = true;
|
||||
totalIcons = 6;
|
||||
active = true;
|
||||
} else {
|
||||
active = false;
|
||||
}
|
||||
if (active) {
|
||||
if (!touching) {
|
||||
draw_item_wheel = true;
|
||||
sendButtonActionSimple(
|
||||
"inven"); // send the "inven" command to force cl.inventory to be populated
|
||||
QuatToYawPitchRoll(activeController->HeadPose.Pose.Orientation, 0.0f,
|
||||
initialAngles);
|
||||
VectorCopy(initialAngles, relativeAngles);
|
||||
touching = true;
|
||||
} else {
|
||||
QuatToYawPitchRoll(activeController->HeadPose.Pose.Orientation, 0.0f,
|
||||
currentAngles);
|
||||
relativeAngles[0] = initialAngles[1] -
|
||||
currentAngles[1]; // relative x -> pitch | Inverted to make right = positive
|
||||
relativeAngles[1] = currentAngles[0] -
|
||||
initialAngles[0]; // relative y -> yaw | to match display coordinates, down = positive
|
||||
polarCursor[0] = sqrtf(
|
||||
powf(relativeAngles[0], 2.0f) +
|
||||
powf(relativeAngles[1], 2.0f)); // r
|
||||
if (polarCursor[0] > 15)
|
||||
polarCursor[0] = 15; // to keep it within the ring
|
||||
polarCursor[1] = atan2f(relativeAngles[1], relativeAngles[0]); // theta
|
||||
segment =
|
||||
(int) (((polarCursor[1] + (M_PI / totalIcons)) + (2.5 * M_PI)) *
|
||||
(totalIcons / (2 * M_PI))) %
|
||||
totalIcons; // Top segment index = 0, clockwise up to 10
|
||||
|
||||
/*float th = M_PI/-2;
|
||||
int r = 160;
|
||||
float factor = M_PI * 2/6;
|
||||
for(int i = 0; i < 6; i++){
|
||||
int x, y;
|
||||
x = r * cosf(th + (i * factor));
|
||||
y = r * sinf(th + (i * factor));
|
||||
ALOGV(" segment %i: x: %i y=%i", i, x, y);
|
||||
}*/ // this snippet generated precalculated coordinates for each icon, relative to the ring center
|
||||
// I'll leave it here in case those values need to be calculated again
|
||||
|
||||
}
|
||||
} else {
|
||||
if (touching) {
|
||||
sendButtonActionSimple(
|
||||
"inven"); // send the "inven" command again to close the inventory
|
||||
touching = false;
|
||||
runTouchLogic = true;
|
||||
t_rel_t = Sys_Milliseconds();
|
||||
if (polarCursor[0] > 8) {
|
||||
char useCom[50];
|
||||
sprintf(useCom, "use %s", iconList[segment].command);
|
||||
sendButtonActionSimple(useCom);
|
||||
}
|
||||
}
|
||||
// give it time for the "inven" commmand to be sent,
|
||||
// preventing the "invisible" inventory window to be shown for a little bit
|
||||
if (runTouchLogic && Sys_Milliseconds() - t_rel_t > 100) {
|
||||
draw_item_wheel = false;
|
||||
runTouchLogic = false;
|
||||
polarCursor[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,16 +341,11 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
//Right-hand specific stuff
|
||||
{
|
||||
ALOGV(" Right-Controller-Position: %f, %f, %f",
|
||||
pDominantTracking->HeadPose.Pose.Position.x,
|
||||
pDominantTracking->HeadPose.Pose.Position.y,
|
||||
pDominantTracking->HeadPose.Pose.Position.z);
|
||||
|
||||
//This section corrects for the fact that the controller actually controls direction of movement, but we want to move relative to the direction the
|
||||
//player is facing for positional tracking
|
||||
float multiplier = (vr_positional_factor->value) / (cl_forwardspeed->value *
|
||||
float positionalFactor = (hmdType == VRAPI_DEVICE_TYPE_OCULUSQUEST2) ? 2500 : 2000;
|
||||
float multiplier = positionalFactor / (cl_forwardspeed->value *
|
||||
((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) ? 1.5f : 1.0f));
|
||||
|
||||
vec2_t v;
|
||||
|
@ -186,23 +359,13 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
positional_movementForward);
|
||||
|
||||
//Jump (B Button)
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew,
|
||||
pDominantTrackedRemoteOld, domButton2, K_SPACE);
|
||||
handleTrackedControllerButton(primaryButtonsNew,
|
||||
primaryButtonsOld, primaryButton2, K_SPACE);
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
if (!firingPrimary && dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->value)
|
||||
{
|
||||
//Use Inventory Item
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
|
||||
sendButtonActionSimple("invuse");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Fire Primary
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
|
@ -223,21 +386,21 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
|
||||
//Duck with A
|
||||
if ((pDominantTrackedRemoteNew->Buttons & domButton1) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & domButton1) &&
|
||||
if ((primaryButtonsNew & primaryButton1) !=
|
||||
(primaryButtonsOld & primaryButton1) &&
|
||||
ducked != DUCK_CROUCHED) {
|
||||
ducked = (pDominantTrackedRemoteNew->Buttons & domButton1) ? DUCK_BUTTON : DUCK_NOTDUCKED;
|
||||
sendButtonAction("+movedown", (pDominantTrackedRemoteNew->Buttons & domButton1));
|
||||
ducked = (primaryButtonsNew & primaryButton1) ? DUCK_BUTTON : DUCK_NOTDUCKED;
|
||||
sendButtonAction("+movedown", (primaryButtonsNew & primaryButton1));
|
||||
}
|
||||
|
||||
//Weapon/Inventory Chooser
|
||||
static qboolean itemSwitched = false;
|
||||
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.x, 0.2f) &&
|
||||
(between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f) ||
|
||||
between(-1.0f, pDominantTrackedRemoteNew->Joystick.y, -0.8f)))
|
||||
if (between(-0.2f, primaryJoystickNew.x, 0.2f) &&
|
||||
(between(0.8f, primaryJoystickNew.y, 1.0f) ||
|
||||
between(-1.0f, primaryJoystickNew.y, -0.8f)))
|
||||
{
|
||||
if (!itemSwitched) {
|
||||
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.y, 1.0f))
|
||||
if (between(0.8f, primaryJoystickNew.y, 1.0f))
|
||||
{
|
||||
if (inventoryManagementMode)
|
||||
{
|
||||
|
@ -267,13 +430,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
//Left-hand specific stuff
|
||||
{
|
||||
ALOGV(" Left-Controller-Position: %f, %f, %f",
|
||||
pOffTracking->HeadPose.Pose.Position.x,
|
||||
pOffTracking->HeadPose.Pose.Position.y,
|
||||
pOffTracking->HeadPose.Pose.Position.z);
|
||||
|
||||
//Laser-sight
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Joystick) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Joystick)
|
||||
|
@ -288,10 +445,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
|
||||
//Apply a filter and quadratic scaler so small movements are easier to make
|
||||
float dist = length(pOffTrackedRemoteNew->Joystick.x, pOffTrackedRemoteNew->Joystick.y);
|
||||
float dist = length(secondaryJoystickNew.x, secondaryJoystickNew.y);
|
||||
float nlf = nonLinearFilter(dist);
|
||||
float x = nlf * pOffTrackedRemoteNew->Joystick.x;
|
||||
float y = nlf * pOffTrackedRemoteNew->Joystick.y;
|
||||
float x = nlf * secondaryJoystickNew.x;
|
||||
float y = nlf * secondaryJoystickNew.y;
|
||||
|
||||
player_moving = (fabs(x) + fabs(y)) > 0.05f;
|
||||
|
||||
|
@ -307,8 +464,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
|
||||
//show help computer while X/A pressed
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) {
|
||||
if ((secondaryButtonsNew & secondaryButton1) !=
|
||||
(secondaryButtonsOld & secondaryButton1)) {
|
||||
sendButtonActionSimple("cmd help");
|
||||
}
|
||||
|
||||
|
@ -327,57 +484,50 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
//Run
|
||||
handleTrackedControllerButton(pOffTrackedRemoteNew,
|
||||
pOffTrackedRemoteOld,
|
||||
handleTrackedControllerButton(pOffTrackedRemoteNew->Buttons,
|
||||
pOffTrackedRemoteOld->Buttons,
|
||||
ovrButton_Trigger, K_SHIFT);
|
||||
|
||||
static int increaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x > 0.6f)
|
||||
{
|
||||
if (increaseSnap)
|
||||
{
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
increaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn < -180.0f)
|
||||
static qboolean snapping = true;
|
||||
static float turn_rate;
|
||||
if (vr_snapturn_angle->value > 10.0f){ // snap turning
|
||||
if (primaryJoystickNew.x > 0.6f)
|
||||
{
|
||||
if (snapping)
|
||||
{
|
||||
snapTurn += 360.f;
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
snapping = false;
|
||||
|
||||
if (snapTurn < -180.0f)
|
||||
{
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x < 0.4f) {
|
||||
increaseSnap = true;
|
||||
}
|
||||
|
||||
static int decreaseSnap = true;
|
||||
if (pDominantTrackedRemoteNew->Joystick.x < -0.6f)
|
||||
{
|
||||
if (decreaseSnap)
|
||||
{
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
|
||||
//If snap turn configured for less than 10 degrees
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
decreaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn > 180.0f)
|
||||
else if (primaryJoystickNew.x < -0.6f)
|
||||
{
|
||||
if (snapping)
|
||||
{
|
||||
snapTurn -= 360.f;
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
snapping = false;
|
||||
|
||||
if (snapTurn > 180.0f)
|
||||
{
|
||||
snapTurn -= 360.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x > -0.4f)
|
||||
{
|
||||
decreaseSnap = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
snapping = true;
|
||||
}
|
||||
}else{ // continuous turning
|
||||
turn_rate = vr_snapturn_angle->value < 1.0f ? 1.0f : vr_snapturn_angle->value;
|
||||
if(fabsf(primaryJoystickNew.x) > vr_turn_deadzone->value) {
|
||||
snapTurn -= (10.0f * primaryJoystickNew.x) / turn_rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Save state
|
||||
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
|
||||
leftTrackedRemoteState_old = leftTrackedRemoteState_new;
|
||||
}
|
|
@ -18,8 +18,8 @@ GNU General Public License for more details.
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#include "../quake2/src/qcommon/qcommon.h"
|
||||
#include "../quake2/src/client/keys.h"
|
||||
#include "../quake2/src/common/header/common.h"
|
||||
#include "../quake2/src/client/header/keyboard.h"
|
||||
|
||||
|
||||
// euler angle order
|
||||
|
@ -168,6 +168,8 @@ void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac );
|
|||
|
||||
#define cmatrix3x4 vec4_t *const
|
||||
#define cmatrix4x4 vec4_t *const
|
||||
typedef vec_t matrix3x4[3][4];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
|
||||
void Matrix3x4_VectorTransform( cmatrix3x4 in, const float v[3], float out[3] );
|
||||
void Matrix3x4_VectorITransform( cmatrix3x4 in, const float v[3], float out[3] );
|
||||
|
|
1
Projects/Android/jni/SupportLibs/Android.mk
Normal file
|
@ -0,0 +1 @@
|
|||
include $(call all-subdir-makefiles)
|
|
@ -83,4 +83,4 @@ LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR
|
|||
|
||||
LOCAL_LDLIBS := -ldl -llog -lEGL -lGLESv3
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(BUILD_SHARED_LIBRARY)
|
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 279 KiB |
Before Width: | Height: | Size: 336 KiB After Width: | Height: | Size: 336 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 394 KiB After Width: | Height: | Size: 394 KiB |
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |