mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Merge branch 'master' into IBL-environment-probes2
This commit is contained in:
commit
2c07265be5
42 changed files with 39392 additions and 668 deletions
380
README.md
Normal file
380
README.md
Normal file
|
@ -0,0 +1,380 @@
|
|||
RBDOOM-3-BFG Readme - https://github.com/RobertBeckebans/RBDOOM-3-BFG
|
||||
|
||||
|
||||
<img src="https://i.imgur.com/jEmcriO.png">
|
||||
|
||||
|
||||
## Table of Contents
|
||||
|
||||
This file contains the following sections:
|
||||
|
||||
1. [About the Port](#about)
|
||||
2. [Renderer Features Explained](#render)
|
||||
3. [".plan"](#plan)
|
||||
4. [May or may not ".plan"](#plan2)
|
||||
5. [General Notes](#notes)
|
||||
6. [License](#license)
|
||||
7. [Getting the Source Code ](#source)
|
||||
8. [Compiling on Windows](#compile_windows)
|
||||
9. [Compiling on Linux](#compile_linux)
|
||||
10. [Installation, Getting the Game Data, Running the Game](#installation)
|
||||
11. [New Console Variables](#console)
|
||||
12. [Known Issues](#issues)
|
||||
13. [Bug Reports](#reports)
|
||||
14. [FAQ](#faq)
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
## About the Port <a name="about"></a>
|
||||
|
||||
`RBDOOM-3-BFG is a modernization effort of DOOM-3-BFG.`
|
||||
|
||||
RBDOOM-3-BFG is based on DOOM-3-BFG and the goal of this port is to bring DOOM-3-BFG up to latest technology in 2019 making it closer to Doom 2016 while still remaining a DOOM 3 port regarding the gameplay.
|
||||
|
||||
I started this project in 2012 and focused on making this code being future proof so other cool projects can build interesting things on top of it without the need to fix a lot of stuff first. Over 40 people all over the world contributed cool patches. Some results are:
|
||||
|
||||
* Flexible build system using CMake allowing to add optional features like FFmpeg for videos or OpenAL for sound
|
||||
* Linux support (32 and 64 bit) with both GCC and Clang with a proper SDL 2 OS layer including gamepad support
|
||||
* Win64 support and Visual Studio support up to VS 2019
|
||||
* OS X support
|
||||
* OpenAL Soft sound backend primarily developed for Linux but works on Windows as well
|
||||
* Bink video support through libbinkdec or FFmpeg (thanks to Daniel Gibson)
|
||||
* PNG image support
|
||||
* Soft shadows using PCF hardware shadow mapping
|
||||
The implementation uses sampler2DArrayShadow and PCF which usually
|
||||
requires Direct3D 10.1 however it is in the OpenGL 3.2 core so it should
|
||||
be widely supported.
|
||||
All 3 light types are supported which means parallel lights (sun) use
|
||||
scene independent cascaded shadow mapping.
|
||||
The implementation is very fast with single taps (400 fps average per
|
||||
scene on a GTX 660 ti OC) however I defaulted it to 12 taps using a Poisson disc algorithm so the shadows look
|
||||
really good which should give you stable 100 fps on todays hardware (2014).
|
||||
* Changed light interaction shaders to use Half-Lambert lighting like in Half-Life 2 to
|
||||
make the game less dark. https://developer.valvesoftware.com/wiki/Half_Lambert
|
||||
* True 64 bit HDR lighting with adaptive tone mapping and gamma-correct rendering in linear RGB space
|
||||
* Enhanced Subpixel Morphological Antialiasing. For more information see "Anti-Aliasing Methods in CryENGINE 3" and the docs at http://www.iryoku.com/smaa/
|
||||
* Filmic post process effects like Technicolor color grading and film grain
|
||||
* Additional ambient render pass to make the game less dark similar to the Quake 4 r_forceAmbient technique
|
||||
* Screen Space Ambient Occlusion http://graphics.cs.williams.edu/papers/SAOHPG12/
|
||||
* Netcode fixes to allow multiplayer sessions to friends with +connect <ip of friend> (manual port forwarding required)
|
||||
* Added back dmap and aas compilers (mapping tools)
|
||||
* Cinematic sequences can be skipped
|
||||
* Sourcecode cleanup using the Artistic Style C++ beautifier to ensure the Git diffs and logs are clean
|
||||
* Fixed tons of warnings using the Clang compiler
|
||||
* Fast compile times using precompiled header support
|
||||
* RBDOOM-3-BFG allows mod editing and has many tiny fixes so custom content can be put into mod directories and the engine accepts it like vanilla Doom 3.DOOM 3 BFG wasn't designed for actual development or modding support. Many things like reading anything outside of the packed resource files was not supported. I also fixed many things in the renderer like r_showTris.
|
||||
|
||||
If you want to start mod from a directory, you should first specify your mod directory adding the following command to the launcher:
|
||||
|
||||
"+set fs_game modDirectoryName"
|
||||
|
||||
so it would end up looking like: RBDoom3BFG +set fs_game modDirectoryName
|
||||
|
||||
|
||||
IMPORTANT: RBDOOM-3-BFG does not support old Doom 3 modifications that include sourcecode modifications in binary form (.dll)
|
||||
You can fork RBDOOM-3-BFG and create a new renamed binary that includes all required C++ game code modifications.
|
||||
|
||||
---
|
||||
## Renderer Features Explained <a name="render"></a>
|
||||
|
||||
### HDR
|
||||
Left: Wrong original Blinn-Phong in sRGB gamma space. Right: Gamma correct HDR rendering in linear RBG + ACES Film Tonemapping Try it yourself, it is hard to see the effect in a single Screenshot.
|
||||
|
||||
<img src="https://i.imgur.com/z5GRIFa.png" width="384"> <img src="https://i.imgur.com/4WJGNzX.png" width="384">
|
||||
|
||||
<img src="https://i.imgur.com/6R42aoG.png" width="384"> <img src="https://i.imgur.com/A7VLpRM.png" width="384">
|
||||
|
||||
### Extra Ambient Pass
|
||||
|
||||
Left: No extra ambient pass. Ambient is pure black. Right: Extra ambient pass with r_forceAmbient 0.2
|
||||
|
||||
<img src="https://i.imgur.com/JZZNmSn.png" width="384"> <img src="https://i.imgur.com/LMtVJ4m.png" width="384">
|
||||
|
||||
### Screen Space Ambient Occlusion
|
||||
Left: No HDR and no SSAO. Right: r_useSSAO 1 darkens the corners of the scene and also removes too much ambient added by the extra ambient pass
|
||||
|
||||
<img src="https://i.imgur.com/Zz5OZGJ.png" width="384"> <img src="https://i.imgur.com/qUNH5th.png" width="384">
|
||||
|
||||
<img src="https://i.imgur.com/AP2tBVd.png" width="384"> <img src="https://i.imgur.com/dJ1dY4X.png" width="384">
|
||||
|
||||
### Filmic Post Processing
|
||||
Left: No post processing except HDR tone mapping. Right: r_useFilmicPostProcessing 1 adds Technicolor color grading and film grain
|
||||
|
||||
<img src="https://i.imgur.com/MwUyLXt.png" width="384"> <img src="https://i.imgur.com/1nZPlNk.png" width="384">
|
||||
|
||||
---
|
||||
## ".plan" <a name=".plan"></a>
|
||||
|
||||
* Finish PBR texture support
|
||||
* Add IBL lighting and [Light probe interpolation using tetrahedral tessellations](https://gdcvault.com/play/1015312/Light-Probe-Interpolation-Using-Tetrahedral)
|
||||
* Generate IBL probes on the GPU through compute shaders
|
||||
* Add Screen Space Reflections
|
||||
* Finish adapting the Vulkan renderer backend based on Dustin Land's vkDOOM3
|
||||
* Fix GPU Skinning with Vulkan
|
||||
* Fix the lighting with stencil shadows with Vulkan
|
||||
* Port all the extras like HDR, Shadow Mapping and Post Processing to Vulkan
|
||||
* Get ImGui to run with Vulkan and show the Vulkan memory fragmentation with it live
|
||||
* Evaluate Blender 2.8 as a complete replacement for D3Radiant and update the scripts for it
|
||||
|
||||
---
|
||||
## May or may not ".plan" <a name=".plan2"></a>
|
||||
|
||||
* Add [Volumetric Lighting](http://www.alexandre-pestana.com/volumetric-lights/)
|
||||
* Give Mara's and McGuire's DeepGBuffer Screen Space Global Illumination a second try with Christoph Schieds' A-SVGF realtime denoising because A-SVGF works really well in Q2RTX
|
||||
* Port Virtual Texturing support from [IcedTech](https://github.com/jmarshall23/IcedTech)
|
||||
* Slim texture loading routines based on stb_image
|
||||
* Add texture compression based on [Basis Universal GPU Texture and Texture Video Compression Codec](https://github.com/binomialLLC/basis_universal)
|
||||
* Scrap complex and complicated multipass forward shading with a simpler forward+ solution
|
||||
* Rip & Tear renderer backend with modern approaches by [The-Forge](https://github.com/ConfettiFX/The-Forge)
|
||||
* Imrpove SMAAA with Temporal Anti-Aliasing (SMAA T2x)
|
||||
* Replace collision detection and physics with PhysX 4.1
|
||||
* Add glTF 2.0 support for static models and animations because it is the new JPG of 3D ;)
|
||||
* Replace sound system with [SoLoud](https://github.com/jarikomppa/soloud)
|
||||
|
||||
---
|
||||
## General Notes <a name="notes"></a>
|
||||
|
||||
A short summary of the file layout:
|
||||
|
||||
Directory | Description
|
||||
:---------------------------- | :------------------------------------------------
|
||||
RBDOOM-3-BFG/base/ | Doom 3 BFG media directory ( models, textures, sounds, maps, etc. )
|
||||
RBDOOM-3-BFG/neo/ | RBDOOM-3-BFG source code ( renderer, game code for multiple games, OS layer, etc. )
|
||||
RBDOOM-3-BFG/build/ | Build folder for CMake
|
||||
RBDOOM-3-BFG/blender/ | Blender scripts for modding
|
||||
|
||||
This release does not contain any game data, the game data is still
|
||||
covered by the original EULA and must be obeyed as usual.
|
||||
|
||||
You must patch the game to the latest version.
|
||||
|
||||
You can purchase Doom 3 BFG Edition from GOG (DRM Free):
|
||||
https://www.gog.com/game/doom_3_bfg_edition
|
||||
|
||||
Or the game can be purchased from Steam (with DRM):
|
||||
http://store.steampowered.com/app/208200/
|
||||
|
||||
|
||||
### Steam
|
||||
The Doom 3 BFG Edition GPL Source Code release does not include functionality for integrating with
|
||||
Steam. This includes roaming profiles, achievements, leaderboards, matchmaking, the overlay, or
|
||||
any other Steam features.
|
||||
|
||||
### Bink Video playback
|
||||
The RBDOOM-3-BFG Edition GPL Source Code release includes functionality for rendering Bink Videos through FFmpeg.
|
||||
|
||||
### Back End Rendering of Stencil Shadows
|
||||
The Doom 3 BFG Edition GPL Source Code release does not include functionality enabling rendering
|
||||
of stencil shadows via the "depth fail" method, a functionality commonly known as "Carmack's Reverse".
|
||||
|
||||
---
|
||||
## License <a name="license"></a>
|
||||
See docs/COPYING.txt for the GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
ADDITIONAL TERMS: The Doom 3 BFG Edition GPL Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU GPL which accompanied the Doom 3 BFG Edition GPL Source Code. If not, please request a copy in writing from id Software at id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
See docs/CODE_LICENSE_EXCEPTIONS.md for all parts of the code The parts that are not covered by the GPL.
|
||||
|
||||
---
|
||||
## Getting the Source Code <a name="source"></a>
|
||||
|
||||
This project's GitHub.net Git repository can be checked out through Git with the following instruction set:
|
||||
|
||||
> git clone https://github.com/RobertBeckebans/RBDOOM-3-BFG.git
|
||||
|
||||
|
||||
|
||||
---
|
||||
## Compiling on Windows <a name="compile_windows"></a>
|
||||
|
||||
1. Download and install the Visual C++ 2013 Express Edition.
|
||||
|
||||
2. Download the DirectX SDK (June 2010) here: (Only for Windows 7 builds)
|
||||
http://www.microsoft.com/en-us/download/details.aspx?id=6812
|
||||
|
||||
3. Download and install the latest CMake.
|
||||
|
||||
4. Generate the VS2017 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
|
||||
|
||||
5. Use the VS2017 solution to compile what you need:
|
||||
RBDOOM-3-BFG/build/RBDoom3BFG.sln
|
||||
|
||||
|
||||
### Optional if you want to use FFmpeg
|
||||
|
||||
6. Download ffmpeg-20151105-git-c878082-win32-shared.7z from ffmpeg.zeranoe.com/builds/win32/shared
|
||||
or
|
||||
ffmpeg-20151105-git-c878082-win64-shared.7z from ffmpeg.zeranoe.com/builds/win64/shared
|
||||
|
||||
7. Extract the FFmpeg DLLs to your current build directory under RBDOOM-3-BFG/build/
|
||||
|
||||
|
||||
---
|
||||
## Compiling on Linux <a name="compile_linux"></a>
|
||||
|
||||
1. You need the following dependencies in order to compile RBDoom3BFG with all features:
|
||||
|
||||
On Debian or Ubuntu:
|
||||
|
||||
> apt-get install cmake libsdl2-dev libopenal-dev
|
||||
|
||||
On Fedora
|
||||
|
||||
> yum install cmake SDL-devel openal-devel
|
||||
|
||||
On ArchLinux
|
||||
|
||||
> sudo pacman -S sdl2 openal cmake
|
||||
|
||||
2. Generate the Makefiles using CMake:
|
||||
|
||||
> cd neo/
|
||||
> ./cmake-eclipse-linux-profile.sh
|
||||
|
||||
3. Compile RBDOOM-3-BFG targets with
|
||||
|
||||
> cd ../build
|
||||
> make
|
||||
|
||||
---
|
||||
## Installation, Getting the Game Data, Running the Game <a name="installation"></a>
|
||||
|
||||
If you use the prebuilt `Win32` or `Win64` binaries then simply extract them to your
|
||||
`C:\Program Files (x86)\Steam\SteamApps\common\Doom 3 BFG Edition\` directory and run RBDoom3BFG.exe.
|
||||
|
||||
---
|
||||
The following instructions are primarily intented for `Linux` users and all hackers on other operating systems.
|
||||
|
||||
To play the game, you need the game data from a legal copy of the game.
|
||||
|
||||
Currently this requires a Windows installer, whether that be the GOG installer or by using Steam for Windows.
|
||||
|
||||
Note: the original DVD release of Doom 3 BFG contains encrypted data that is decoded by Steam on install.
|
||||
|
||||
On Linux and OSX the easiest way to install is with SteamCMD: https://developer.valvesoftware.com/wiki/SteamCMD
|
||||
See the description on https://developer.valvesoftware.com/wiki/SteamCMD#Linux (OS X is directly below that) on how to install SteamCMD on your system. You won't have to create a new user.
|
||||
|
||||
Then you can download Doom 3 BFG with
|
||||
|
||||
> ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login <YOUR_STEAM_LOGIN_NAME> +force_install_dir ./doom3bfg/ +app_update 208200 validate +quit
|
||||
|
||||
(replace <YOUR_STEAM_LOGIN_NAME> with your steam login name)
|
||||
When it's done you should have the normal windows installation of Doom 3 BFG in ./doom3bfg/ and the needed files in ./doom3bfg/base/
|
||||
That number is the "AppID" of Doom 3 BFG; if you wanna use this to get the data of other games you own, you can look up the AppID at https://steamdb.info/
|
||||
|
||||
NOTE that we've previously recommended using download_depot in the Steam console to install the game data. That turned out to be unreliable and result in broken, unusable game data. So use SteamCMD instead, as described above.
|
||||
|
||||
Alternatively with the GOG installer, you can use Wine to install the game. See https://winehq.org/download for details on how to install wine for Linux and Mac.
|
||||
|
||||
Once Wine is installed and configured on your system install Doom 3 BFG edition using the downloaded installers from gog.com:
|
||||
|
||||
> wine setup_doom_3_bfg_1.14_\(13452\)_\(g\).exe
|
||||
|
||||
(there will be several .exe files from GOG, make sure all of them are in the same directory)
|
||||
|
||||
Once this is complete, by default you can find your Doom 3 BFG "base/" directory at ".wine/drive_c/GOG\ Games/DOOM\ 3\ BFG/base".
|
||||
|
||||
Note that you may want to add the following line to the bottom of the default.cfg in whatever "base/" directory you use:
|
||||
|
||||
> set sys_lang "english"
|
||||
|
||||
This will ensure the game and its menus are in english and don't default to something else. Alternatives include:
|
||||
|
||||
set sys_lang "english"
|
||||
set sys_lang "french"
|
||||
set sys_lang "german"
|
||||
set sys_lang "italian"
|
||||
set sys_lang "japanese"
|
||||
set sys_lang "spanish"
|
||||
|
||||
Anyway:
|
||||
|
||||
1. Install Doom 3 BFG in Steam (Windows version) or SteamCMD, make sure it's getting
|
||||
updated/patched.
|
||||
|
||||
2. Create your own Doom 3 BFG directory, e.g. /path/to/Doom3BFG/
|
||||
|
||||
3. Copy the game-data's base dir from Steam or GOG to that directory
|
||||
(e.g. /path/to/Doom3BFG/), it's in
|
||||
/your/path/to/Steam/steamapps/common/DOOM 3 BFG Edition/base/
|
||||
or, if you used SteamCMD or GOG installer with Wine, in the path you used above.
|
||||
|
||||
4. Copy your RBDoom3BFG executable that you created in 5) or 6) and the FFmpeg DLLs to your own
|
||||
Doom 3 BFG directory (/path/to/Doom3BFG).
|
||||
|
||||
Your own Doom 3 BFG directory now should look like:
|
||||
/path/to/Doom3BFG/
|
||||
-> RBDoom3BFG (or RBDoom3BFG.exe on Windows)
|
||||
-> avcodec-55.dll
|
||||
-> avdevice-55.dll
|
||||
-> avfilter-4.dll
|
||||
-> avformat-55.dll
|
||||
-> avutil-52.dll
|
||||
-> postproc-52.dll
|
||||
-> swresample-0.dll
|
||||
-> swscale-2.dll
|
||||
-> base/
|
||||
-> classicmusic/
|
||||
-> _common.crc
|
||||
-> (etc)
|
||||
|
||||
5. Run the game by executing the RBDoom3BFG executable.
|
||||
|
||||
6. Enjoy
|
||||
|
||||
7. If you run into bugs, please report them, see [Bug Reports](#reports)
|
||||
|
||||
---
|
||||
## New Console Variables <a name="console"></a>
|
||||
|
||||
Directory | Description
|
||||
:--------------------------------------| :------------------------------------------------
|
||||
r_antiAliasing | Different Anti-Aliasing modes
|
||||
r_useShadowMapping [0 or 1] | Use soft shadow mapping instead of hard stencil shadows
|
||||
r_useHDR [0 or 1] | Use High Dynamic Range lighting
|
||||
r_hdrAutoExposure [0 or 1] | Adaptive tonemapping with HDR. This allows to have very bright or very dark scenes but the camera will adopt to it so the scene won't loose details
|
||||
r_exposure [0 .. 1] | Default 0.5, Controls brightness and affects HDR exposure key. This is what you change in the video brightness options
|
||||
r_useSSAO [0 .. 1] | Use Screen Space Ambient Occlusion to darken the corners in the scene
|
||||
r_useFilmicPostProcessEffects | Apply several post process effects to mimic a filmic look
|
||||
|
||||
|
||||
____
|
||||
|
||||
## Known Issues <a name="issues"></a>
|
||||
____
|
||||
* HDR does not work with old-school stencil shadows
|
||||
* MSAA anti-aliasing modes don't work with HDR: Use SMAA
|
||||
* Some lights cause shadow acne with shadow mapping
|
||||
* Some shadows might almost disappear due to the shadow filtering
|
||||
|
||||
---
|
||||
## Bug Reports <a name="reports"></a>
|
||||
|
||||
The best way for telling about a bug is by submitting a bug report at our GitHub bug tracker page:
|
||||
|
||||
https://github.com/RobertBeckebans/RBDOOM-3-BFG/issues?state=open
|
||||
|
||||
If you want to report an issue with the game, you should make sure that your report includes all information useful to characterize and reproduce the bug.
|
||||
|
||||
* Search on Google
|
||||
* Include the computer's hardware and software description ( CPU, RAM, 3D Card, distribution, kernel etc. )
|
||||
* If appropriate, send a console log, a screenshot, an strace ..
|
||||
* If you are sending a console log, make sure to enable developer output:
|
||||
|
||||
> RBDoom3BFG.exe +set developer 1 +set logfile 2
|
||||
|
||||
You can find your qconsole.log on Windows in C:\Users\<your user name>\Saved Games\id Software\RBDOOM 3 BFG\base\
|
||||
|
||||
---
|
||||
## FAQ <a name="faq"></a>
|
||||
|
||||
**Q**: Why bother with DOOM-3-BFG in 2019 / 2020?
|
||||
**A**: It is fun, period. Doom 3 was an impressive milestone in total game development in 2004. In 2011 id Software added lot stuff from the development of Rage like its own Flash SWF and ActionScript 2 interpreter, proper support for gamepads and widescreens. It also combines the gamecode for D3 and its missionpacks and runs it in a seperate thread and it has many multithreaded rendering optimizations. DOOM-3-BFG is one of the most transparent games available where you can open all files and inspect how the game was built.
|
||||
|
||||
**Q**: Can I use this engine to make a commercial game?
|
||||
**A**: You can but don't bother me to give you free support and you probably should use Unreal Engine 4. I am a full time game developer and usually don't have time for any free support.
|
||||
|
||||
**Q**: How do I know what code you've changed?
|
||||
**A**: Apart from the Git diffs, you can look for `// RB` in the source code. Many other contributors commented their changes in the same way. I enforced the usage of Astyle in this project which also makes it alot easier to compare it against other ports of DOOM-3-BFG. Simply format the other ports with Astyle like I do in neo/astyle-code.bat and you can compare the code easily in WinMerge or KDiff3.
|
654
README.txt
654
README.txt
|
@ -1,654 +0,0 @@
|
|||
____ ____ ____ _____ ____ ______ ______
|
||||
/ __ \ / __ ) / __ \ ____ ____ ____ ___ |__ / / __ ) / ____// ____/
|
||||
/ /_/ // __ |/ / / // __ \ / __ \ / __ `__ \ /_ < / __ |/ /_ / / __
|
||||
/ _, _// /_/ // /_/ // /_/ // /_/ // / / / / /___/ // /_/ // __/ / /_/ /
|
||||
/_/ |_|/_____//_____/ \____/ \____//_/ /_/ /_//____//_____//_/ \____/
|
||||
_________________________________________
|
||||
|
||||
|
||||
RBDOOM-3-BFG Readme - https://github.com/RobertBeckebans/RBDOOM-3-BFG
|
||||
|
||||
Thank you for downloading RBDOOM-3-BFG.
|
||||
|
||||
|
||||
|
||||
_______________________________________
|
||||
|
||||
CONTENTS
|
||||
_______________________________
|
||||
|
||||
|
||||
|
||||
This file contains the following sections:
|
||||
|
||||
1) SYSTEM REQUIREMENT
|
||||
|
||||
2) GENERAL NOTES
|
||||
|
||||
3) LICENSE
|
||||
|
||||
4) GETTING THE SOURCE CODE
|
||||
|
||||
5) COMPILING ON WIN32 WITH VISUAL C++ 2013 EXPRESS EDITION
|
||||
|
||||
6) COMPILING ON GNU/LINUX
|
||||
|
||||
7) INSTALLATION, GETTING THE GAMEDATA, RUNNING THE GAME
|
||||
|
||||
8) OVERALL CHANGES
|
||||
|
||||
9) CONSOLE VARIABLES
|
||||
|
||||
10) KNOWN ISSUES
|
||||
|
||||
11) BUG REPORTS
|
||||
|
||||
12) GAME MODIFICATIONS
|
||||
|
||||
13) CODE LICENSE EXCEPTIONS
|
||||
|
||||
|
||||
|
||||
___________________________________
|
||||
|
||||
1) SYSTEM REQUIREMENTS
|
||||
__________________________
|
||||
|
||||
|
||||
|
||||
Minimum system requirements:
|
||||
|
||||
CPU: 2 GHz Intel compatible
|
||||
System Memory: 512MB
|
||||
Graphics card: Any graphics card that supports Direct3D 10 and OpenGL >= 3.2
|
||||
|
||||
Recommended system requirements:
|
||||
|
||||
CPU: 3 GHz + Intel compatible
|
||||
System Memory: 1024MB+
|
||||
Graphics card: Geforce 9600 GT, ATI HD 5650 or higher.
|
||||
|
||||
|
||||
|
||||
|
||||
_______________________________
|
||||
|
||||
2) GENERAL NOTES
|
||||
______________________
|
||||
|
||||
This release does not contain any game data, the game data is still
|
||||
covered by the original EULA and must be obeyed as usual.
|
||||
|
||||
You must patch the game to the latest version.
|
||||
|
||||
You can purchase Doom 3 BFG Edition from GOG (DRM Free):
|
||||
https://www.gog.com/game/doom_3_bfg_edition
|
||||
|
||||
Or the game can be purchased from Steam (with DRM):
|
||||
http://store.steampowered.com/app/208200/
|
||||
|
||||
Steam:
|
||||
------
|
||||
The Doom 3 BFG Edition GPL Source Code release does not include functionality for integrating with
|
||||
Steam. This includes roaming profiles, achievements, leaderboards, matchmaking, the overlay, or
|
||||
any other Steam features.
|
||||
|
||||
|
||||
Bink:
|
||||
-----
|
||||
The RBDoom3BFG Edition GPL Source Code release includes functionality for rendering Bink Videos through FFmpeg.
|
||||
|
||||
|
||||
Back End Rendering of Stencil Shadows:
|
||||
--------------------------------------
|
||||
|
||||
The Doom 3 BFG Edition GPL Source Code release does not include functionality enabling rendering
|
||||
of stencil shadows via the "depth fail" method, a functionality commonly known as "Carmack's Reverse".
|
||||
|
||||
|
||||
|
||||
_______________________________
|
||||
|
||||
3) LICENSE
|
||||
______________________
|
||||
|
||||
|
||||
See COPYING.txt for the GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
ADDITIONAL TERMS: The Doom 3 BFG Edition GPL Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU GPL which accompanied the Doom 3 BFG Edition GPL Source Code. If not, please request a copy in writing from id Software at id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
|
||||
____________________________________________
|
||||
|
||||
4) GETTING THE SOURCE CODE
|
||||
___________________________________
|
||||
|
||||
This project's GitHub.net Git repository can be checked out through Git with the following instruction set:
|
||||
|
||||
> git clone https://github.com/RobertBeckebans/RBDOOM-3-BFG.git
|
||||
|
||||
If you don't want to use git, you can download the source as a zip file at
|
||||
https://github.com/RobertBeckebans/RBDOOM-3-BFG/archive/master.zip
|
||||
|
||||
|
||||
|
||||
___________________________________________________________________
|
||||
|
||||
5) COMPILING ON WIN32 WITH VISUAL C++ 2013 EXPRESS EDITION
|
||||
__________________________________________________________
|
||||
|
||||
1. Download and install the Visual C++ 2013 Express Edition.
|
||||
|
||||
2. Download the DirectX SDK (June 2010) here:
|
||||
http://www.microsoft.com/en-us/download/details.aspx?id=6812
|
||||
|
||||
3. Download and install the latest CMake.
|
||||
|
||||
4. Generate the VC13 projects using CMake by doubleclicking a matching configuration .bat file in the neo/ folder.
|
||||
|
||||
5. Use the VC13 solution to compile what you need:
|
||||
RBDOOM-3-BFG/build/RBDoom3BFG.sln
|
||||
|
||||
6. Download ffmpeg-20151105-git-c878082-win32-shared.7z from ffmpeg.zeranoe.com/builds/win32/shared
|
||||
or
|
||||
ffmpeg-20151105-git-c878082-win64-shared.7z from ffmpeg.zeranoe.com/builds/win64/shared
|
||||
|
||||
7. Extract the FFmpeg DLLs to your current build directory under RBDOOM-3-BFG/build/
|
||||
|
||||
|
||||
__________________________________
|
||||
|
||||
6) COMPILING ON GNU/LINUX
|
||||
_________________________
|
||||
|
||||
|
||||
1. You need the following dependencies in order to compile RBDoom3BFG with all features:
|
||||
|
||||
On Debian or Ubuntu:
|
||||
|
||||
> apt-get install cmake libsdl2-dev libopenal-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev
|
||||
|
||||
On Fedora
|
||||
|
||||
// TODO add ffmpeg libs for bink videos
|
||||
|
||||
> yum install cmake SDL-devel openal-devel
|
||||
|
||||
On ArchLinux
|
||||
|
||||
> sudo pacman -S sdl2 ffmpeg openal cmake
|
||||
|
||||
On openSUSE (tested in 13.1)
|
||||
|
||||
> zypper in openal-soft-devel cmake libSDL-devel libffmpeg1-devel
|
||||
|
||||
For SDL 2 replace "libSDL-devel" with "libSDL2-devel".
|
||||
"libffmpeg1-devel" requires the PackMan repository. If you don't have that repo, and don't want to add it, remove the "libffmpeg1-devel" option and compile without ffmpeg support.
|
||||
If you have the repo and compiles with ffmpeg support, make sure you download "libffmpeg1-devel", and not "libffmpeg-devel".
|
||||
|
||||
Instead of SDL2 development files you can also use SDL1.2. Install SDL 1.2 and add to the cmake parameters -DSDL2=OFF
|
||||
|
||||
SDL2 has better input support (especially in the console) and better
|
||||
support for multiple displays (especially in fullscreen mode).
|
||||
|
||||
|
||||
2. Generate the Makefiles using CMake:
|
||||
|
||||
> cd neo/
|
||||
> ./cmake-eclipse-linux-profile.sh
|
||||
|
||||
3. Compile RBDOOM-3-BFG targets with
|
||||
|
||||
> cd ../build
|
||||
> make
|
||||
|
||||
___________________________________________________
|
||||
|
||||
7) INSTALLATION, GETTING THE GAMEDATA, RUNNING THE GAME
|
||||
__________________________________________
|
||||
|
||||
|
||||
If you use the prebuilt Win32 binaries then simply extract them to your
|
||||
C:\Program Files (x86)\Steam\SteamApps\common\Doom 3 BFG Edition\ directory and run RBDoom3BFG.exe.
|
||||
|
||||
|
||||
|
||||
|
||||
The following instructions are primarily intented for Linux users and all hackers on other operating systems.
|
||||
|
||||
To play the game, you need the game data from a legal copy of the game.
|
||||
|
||||
Currently this requires a Windows installer, whether that be the GOG installer or by using Steam for Windows.
|
||||
|
||||
Note: the original DVD release of Doom 3 BFG contains encrypted data that is decoded by Steam on install.
|
||||
|
||||
On Linux and OSX the easiest way to install is with SteamCMD: https://developer.valvesoftware.com/wiki/SteamCMD
|
||||
See the description on https://developer.valvesoftware.com/wiki/SteamCMD#Linux (OS X is directly below that) on how to install SteamCMD on your system. You won't have to create a new user.
|
||||
|
||||
Then you can download Doom 3 BFG with
|
||||
|
||||
> ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login <YOUR_STEAM_LOGIN_NAME> +force_install_dir ./doom3bfg/ +app_update 208200 validate +quit
|
||||
|
||||
(replace <YOUR_STEAM_LOGIN_NAME> with your steam login name)
|
||||
When it's done you should have the normal windows installation of Doom 3 BFG in ./doom3bfg/ and the needed files in ./doom3bfg/base/
|
||||
That number is the "AppID" of Doom 3 BFG; if you wanna use this to get the data of other games you own, you can look up the AppID at https://steamdb.info/
|
||||
|
||||
NOTE that we've previously recommended using download_depot in the Steam console to install the game data. That turned out to be unreliable and result in broken, unusable game data. So use SteamCMD instead, as described above.
|
||||
|
||||
Alternatively with the GOG installer, you can use Wine to install the game. See https://winehq.org/download for details on how to install wine for Linux and Mac.
|
||||
|
||||
Once Wine is installed and configured on your system install Doom 3 BFG edition using the downloaded installers from gog.com:
|
||||
|
||||
> wine setup_doom_3_bfg_1.14_\(13452\)_\(g\).exe
|
||||
|
||||
(there will be several .exe files from GOG, make sure all of them are in the same directory)
|
||||
|
||||
Once this is complete, by default you can find your Doom 3 BFG "base/" directory at ".wine/drive_c/GOG\ Games/DOOM\ 3\ BFG/base".
|
||||
|
||||
Note that you may want to add the following line to the bottom of the default.cfg in whatever "base/" directory you use:
|
||||
|
||||
> set sys_lang "english"
|
||||
|
||||
This will ensure the game and its menus are in english and don't default to something else. Alternatives include:
|
||||
|
||||
set sys_lang "english"
|
||||
set sys_lang "french"
|
||||
set sys_lang "german"
|
||||
set sys_lang "italian"
|
||||
set sys_lang "japanese"
|
||||
set sys_lang "spanish"
|
||||
|
||||
Anyway:
|
||||
|
||||
1. Install Doom 3 BFG in Steam (Windows version) or SteamCMD, make sure it's getting
|
||||
updated/patched.
|
||||
|
||||
2. Create your own Doom 3 BFG directory, e.g. /path/to/Doom3BFG/
|
||||
|
||||
3. Copy the game-data's base dir from Steam or GOG to that directory
|
||||
(e.g. /path/to/Doom3BFG/), it's in
|
||||
/your/path/to/Steam/steamapps/common/DOOM 3 BFG Edition/base/
|
||||
or, if you used SteamCMD or GOG installer with Wine, in the path you used above.
|
||||
|
||||
4. Copy your RBDoom3BFG executable that you created in 5) or 6) and the FFmpeg DLLs to your own
|
||||
Doom 3 BFG directory (/path/to/Doom3BFG).
|
||||
|
||||
Your own Doom 3 BFG directory now should look like:
|
||||
/path/to/Doom3BFG/
|
||||
-> RBDoom3BFG (or RBDoom3BFG.exe on Windows)
|
||||
-> avcodec-55.dll
|
||||
-> avdevice-55.dll
|
||||
-> avfilter-4.dll
|
||||
-> avformat-55.dll
|
||||
-> avutil-52.dll
|
||||
-> postproc-52.dll
|
||||
-> swresample-0.dll
|
||||
-> swscale-2.dll
|
||||
-> base/
|
||||
-> classicmusic/
|
||||
-> _common.crc
|
||||
-> (etc)
|
||||
|
||||
5. Run the game by executing the RBDoom3BFG executable.
|
||||
|
||||
6. Enjoy
|
||||
|
||||
7. If you run into bugs, please report them, see 11)
|
||||
|
||||
___________________________________________________
|
||||
|
||||
8) OVERALL CHANGES
|
||||
__________________________________________
|
||||
|
||||
- Flexible build system using CMake
|
||||
|
||||
- Linux support (32 and 64 bit)
|
||||
|
||||
- Win64 support
|
||||
|
||||
- OS X support
|
||||
|
||||
- OpenAL Soft sound backend primarily developed for Linux but works on Windows as well
|
||||
|
||||
- Bink video support through FFmpeg
|
||||
|
||||
- PNG image support
|
||||
|
||||
- Soft shadows using PCF hardware shadow mapping
|
||||
|
||||
The implementation uses sampler2DArrayShadow and PCF which usually
|
||||
requires Direct3D 10.1 however it is in the OpenGL 3.2 core so it should
|
||||
be widely supported.
|
||||
All 3 light types are supported which means parallel lights (sun) use
|
||||
scene independent cascaded shadow mapping.
|
||||
The implementation is very fast with single taps (400 fps average per
|
||||
scene on a GTX 660 ti OC) however I defaulted it to 12 taps using a Poisson disc algorithm so the shadows look
|
||||
really good which should give you stable 100 fps on todays hardware (2014).
|
||||
|
||||
- Changed light interaction shaders to use Half-Lambert lighting like in Half-Life 2 to
|
||||
make the game less dark. https://developer.valvesoftware.com/wiki/Half_Lambert
|
||||
|
||||
- True 64 bit HDR lighting with adaptive tone mapping and gamma-correct rendering in linear RGB space
|
||||
|
||||
- Enhanced Subpixel Morphological Antialiasing
|
||||
For more information see "Anti-Aliasing Methods in CryENGINE 3" and the docs at http://www.iryoku.com/smaa/
|
||||
|
||||
- Filmic post process effects like Technicolor color grading and film grain
|
||||
|
||||
- Additional ambient render pass to make the game less dark similar to the Quake 4 r_forceAmbient technique
|
||||
|
||||
___________________________________________________
|
||||
|
||||
9) CONSOLE VARIABLES
|
||||
__________________________________________
|
||||
|
||||
r_antiAliasing - Different Anti-Aliasing modes
|
||||
|
||||
r_useShadowMapping [0 or 1] - Use soft shadow mapping instead of hard stencil shadows
|
||||
|
||||
r_useHDR [0 or 1] - Use High Dynamic Range lighting
|
||||
|
||||
r_hdrAutoExposure [0 or 1] - Adaptive tonemapping with HDR
|
||||
This allows to have very bright or very dark scenes but the camera will adopt to it so the scene won't loose details
|
||||
|
||||
r_exposure [0 .. 1] - Default 0.5, Controls brightness and affects HDR exposure key
|
||||
This is what you change in the video brightness options
|
||||
|
||||
r_useSSAO [0 .. 1] - Use Screen Space Ambient Occlusion to darken the corners in the scene
|
||||
|
||||
r_useFilmicPostProcessEffects [0 or 1] - Apply several post process effects to mimic a filmic look"
|
||||
|
||||
|
||||
___________________________________________________
|
||||
|
||||
10) KNOWN ISSUES
|
||||
__________________________________________
|
||||
|
||||
- HDR does not work with old-school stencil shadows
|
||||
|
||||
- MSAA anti-aliasing modes don't work with HDR: Use SMAA
|
||||
|
||||
- Some lights cause shadow acne with shadow mapping
|
||||
|
||||
- Some shadows might almost disappear due to the shadow filtering
|
||||
|
||||
___________________________________________________
|
||||
|
||||
11) BUG REPORTS
|
||||
__________________________________________
|
||||
|
||||
RBDOOM-3-BFG is not perfect, it is not bug free as every other software.
|
||||
For fixing as much problems as possible we need as much bug reports as possible.
|
||||
We cannot fix anything if we do not know about the problems.
|
||||
|
||||
The best way for telling us about a bug is by submitting a bug report at our GitHub bug tracker page:
|
||||
|
||||
https://github.com/RobertBeckebans/RBDOOM-3-BFG/issues?state=open
|
||||
|
||||
The most important fact about this tracker is that we cannot simply forget to fix the bugs which are posted there.
|
||||
It is also a great way to keep track of fixed stuff.
|
||||
|
||||
If you want to report an issue with the game, you should make sure that your report includes all information useful to characterize and reproduce the bug.
|
||||
|
||||
* Search on Google
|
||||
* Include the computer's hardware and software description ( CPU, RAM, 3D Card, distribution, kernel etc. )
|
||||
* If appropriate, send a console log, a screenshot, an strace ..
|
||||
* If you are sending a console log, make sure to enable developer output:
|
||||
|
||||
RBDoom3BFG.exe +set developer 1 +set logfile 2
|
||||
|
||||
You can find your qconsole.log on Windows in C:\Users\<your user name>\Saved Games\id Software\RBDOOM 3 BFG\base\
|
||||
|
||||
NOTE: We cannot help you with OS-specific issues like configuring OpenGL correctly, configuring ALSA or configuring the network.
|
||||
|
||||
|
||||
___________________________________________________
|
||||
|
||||
12) GAME MODIFCATIONS
|
||||
__________________________________________
|
||||
|
||||
The Doom 3 BFG Edition GPL Source Code release allows mod editing, in order for it to accept any change in your
|
||||
mod directory, you should first specify your mod directory adding the following command to the launcher:
|
||||
|
||||
"+set fs_game modDirectoryName"
|
||||
|
||||
so it would end up looking like: RBDoom3BFG +set fs_game modDirectoryName
|
||||
|
||||
|
||||
IMPORTANT: RBDOOM-3-BFG does not support old Doom 3 modiciations that include sourcecode modifications in binary form (.dll)
|
||||
You can fork RBDOOM-3-BFG and create a new renamed binary that includes all required C++ game code modifications.
|
||||
|
||||
____________________________________________________________________________________
|
||||
|
||||
13) CODE LICENSE EXCEPTIONS - The parts that are not covered by the GPL:
|
||||
_______________________________________________________________________
|
||||
|
||||
|
||||
EXCLUDED CODE: The code described below and contained in the Doom 3 BFG Edition GPL Source Code release
|
||||
is not part of the Program covered by the GPL and is expressly excluded from its terms.
|
||||
You are solely responsible for obtaining from the copyright holder a license for such code and complying with the applicable license terms.
|
||||
|
||||
|
||||
JPEG library
|
||||
-----------------------------------------------------------------------------
|
||||
neo/libs/jpeg-6/*
|
||||
|
||||
Copyright (C) 1991-1995, Thomas G. Lane
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
NOTE: unfortunately the README that came with our copy of the library has
|
||||
been lost, so the one from release 6b is included instead. There are a few
|
||||
'glue type' modifications to the library to make it easier to use from
|
||||
the engine, but otherwise the dependency can be easily cleaned up to a
|
||||
better release of the library.
|
||||
|
||||
zlib library
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/zlib/*
|
||||
|
||||
Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Base64 implementation
|
||||
---------------------------------------------------------------------------
|
||||
neo/idlib/Base64.cpp
|
||||
|
||||
Copyright (c) 1996 Lars Wirzenius. All rights reserved.
|
||||
|
||||
June 14 2003: TTimo <ttimo@idsoftware.com>
|
||||
modified + endian bug fixes
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=197039
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
IO for (un)compress .zip files using zlib
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/zlib/minizip/*
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
MD4 Message-Digest Algorithm
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/MD4.cpp
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD4 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD4 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
|
||||
MD5 Message-Digest Algorithm
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/MD5.cpp
|
||||
This code implements the MD5 message-digest algorithm.
|
||||
The algorithm is due to Ron Rivest. This code was
|
||||
written by Colin Plumb in 1993, no copyright is claimed.
|
||||
This code is in the public domain; do with it what you wish.
|
||||
|
||||
CRC32 Checksum
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/CRC32.cpp
|
||||
Copyright (C) 1995-1998 Mark Adler
|
||||
|
||||
OpenGL headers
|
||||
---------------------------------------------------------------------------
|
||||
neo/renderer/OpenGL/glext.h
|
||||
neo/renderer/OpenGL/wglext.h
|
||||
|
||||
Copyright (c) 2007-2012 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
Timidity
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/timidity/*
|
||||
|
||||
Copyright (c) 1995 Tuukka Toivonen
|
||||
|
||||
From http://www.cgs.fi/~tt/discontinued.html :
|
||||
|
||||
If you'd like to continue hacking on TiMidity, feel free. I'm
|
||||
hereby extending the TiMidity license agreement: you can now
|
||||
select the most convenient license for your needs from (1) the
|
||||
GNU GPL, (2) the GNU LGPL, or (3) the Perl Artistic License.
|
||||
|
||||
|
||||
libbinkdec
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/libbinkdec/*
|
||||
|
||||
Copyright (C) 2011 Barry Duncan
|
||||
|
||||
Based on Bink video decoder from FFmpeg
|
||||
|
||||
Copyright (C) 2009 Konstantin Shishkov
|
||||
Copyright (C) 2011 Peter Ross <pross@xvid.org>
|
||||
|
||||
And generic Code from FFmpeg
|
||||
|
||||
Copyright (C) 2000-2011 FFmpeg team, http://www.ffmpeg.org
|
||||
|
||||
libbinkdec and (the used parts of) FFmpeg are released under LGPL v2.1:
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
(You can find the whole license text on https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
or in neo/libs/libbinkdec/COPYING)
|
230
docs/CODE_LICENSE_EXCEPTIONS.md
Normal file
230
docs/CODE_LICENSE_EXCEPTIONS.md
Normal file
|
@ -0,0 +1,230 @@
|
|||
CODE LICENSE EXCEPTIONS - The parts that are not covered by the GPL:
|
||||
|
||||
EXCLUDED CODE: The code described below and contained in the Doom 3 BFG Edition GPL Source Code release
|
||||
is not part of the Program covered by the GPL and is expressly excluded from its terms.
|
||||
You are solely responsible for obtaining from the copyright holder a license for such code and complying with the applicable license terms.
|
||||
|
||||
|
||||
JPEG library
|
||||
-----------------------------------------------------------------------------
|
||||
neo/libs/jpeg-6/*
|
||||
|
||||
Copyright (C) 1991-1995, Thomas G. Lane
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
NOTE: unfortunately the README that came with our copy of the library has
|
||||
been lost, so the one from release 6b is included instead. There are a few
|
||||
'glue type' modifications to the library to make it easier to use from
|
||||
the engine, but otherwise the dependency can be easily cleaned up to a
|
||||
better release of the library.
|
||||
|
||||
zlib library
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/zlib/*
|
||||
|
||||
Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Base64 implementation
|
||||
---------------------------------------------------------------------------
|
||||
neo/idlib/Base64.cpp
|
||||
|
||||
Copyright (c) 1996 Lars Wirzenius. All rights reserved.
|
||||
|
||||
June 14 2003: TTimo <ttimo@idsoftware.com>
|
||||
modified + endian bug fixes
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=197039
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
IO for (un)compress .zip files using zlib
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/zlib/minizip/*
|
||||
|
||||
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
||||
|
||||
Modifications of Unzip for Zip64
|
||||
Copyright (C) 2007-2008 Even Rouault
|
||||
|
||||
Modifications for Zip64 support
|
||||
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
MD4 Message-Digest Algorithm
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/MD4.cpp
|
||||
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD4 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD4 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
|
||||
MD5 Message-Digest Algorithm
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/MD5.cpp
|
||||
This code implements the MD5 message-digest algorithm.
|
||||
The algorithm is due to Ron Rivest. This code was
|
||||
written by Colin Plumb in 1993, no copyright is claimed.
|
||||
This code is in the public domain; do with it what you wish.
|
||||
|
||||
CRC32 Checksum
|
||||
-----------------------------------------------------------------------------
|
||||
neo/idlib/hashing/CRC32.cpp
|
||||
Copyright (C) 1995-1998 Mark Adler
|
||||
|
||||
OpenGL headers
|
||||
---------------------------------------------------------------------------
|
||||
neo/renderer/OpenGL/glext.h
|
||||
neo/renderer/OpenGL/wglext.h
|
||||
|
||||
Copyright (c) 2007-2012 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
Timidity
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/timidity/*
|
||||
|
||||
Copyright (c) 1995 Tuukka Toivonen
|
||||
|
||||
From http://www.cgs.fi/~tt/discontinued.html :
|
||||
|
||||
If you'd like to continue hacking on TiMidity, feel free. I'm
|
||||
hereby extending the TiMidity license agreement: you can now
|
||||
select the most convenient license for your needs from (1) the
|
||||
GNU GPL, (2) the GNU LGPL, or (3) the Perl Artistic License.
|
||||
|
||||
|
||||
libbinkdec
|
||||
---------------------------------------------------------------------------
|
||||
neo/libs/libbinkdec/*
|
||||
|
||||
Copyright (C) 2011 Barry Duncan
|
||||
|
||||
Based on Bink video decoder from FFmpeg
|
||||
|
||||
Copyright (C) 2009 Konstantin Shishkov
|
||||
Copyright (C) 2011 Peter Ross <pross@xvid.org>
|
||||
|
||||
And generic Code from FFmpeg
|
||||
|
||||
Copyright (C) 2000-2011 FFmpeg team, http://www.ffmpeg.org
|
||||
|
||||
libbinkdec and (the used parts of) FFmpeg are released under LGPL v2.1:
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
(You can find the whole license text on https://www.gnu.org/licenses/lgpl-2.1.html
|
||||
or in neo/libs/libbinkdec/COPYING)
|
|
@ -360,8 +360,8 @@ file(GLOB_RECURSE CM_SOURCES cm/*.cpp)
|
|||
file(GLOB FRAMEWORK_INCLUDES framework/*.h)
|
||||
file(GLOB FRAMEWORK_SOURCES framework/*.cpp)
|
||||
|
||||
file(GLOB FRAMEWORK_ASYNC_INCLUDES framework/async/*.h)
|
||||
file(GLOB FRAMEWORK_ASYNC_SOURCES framework/async/*.cpp)
|
||||
file(GLOB FRAMEWORK_IMGUI_INCLUDES imgui/*.h)
|
||||
file(GLOB FRAMEWORK_IMGUI_SOURCES imgui/*.cpp)
|
||||
|
||||
file(GLOB RENDERER_INCLUDES renderer/*.h)
|
||||
file(GLOB RENDERER_SOURCES renderer/*.cpp)
|
||||
|
@ -391,6 +391,9 @@ file(GLOB SHADERS ../base/renderprogs/*.hlsl ../base/renderprogs/*.inc )
|
|||
file(GLOB IRRXML_INCLUDES libs/irrxml/src/*.h)
|
||||
file(GLOB IRRXML_SOURCES libs/irrxml/src/*.cpp)
|
||||
|
||||
file(GLOB IMGUI_INCLUDES libs/imgui/*.h)
|
||||
file(GLOB IMGUI_SOURCES libs/imgui/*.cpp)
|
||||
|
||||
if (NOT JPEG_FOUND)
|
||||
set(JPEG_INCLUDES
|
||||
libs/jpeg-6/jchuff.h
|
||||
|
@ -823,6 +826,12 @@ file(GLOB EDITOR_SCRIPT_SOURCES tools/script/*.cpp)
|
|||
file(GLOB EDITOR_SOUND_INCLUDES tools/sound/*.h)
|
||||
file(GLOB EDITOR_SOUND_SOURCES tools/sound/*.cpp)
|
||||
|
||||
file(GLOB IMGUI_EDITOR_INCLUDES tools/imgui/*.h)
|
||||
file(GLOB IMGUI_EDITOR_SOURCES tools/imgui/*.cpp)
|
||||
|
||||
file(GLOB IMGUI_EDITOR_LIGHT_INCLUDES tools/imgui/lighteditor/*.h)
|
||||
file(GLOB IMGUI_EDITOR_LIGHT_SOURCES tools/imgui/lighteditor/*.cpp)
|
||||
|
||||
file(GLOB DOOMCLASSIC_INCLUDES ../doomclassic/doom/*.h)
|
||||
file(GLOB DOOMCLASSIC_SOURCES ../doomclassic/doom/*.cpp)
|
||||
|
||||
|
@ -946,8 +955,8 @@ source_group("cm" FILES ${CM_SOURCES})
|
|||
source_group("framework" FILES ${FRAMEWORK_INCLUDES})
|
||||
source_group("framework" FILES ${FRAMEWORK_SOURCES})
|
||||
|
||||
source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_INCLUDES})
|
||||
source_group("framework\\async" FILES ${FRAMEWORK_ASYNC_SOURCES})
|
||||
source_group("imgui" FILES ${FRAMEWORK_IMGUI_INCLUDES})
|
||||
source_group("imgui" FILES ${FRAMEWORK_IMGUI_SOURCES})
|
||||
|
||||
source_group("renderer" FILES ${RENDERER_INCLUDES})
|
||||
source_group("renderer" FILES ${RENDERER_SOURCES})
|
||||
|
@ -983,6 +992,9 @@ source_group("renderer\\Shaders" FILES ${SHADERS})
|
|||
source_group("libs\\irrxml" FILES ${IRRXML_INCLUDES})
|
||||
source_group("libs\\irrxml" FILES ${IRRXML_SOURCES})
|
||||
|
||||
source_group("libs\\imgui" FILES ${IMGUI_INCLUDES})
|
||||
source_group("libs\\imgui" FILES ${IMGUI_SOURCES})
|
||||
|
||||
source_group("libs\\jpeg-6" FILES ${JPEG_INCLUDES})
|
||||
source_group("libs\\jpeg-6" FILES ${JPEG_SOURCES})
|
||||
|
||||
|
@ -1133,6 +1145,12 @@ source_group("tools\\script" FILES ${EDITOR_SCRIPT_SOURCES})
|
|||
source_group("tools\\sound" FILES ${EDITOR_SOUND_INCLUDES})
|
||||
source_group("tools\\sound" FILES ${EDITOR_SOUND_SOURCES})
|
||||
|
||||
source_group("tools\\imgui" FILES ${IMGUI_EDITOR_INCLUDES})
|
||||
source_group("tools\\imgui" FILES ${IMGUI_EDITOR_SOURCES})
|
||||
|
||||
source_group("tools\\imgui\\lighteditor" FILES ${IMGUI_EDITOR_LIGHT_INCLUDES})
|
||||
source_group("tools\\imgui\\lighteditor" FILES ${IMGUI_EDITOR_LIGHT_SOURCES})
|
||||
|
||||
|
||||
set(RBDOOM3_INCLUDES
|
||||
${AAS_INCLUDES}
|
||||
|
@ -1150,6 +1168,8 @@ set(RBDOOM3_INCLUDES
|
|||
${SHADERS}
|
||||
${RENDERER_SMAA_INCLUDES}
|
||||
${IRRXML_INCLUDES}
|
||||
${FRAMEWORK_IMGUI_INCLUDES}
|
||||
${IMGUI_INCLUDES}
|
||||
${JPEG_INCLUDES}
|
||||
${PNG_INCLUDES}
|
||||
${ZLIB_INCLUDES}
|
||||
|
@ -1169,8 +1189,10 @@ set(RBDOOM3_INCLUDES
|
|||
${COMPILER_INCLUDES}
|
||||
${COMPILER_AAS_INCLUDES} ${COMPILER_AAS_SOURCES}
|
||||
${COMPILER_DMAP_INCLUDES} ${COMPILER_DMAP_SOURCES}
|
||||
#${COMPILER_RENDERBUMP_INCLUDES} ${COMPILER_RENDERBUMP_SOURCES}
|
||||
#${COMPILER_ROQVQ_INCLUDES} ${COMPILER_ROQVQ_SOURCES}
|
||||
|
||||
${TOOLS_INCLUDES}
|
||||
${IMGUI_EDITOR_INCLUDES}
|
||||
${IMGUI_EDITOR_LIGHT_INCLUDES}
|
||||
)
|
||||
|
||||
set(RBDOOM3_SOURCES
|
||||
|
@ -1186,6 +1208,8 @@ set(RBDOOM3_SOURCES
|
|||
${RENDERER_JOBS_PRELIGHTSHADOWVOLUME_SOURCES}
|
||||
${RENDERER_JOBS_STATICSHADOWVOLUME_SOURCES}
|
||||
${IRRXML_SOURCES}
|
||||
${FRAMEWORK_IMGUI_SOURCES}
|
||||
${IMGUI_SOURCES}
|
||||
${JPEG_SOURCES}
|
||||
${PNG_SOURCES}
|
||||
${ZLIB_SOURCES}
|
||||
|
@ -1203,8 +1227,9 @@ set(RBDOOM3_SOURCES
|
|||
|
||||
${COMPILER_AAS_SOURCES}
|
||||
${COMPILER_DMAP_SOURCES}
|
||||
#${COMPILER_RENDERBUMP_SOURCES}
|
||||
#${COMPILER_ROQVQ_SOURCES}
|
||||
|
||||
${IMGUI_EDITOR_SOURCES}
|
||||
${IMGUI_EDITOR_LIGHT_SOURCES}
|
||||
)
|
||||
|
||||
add_definitions(-DUSE_DOOMCLASSIC)
|
||||
|
@ -1376,7 +1401,6 @@ if(MSVC)
|
|||
add_definitions(-DUSE_MFC_TOOLS)
|
||||
|
||||
list(APPEND RBDOOM3_SOURCES
|
||||
${TOOLS_INCLUDES}
|
||||
${TOOLS_COMAFX_INCLUDES} ${TOOLS_COMAFX_SOURCES}
|
||||
${TOOLS_COMMON_INCLUDES} ${TOOLS_COMMON_SOURCES}
|
||||
${TOOLS_COMMON_PROPTREE_INCLUDES} ${TOOLS_COMMON_PROPTREE_SOURCES}
|
||||
|
@ -1405,7 +1429,7 @@ if(MSVC)
|
|||
|
||||
if(USE_PRECOMPILED_HEADERS)
|
||||
set(RBDOOM3_PRECOMPILED_SOURCES ${RBDOOM3_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES} ${IMGUI_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libs/zlib/minizip/ioapi.c)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTDecoder.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTEncoder.cpp)
|
||||
|
@ -1559,7 +1583,7 @@ else()
|
|||
|
||||
if(USE_PRECOMPILED_HEADERS)
|
||||
set(RBDOOM3_PRECOMPILED_SOURCES ${RBDOOM3_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${TIMIDITY_SOURCES} ${JPEG_SOURCES} ${PNG_SOURCES} ${ZLIB_SOURCES} ${GLEW_SOURCES} ${BINKDEC_SOURCES} ${IMGUI_SOURCES})
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libs/zlib/minizip/ioapi.c)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTDecoder.cpp)
|
||||
list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/DXT/DXTEncoder.cpp)
|
||||
|
|
|
@ -1185,7 +1185,18 @@ void idGameEdit::MapCopyDictToEntity( const char* name, const idDict* dict ) con
|
|||
const idKeyValue* kv = dict->GetKeyVal( i );
|
||||
const char* key = kv->GetKey();
|
||||
const char* val = kv->GetValue();
|
||||
mapent->epairs.Set( key, val );
|
||||
|
||||
// DG: if val is "", delete key from the entity
|
||||
// => same behavior as EntityChangeSpawnArgs()
|
||||
if( val[0] == '\0' )
|
||||
{
|
||||
mapent->epairs.Delete( key );
|
||||
}
|
||||
else
|
||||
{
|
||||
mapent->epairs.Set( key, val );
|
||||
}
|
||||
// DG end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -958,6 +958,14 @@ idLight::ShowEditingDialog
|
|||
*/
|
||||
void idLight::ShowEditingDialog()
|
||||
{
|
||||
if( g_editEntityMode.GetInteger() == 1 )
|
||||
{
|
||||
common->InitTool( EDITOR_LIGHT, &spawnArgs , this );
|
||||
}
|
||||
else
|
||||
{
|
||||
common->InitTool( EDITOR_SOUND, &spawnArgs, this );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -347,6 +347,36 @@ void idCommonLocal::StartupVariable( const char* match )
|
|||
}
|
||||
}
|
||||
|
||||
// DG: add doom3 tools
|
||||
/*
|
||||
=================
|
||||
idCommonLocal::InitTool
|
||||
=================
|
||||
*/
|
||||
void idCommonLocal::InitTool( const toolFlag_t tool, const idDict* dict, idEntity* entity )
|
||||
{
|
||||
#if defined(USE_MFC_TOOLS)
|
||||
if( tool & EDITOR_SOUND )
|
||||
{
|
||||
//SoundEditorInit( dict ); // TODO: implement this somewhere
|
||||
}
|
||||
else if( tool & EDITOR_PARTICLE )
|
||||
{
|
||||
//ParticleEditorInit( dict );
|
||||
}
|
||||
else if( tool & EDITOR_AF )
|
||||
{
|
||||
//AFEditorInit( dict );
|
||||
}
|
||||
#else
|
||||
if( tool & EDITOR_LIGHT )
|
||||
{
|
||||
ImGuiTools::LightEditorInit( dict, entity );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// DG end
|
||||
|
||||
/*
|
||||
==================
|
||||
idCommonLocal::AddStartupCommands
|
||||
|
@ -518,6 +548,7 @@ CONSOLE_COMMAND( printMemInfo, "prints memory debugging data", NULL )
|
|||
fileSystem->CloseFile( f );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
Com_Error_f
|
||||
|
@ -1502,6 +1533,9 @@ void idCommonLocal::Shutdown()
|
|||
delete loadGUI;
|
||||
loadGUI = NULL;
|
||||
|
||||
printf( "ImGuiHook::Destroy();\n" );
|
||||
ImGuiHook::Destroy();
|
||||
|
||||
printf( "delete renderWorld;\n" );
|
||||
delete renderWorld;
|
||||
renderWorld = NULL;
|
||||
|
@ -1857,6 +1891,11 @@ bool idCommonLocal::ProcessEvent( const sysEvent_t* event )
|
|||
return true;
|
||||
}
|
||||
|
||||
if( ImGuiHook::InjectSysEvent( event ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// if we aren't in a game, force the console to take it
|
||||
if( !mapSpawned )
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ ID_INLINE int MSEC_ALIGN_TO_FRAME( int msec )
|
|||
}
|
||||
|
||||
class idGame;
|
||||
class idEntity;
|
||||
class idRenderWorld;
|
||||
class idSoundWorld;
|
||||
class idSession;
|
||||
|
@ -232,6 +233,9 @@ public:
|
|||
// only a set with the exact name.
|
||||
virtual void StartupVariable( const char* match ) = 0;
|
||||
|
||||
// Initializes a tool with the given dictionary.
|
||||
virtual void InitTool( const toolFlag_t tool, const idDict* dict, idEntity* entity ) = 0;
|
||||
|
||||
// Begins redirection of console output to the given buffer.
|
||||
virtual void BeginRedirect( char* buffer, int buffersize, void ( *flush )( const char* ) ) = 0;
|
||||
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
// virtual void UpdateLevelLoadPacifier( bool Secondary );
|
||||
// virtual void UpdateLevelLoadPacifier( bool updateSecondary, int mProgress );
|
||||
virtual void StartupVariable( const char* match );
|
||||
virtual void InitTool( const toolFlag_t tool, const idDict* dict, idEntity* entity );
|
||||
virtual void WriteConfigToFile( const char* filename );
|
||||
virtual void BeginRedirect( char* buffer, int buffersize, void ( *flush )( const char* ) );
|
||||
virtual void EndRedirect();
|
||||
|
|
|
@ -1384,6 +1384,9 @@ void idUsercmdGenLocal::Mouse()
|
|||
break;
|
||||
case M_DELTAZ: // mouse wheel, may have multiple clicks
|
||||
{
|
||||
// DG: this seems like a good place to inject mousewheel deltas into ImGui
|
||||
ImGuiHook::InjectMouseWheel( value );
|
||||
|
||||
int key = value < 0 ? K_MWHEELDOWN : K_MWHEELUP;
|
||||
value = abs( value );
|
||||
while( value-- > 0 )
|
||||
|
|
|
@ -524,6 +524,9 @@ void idCommonLocal::Frame()
|
|||
|
||||
renderSystem->OnFrame();
|
||||
|
||||
// DG: prepare new ImGui frame - I guess this is a good place, as all new events should be available?
|
||||
ImGuiHook::NewFrame();
|
||||
|
||||
// Activate the shell if it's been requested
|
||||
if( showShellRequested && game )
|
||||
{
|
||||
|
@ -538,7 +541,7 @@ void idCommonLocal::Frame()
|
|||
// RB begin
|
||||
#if defined(USE_DOOMCLASSIC)
|
||||
if( com_pause.GetInteger() || console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing()
|
||||
|| ( game && game->InhibitControls() && !IsPlayingDoomClassic() ) )
|
||||
|| ( game && game->InhibitControls() && !IsPlayingDoomClassic() ) || ImGuiTools::ReleaseMouseForTools() )
|
||||
#else
|
||||
if( com_pause.GetInteger() || console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing()
|
||||
|| ( game && game->InhibitControls() ) )
|
||||
|
@ -546,7 +549,7 @@ void idCommonLocal::Frame()
|
|||
// RB end, DG end
|
||||
{
|
||||
// RB: don't release the mouse when opening a PDA or menu
|
||||
if( console->Active() )
|
||||
if( console->Active() || ImGuiTools::ReleaseMouseForTools() )
|
||||
{
|
||||
Sys_GrabMouseCursor( false );
|
||||
}
|
||||
|
|
|
@ -144,6 +144,14 @@ const uint32 NUM_FRAME_DATA = 2;
|
|||
#include "../sys/sys_achievements.h"
|
||||
|
||||
// tools
|
||||
|
||||
// The editor entry points are always declared, but may just be
|
||||
// stubbed out on non-windows platforms.
|
||||
//#if defined(USE_MFC_TOOLS) || defined(USE_QT_TOOLS) || defined(USE_GTK_TOOLS)
|
||||
#include "../imgui/ImGui_Hooks.h"
|
||||
#include "../tools/edit_public.h"
|
||||
//#endif
|
||||
|
||||
#include "../tools/compilers/compiler_public.h"
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
|
24
neo/imgui/BFGimgui.h
Normal file
24
neo/imgui/BFGimgui.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
#ifndef NEO_IMGUI_BFGIMGUI_H_
|
||||
#define NEO_IMGUI_BFGIMGUI_H_
|
||||
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
|
||||
#include "../idlib/math/Vector.h"
|
||||
|
||||
// add custom functions for imgui
|
||||
namespace ImGui
|
||||
{
|
||||
|
||||
bool DragVec3( const char* label, idVec3& v, float v_speed = 1.0f,
|
||||
float v_min = 0.0f, float v_max = 0.0f,
|
||||
const char* display_format = "%.1f",
|
||||
float power = 1.0f, bool ignoreLabelWidth = true );
|
||||
|
||||
bool DragVec3fitLabel( const char* label, idVec3& v, float v_speed = 1.0f,
|
||||
float v_min = 0.0f, float v_max = 0.0f,
|
||||
const char* display_format = "%.1f", float power = 1.0f );
|
||||
|
||||
}
|
||||
|
||||
#endif /* NEO_IMGUI_BFGIMGUI_H_ */
|
426
neo/imgui/BFGimguiImpl.cpp
Normal file
426
neo/imgui/BFGimguiImpl.cpp
Normal file
|
@ -0,0 +1,426 @@
|
|||
/*
|
||||
* ImGui integration into Doom3BFG/OpenTechEngine.
|
||||
* Based on ImGui SDL and OpenGL3 examples.
|
||||
* Copyright (c) 2014-2015 Omar Cornut and ImGui contributors
|
||||
*
|
||||
* Doom3-specific Code (and ImGui::DragXYZ(), based on ImGui::DragFloatN())
|
||||
* Copyright (C) 2015 Daniel Gibson
|
||||
*
|
||||
* This file is under MIT License, like the original code from ImGui.
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "BFGimgui.h"
|
||||
#include "renderer/RenderCommon.h"
|
||||
#include "renderer/RenderBackend.h"
|
||||
|
||||
|
||||
idCVar imgui_showDemoWindow( "imgui_showDemoWindow", "0", CVAR_GUI | CVAR_BOOL, "show big ImGui demo window" );
|
||||
|
||||
// our custom ImGui functions from BFGimgui.h
|
||||
|
||||
// like DragFloat3(), but with "X: ", "Y: " or "Z: " prepended to each display_format, for vectors
|
||||
// if !ignoreLabelWidth, it makes sure the label also fits into the current item width.
|
||||
// note that this screws up alignment with consecutive "value+label widgets" (like Drag* or ColorEdit*)
|
||||
bool ImGui::DragVec3( const char* label, idVec3& v, float v_speed,
|
||||
float v_min, float v_max, const char* display_format, float power, bool ignoreLabelWidth )
|
||||
{
|
||||
bool value_changed = false;
|
||||
ImGui::BeginGroup();
|
||||
ImGui::PushID( label );
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
float wholeWidth = ImGui::CalcItemWidth() - 2.0f * style.ItemSpacing.x;
|
||||
float spacing = style.ItemInnerSpacing.x;
|
||||
float labelWidth = ignoreLabelWidth ? 0.0f : ( ImGui::CalcTextSize( label, NULL, true ).x + spacing );
|
||||
float coordWidth = ( wholeWidth - labelWidth - 2.0f * spacing ) * ( 1.0f / 3.0f ); // width of one x/y/z dragfloat
|
||||
|
||||
ImGui::PushItemWidth( coordWidth );
|
||||
for( int i = 0; i < 3; i++ )
|
||||
{
|
||||
ImGui::PushID( i );
|
||||
char format[64];
|
||||
idStr::snPrintf( format, sizeof( format ), "%c: %s", "XYZ"[i], display_format );
|
||||
value_changed |= ImGui::DragFloat( "##v", &v[i], v_speed, v_min, v_max, format, power );
|
||||
|
||||
ImGui::PopID();
|
||||
ImGui::SameLine( 0.0f, spacing );
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
ImGui::PopID();
|
||||
|
||||
const char* labelEnd = strstr( label, "##" );
|
||||
ImGui::TextUnformatted( label, labelEnd );
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
// shortcut for DragXYZ with ignorLabelWidth = false
|
||||
// very similar, but adjusts width to width of label to make sure it's not cut off
|
||||
// sometimes useful, but might not align with consecutive "value+label widgets" (like Drag* or ColorEdit*)
|
||||
bool ImGui::DragVec3fitLabel( const char* label, idVec3& v, float v_speed,
|
||||
float v_min, float v_max, const char* display_format, float power )
|
||||
{
|
||||
return ImGui::DragVec3( label, v, v_speed, v_min, v_max, display_format, power, false );
|
||||
}
|
||||
|
||||
// the ImGui hooks to integrate it into the engine
|
||||
|
||||
|
||||
|
||||
namespace ImGuiHook
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
bool g_IsInit = false;
|
||||
double g_Time = 0.0f;
|
||||
bool g_MousePressed[5] = { false, false, false, false, false };
|
||||
float g_MouseWheel = 0.0f;
|
||||
ImVec2 g_MousePos = ImVec2( -1.0f, -1.0f ); //{-1.0f, -1.0f};
|
||||
ImVec2 g_DisplaySize = ImVec2( 0.0f, 0.0f ); //{0.0f, 0.0f};
|
||||
|
||||
|
||||
|
||||
bool g_haveNewFrame = false;
|
||||
|
||||
bool HandleKeyEvent( const sysEvent_t& keyEvent )
|
||||
{
|
||||
assert( keyEvent.evType == SE_KEY );
|
||||
|
||||
keyNum_t keyNum = static_cast<keyNum_t>( keyEvent.evValue );
|
||||
bool pressed = keyEvent.evValue2 > 0;
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if( keyNum < K_JOY1 )
|
||||
{
|
||||
// keyboard input as direct input scancodes
|
||||
io.KeysDown[keyNum] = pressed;
|
||||
|
||||
io.KeyAlt = usercmdGen->KeyState( K_LALT ) == 1 || usercmdGen->KeyState( K_RALT ) == 1;
|
||||
io.KeyCtrl = usercmdGen->KeyState( K_LCTRL ) == 1 || usercmdGen->KeyState( K_RCTRL ) == 1;
|
||||
io.KeyShift = usercmdGen->KeyState( K_LSHIFT ) == 1 || usercmdGen->KeyState( K_RSHIFT ) == 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if( keyNum >= K_MOUSE1 && keyNum <= K_MOUSE5 )
|
||||
{
|
||||
int buttonIdx = keyNum - K_MOUSE1;
|
||||
|
||||
// K_MOUSE* are contiguous, so they can be used as indexes into imgui's
|
||||
// g_MousePressed[] - imgui even uses the same order (left, right, middle, X1, X2)
|
||||
g_MousePressed[buttonIdx] = pressed;
|
||||
|
||||
return true; // let's pretend we also handle mouse up events
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gross hack. I'm sorry.
|
||||
// sets the kb-layout specific keys in the keymap
|
||||
void FillCharKeys( int* keyMap )
|
||||
{
|
||||
// set scancodes as default values in case the real keys aren't found below
|
||||
keyMap[ImGuiKey_A] = K_A;
|
||||
keyMap[ImGuiKey_C] = K_C;
|
||||
keyMap[ImGuiKey_V] = K_V;
|
||||
keyMap[ImGuiKey_X] = K_X;
|
||||
keyMap[ImGuiKey_Y] = K_Y;
|
||||
keyMap[ImGuiKey_Z] = K_Z;
|
||||
|
||||
// try all probable keys for whether they're ImGuiKey_A/C/V/X/Y/Z
|
||||
for( int k = K_1; k < K_RSHIFT; ++k )
|
||||
{
|
||||
const char* kn = idKeyInput::LocalizedKeyName( ( keyNum_t )k );
|
||||
if( kn[0] == '\0' || kn[1] != '\0' || kn[0] == '?' )
|
||||
{
|
||||
// if the key wasn't found or the name has more than one char,
|
||||
// it's not what we're looking for.
|
||||
continue;
|
||||
}
|
||||
switch( kn[0] )
|
||||
{
|
||||
case 'a': // fall-through
|
||||
case 'A':
|
||||
keyMap [ImGuiKey_A] = k;
|
||||
break;
|
||||
case 'c': // fall-through
|
||||
case 'C':
|
||||
keyMap [ImGuiKey_C] = k;
|
||||
break;
|
||||
|
||||
case 'v': // fall-through
|
||||
case 'V':
|
||||
keyMap [ImGuiKey_V] = k;
|
||||
break;
|
||||
|
||||
case 'x': // fall-through
|
||||
case 'X':
|
||||
keyMap [ImGuiKey_X] = k;
|
||||
break;
|
||||
|
||||
case 'y': // fall-through
|
||||
case 'Y':
|
||||
keyMap [ImGuiKey_Y] = k;
|
||||
break;
|
||||
|
||||
case 'z': // fall-through
|
||||
case 'Z':
|
||||
keyMap [ImGuiKey_Z] = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sys_GetClipboardData() expects that you Mem_Free() its returned data
|
||||
// ImGui can't do that, of course, so copy it into a static buffer here,
|
||||
// Mem_Free() and return the copy
|
||||
const char* GetClipboardText( void* )
|
||||
{
|
||||
char* txt = Sys_GetClipboardData();
|
||||
if( txt == NULL )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static idStr clipboardBuf;
|
||||
clipboardBuf = txt;
|
||||
|
||||
Mem_Free( txt );
|
||||
|
||||
return clipboardBuf.c_str();
|
||||
}
|
||||
|
||||
void SetClipboardText( void*, const char* text )
|
||||
{
|
||||
Sys_SetClipboardData( text );
|
||||
}
|
||||
|
||||
|
||||
bool ShowWindows()
|
||||
{
|
||||
return ( ImGuiTools::AreEditorsActive() || imgui_showDemoWindow.GetBool() );
|
||||
}
|
||||
|
||||
bool UseInput()
|
||||
{
|
||||
return ImGuiTools::ReleaseMouseForTools();
|
||||
}
|
||||
|
||||
} //anon namespace
|
||||
|
||||
bool Init( int windowWidth, int windowHeight )
|
||||
{
|
||||
if( IsInitialized() )
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
|
||||
ImGui::CreateContext();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
|
||||
io.KeyMap[ImGuiKey_Tab] = K_TAB;
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = K_LEFTARROW;
|
||||
io.KeyMap[ImGuiKey_RightArrow] = K_RIGHTARROW;
|
||||
io.KeyMap[ImGuiKey_UpArrow] = K_UPARROW;
|
||||
io.KeyMap[ImGuiKey_DownArrow] = K_DOWNARROW;
|
||||
io.KeyMap[ImGuiKey_PageUp] = K_PGUP;
|
||||
io.KeyMap[ImGuiKey_PageDown] = K_PGDN;
|
||||
io.KeyMap[ImGuiKey_Home] = K_HOME;
|
||||
io.KeyMap[ImGuiKey_End] = K_END;
|
||||
io.KeyMap[ImGuiKey_Delete] = K_DEL;
|
||||
io.KeyMap[ImGuiKey_Backspace] = K_BACKSPACE;
|
||||
io.KeyMap[ImGuiKey_Enter] = K_ENTER;
|
||||
io.KeyMap[ImGuiKey_Escape] = K_ESCAPE;
|
||||
|
||||
FillCharKeys( io.KeyMap );
|
||||
|
||||
g_DisplaySize.x = windowWidth;
|
||||
g_DisplaySize.y = windowHeight;
|
||||
io.DisplaySize = g_DisplaySize;
|
||||
|
||||
io.RenderDrawListsFn = idRenderBackend::ImGui_RenderDrawLists;
|
||||
|
||||
// RB: FIXME double check
|
||||
io.SetClipboardTextFn = SetClipboardText;
|
||||
io.GetClipboardTextFn = GetClipboardText;
|
||||
io.ClipboardUserData = NULL;
|
||||
|
||||
// make it a bit prettier with rounded edges
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
//style.ChildWindowRounding = 9.0f;
|
||||
//style.FrameRounding = 4.0f;
|
||||
//style.ScrollbarRounding = 4.0f;
|
||||
//style.GrabRounding = 4.0f;
|
||||
|
||||
// Setup style
|
||||
ImGui::StyleColorsDark();
|
||||
//ImGui::StyleColorsClassic();
|
||||
|
||||
g_IsInit = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NotifyDisplaySizeChanged( int width, int height )
|
||||
{
|
||||
if( g_DisplaySize.x != width || g_DisplaySize.y != height )
|
||||
{
|
||||
g_DisplaySize = ImVec2( ( float )width, ( float )height );
|
||||
|
||||
if( IsInitialized() )
|
||||
{
|
||||
Destroy();
|
||||
Init( width, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// inject a sys event
|
||||
bool InjectSysEvent( const sysEvent_t* event )
|
||||
{
|
||||
if( IsInitialized() && UseInput() )
|
||||
{
|
||||
if( event == NULL )
|
||||
{
|
||||
assert( 0 ); // I think this shouldn't happen
|
||||
return false;
|
||||
}
|
||||
|
||||
const sysEvent_t& ev = *event;
|
||||
|
||||
switch( ev.evType )
|
||||
{
|
||||
case SE_KEY:
|
||||
return HandleKeyEvent( ev );
|
||||
|
||||
case SE_MOUSE_ABSOLUTE:
|
||||
g_MousePos.x = ev.evValue;
|
||||
g_MousePos.y = ev.evValue2;
|
||||
return true;
|
||||
|
||||
case SE_CHAR:
|
||||
if( ev.evValue < 0x10000 )
|
||||
{
|
||||
ImGui::GetIO().AddInputCharacter( ev.evValue );
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case SE_MOUSE_LEAVE:
|
||||
g_MousePos = ImVec2( -1.0f, -1.0f );
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InjectMouseWheel( int delta )
|
||||
{
|
||||
if( IsInitialized() && UseInput() && delta != 0 )
|
||||
{
|
||||
g_MouseWheel = ( delta > 0 ) ? 1 : -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void NewFrame()
|
||||
{
|
||||
if( IsInitialized() && ShowWindows() )
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
io.DisplaySize = g_DisplaySize;
|
||||
|
||||
// Setup time step
|
||||
int time = Sys_Milliseconds();
|
||||
double current_time = time * 0.001;
|
||||
io.DeltaTime = g_Time > 0.0 ? ( float )( current_time - g_Time ) : ( float )( 1.0f / 60.0f );
|
||||
g_Time = current_time;
|
||||
|
||||
// Setup inputs
|
||||
io.MousePos = g_MousePos;
|
||||
|
||||
// If a mouse press event came, always pass it as "mouse held this frame",
|
||||
// so we don't miss click-release events that are shorter than 1 frame.
|
||||
for( int i = 0; i < 5; ++i )
|
||||
{
|
||||
io.MouseDown[i] = g_MousePressed[i] || usercmdGen->KeyState( K_MOUSE1 + i ) == 1;
|
||||
//g_MousePressed[i] = false;
|
||||
}
|
||||
|
||||
io.MouseWheel = g_MouseWheel;
|
||||
g_MouseWheel = 0.0f;
|
||||
|
||||
// Hide OS mouse cursor if ImGui is drawing it TODO: hide mousecursor?
|
||||
// ShowCursor(io.MouseDrawCursor ? 0 : 1);
|
||||
|
||||
ImGui::GetIO().MouseDrawCursor = UseInput();
|
||||
|
||||
// Start the frame
|
||||
ImGui::NewFrame();
|
||||
g_haveNewFrame = true;
|
||||
|
||||
if( imgui_showDemoWindow.GetBool() && !ImGuiTools::ReleaseMouseForTools() )
|
||||
{
|
||||
ImGuiTools::impl::SetReleaseToolMouse( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Render()
|
||||
{
|
||||
if( IsInitialized() && ShowWindows() )
|
||||
{
|
||||
if( !g_haveNewFrame )
|
||||
{
|
||||
// for screenshots etc, where we didn't go through idCommonLocal::Frame()
|
||||
// before idRenderSystemLocal::SwapCommandBuffers_FinishRendering()
|
||||
NewFrame();
|
||||
}
|
||||
|
||||
ImGuiTools::DrawToolWindows();
|
||||
|
||||
if( imgui_showDemoWindow.GetBool() )
|
||||
{
|
||||
ImGui::ShowDemoWindow();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
ImGui::Render();
|
||||
g_haveNewFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Destroy()
|
||||
{
|
||||
if( IsInitialized() )
|
||||
{
|
||||
ImGui::DestroyContext();
|
||||
g_IsInit = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsInitialized()
|
||||
{
|
||||
// checks if imgui is up and running
|
||||
return g_IsInit;
|
||||
}
|
||||
|
||||
} //namespace ImGuiHook
|
37
neo/imgui/ImGui_Hooks.h
Normal file
37
neo/imgui/ImGui_Hooks.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
#ifndef NEO_IMGUI_IMGUI_HOOKS_H_
|
||||
#define NEO_IMGUI_IMGUI_HOOKS_H_
|
||||
|
||||
#include "../sys/sys_public.h"
|
||||
|
||||
|
||||
namespace ImGuiHook
|
||||
{
|
||||
|
||||
bool Init( int windowWidth, int windowHeight );
|
||||
|
||||
bool IsInitialized();
|
||||
|
||||
// tell imgui that the (game) window size has changed
|
||||
void NotifyDisplaySizeChanged( int width, int height );
|
||||
|
||||
// inject a sys event (keyboard, mouse, unicode character)
|
||||
bool InjectSysEvent( const sysEvent_t* keyEvent );
|
||||
|
||||
// inject the current mouse wheel delta for scrolling
|
||||
bool InjectMouseWheel( int delta );
|
||||
|
||||
// call this once per frame *before* calling ImGui::* commands to draw widgets etc
|
||||
// (but ideally after getting all new events)
|
||||
void NewFrame();
|
||||
|
||||
// call this once per frame (at the end) - it'll render all ImGui::* commands
|
||||
// since NewFrame()
|
||||
void Render();
|
||||
|
||||
void Destroy();
|
||||
|
||||
} //namespace ImGuiHook
|
||||
|
||||
|
||||
#endif /* NEO_IMGUI_IMGUI_HOOKS_H_ */
|
21
neo/libs/imgui/LICENSE.txt
Normal file
21
neo/libs/imgui/LICENSE.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2019 Omar Cornut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
93
neo/libs/imgui/imconfig.h
Normal file
93
neo/libs/imgui/imconfig.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
|
||||
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
||||
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/branch with your modifications to imconfig.h)
|
||||
// B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h"
|
||||
// If you do so you need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include
|
||||
// the imgui*.cpp files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
|
||||
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
||||
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//---- Define assertion handler. Defaults to calling assert().
|
||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
|
||||
|
||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
||||
// Using dear imgui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
|
||||
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
|
||||
// It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
|
||||
//#define IMGUI_DISABLE_DEMO_WINDOWS
|
||||
//#define IMGUI_DISABLE_METRICS_WINDOW
|
||||
|
||||
//---- Don't implement some functions to reduce linkage requirements.
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow.
|
||||
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
|
||||
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices').
|
||||
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf.
|
||||
//#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h.
|
||||
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
||||
|
||||
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||
|
||||
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
|
||||
//#define IMGUI_USE_BGRA_PACKED_COLOR
|
||||
|
||||
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||
// By default the embedded implementations are declared static and not available outside of imgui cpp files.
|
||||
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||
|
||||
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
|
||||
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
|
||||
/*
|
||||
#define IM_VEC2_CLASS_EXTRA \
|
||||
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
|
||||
operator MyVec2() const { return MyVec2(x,y); }
|
||||
|
||||
#define IM_VEC4_CLASS_EXTRA \
|
||||
ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
|
||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||
*/
|
||||
|
||||
//---- Using 32-bits vertex indices (default is 16-bits) is one way to allow large meshes with more than 64K vertices.
|
||||
// Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bits indices).
|
||||
// Another way to allow large meshes while keeping 16-bits indices is to handle ImDrawCmd::VtxOffset in your renderer.
|
||||
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
|
||||
//#define ImDrawIdx unsigned int
|
||||
|
||||
//---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly)
|
||||
//struct ImDrawList;
|
||||
//struct ImDrawCmd;
|
||||
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
||||
//#define ImDrawCallback MyImDrawCallback
|
||||
|
||||
//---- Debug Tools
|
||||
// Use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.
|
||||
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
||||
//#define IM_DEBUG_BREAK __debugbreak()
|
||||
// Have the Item Picker break in the ItemAdd() function instead of ItemHoverable() - which is earlier in the code, will catch a few extra items, allow picking items other than Hovered one.
|
||||
// This adds a small runtime cost which is why it is not enabled by default.
|
||||
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||
/*
|
||||
namespace ImGui
|
||||
{
|
||||
void MyFunction(const char* name, const MyMatrix44& v);
|
||||
}
|
||||
*/
|
10108
neo/libs/imgui/imgui.cpp
Normal file
10108
neo/libs/imgui/imgui.cpp
Normal file
File diff suppressed because it is too large
Load diff
2242
neo/libs/imgui/imgui.h
Normal file
2242
neo/libs/imgui/imgui.h
Normal file
File diff suppressed because it is too large
Load diff
4749
neo/libs/imgui/imgui_demo.cpp
Normal file
4749
neo/libs/imgui/imgui_demo.cpp
Normal file
File diff suppressed because it is too large
Load diff
3367
neo/libs/imgui/imgui_draw.cpp
Normal file
3367
neo/libs/imgui/imgui_draw.cpp
Normal file
File diff suppressed because it is too large
Load diff
1751
neo/libs/imgui/imgui_internal.h
Normal file
1751
neo/libs/imgui/imgui_internal.h
Normal file
File diff suppressed because it is too large
Load diff
7590
neo/libs/imgui/imgui_widgets.cpp
Normal file
7590
neo/libs/imgui/imgui_widgets.cpp
Normal file
File diff suppressed because it is too large
Load diff
639
neo/libs/imgui/imstb_rectpack.h
Normal file
639
neo/libs/imgui/imstb_rectpack.h
Normal file
|
@ -0,0 +1,639 @@
|
|||
// [DEAR IMGUI]
|
||||
// This is a slightly modified version of stb_rect_pack.h 1.00.
|
||||
// Those changes would need to be pushed into nothings/stb:
|
||||
// - Added STBRP__CDECL
|
||||
// Grep for [DEAR IMGUI] to find the changes.
|
||||
|
||||
// stb_rect_pack.h - v1.00 - public domain - rectangle packing
|
||||
// Sean Barrett 2014
|
||||
//
|
||||
// Useful for e.g. packing rectangular textures into an atlas.
|
||||
// Does not do rotation.
|
||||
//
|
||||
// Not necessarily the awesomest packing method, but better than
|
||||
// the totally naive one in stb_truetype (which is primarily what
|
||||
// this is meant to replace).
|
||||
//
|
||||
// Has only had a few tests run, may have issues.
|
||||
//
|
||||
// More docs to come.
|
||||
//
|
||||
// No memory allocations; uses qsort() and assert() from stdlib.
|
||||
// Can override those by defining STBRP_SORT and STBRP_ASSERT.
|
||||
//
|
||||
// This library currently uses the Skyline Bottom-Left algorithm.
|
||||
//
|
||||
// Please note: better rectangle packers are welcome! Please
|
||||
// implement them to the same API, but with a different init
|
||||
// function.
|
||||
//
|
||||
// Credits
|
||||
//
|
||||
// Library
|
||||
// Sean Barrett
|
||||
// Minor features
|
||||
// Martins Mozeiko
|
||||
// github:IntellectualKitty
|
||||
//
|
||||
// Bugfixes / warning fixes
|
||||
// Jeremy Jaussaud
|
||||
// Fabian Giesen
|
||||
//
|
||||
// Version history:
|
||||
//
|
||||
// 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles
|
||||
// 0.99 (2019-02-07) warning fixes
|
||||
// 0.11 (2017-03-03) return packing success/fail result
|
||||
// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
|
||||
// 0.09 (2016-08-27) fix compiler warnings
|
||||
// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
|
||||
// 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0)
|
||||
// 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort
|
||||
// 0.05: added STBRP_ASSERT to allow replacing assert
|
||||
// 0.04: fixed minor bug in STBRP_LARGE_RECTS support
|
||||
// 0.01: initial release
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// See end of file for license information.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// INCLUDE SECTION
|
||||
//
|
||||
|
||||
#ifndef STB_INCLUDE_STB_RECT_PACK_H
|
||||
#define STB_INCLUDE_STB_RECT_PACK_H
|
||||
|
||||
#define STB_RECT_PACK_VERSION 1
|
||||
|
||||
#ifdef STBRP_STATIC
|
||||
#define STBRP_DEF static
|
||||
#else
|
||||
#define STBRP_DEF extern
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct stbrp_context stbrp_context;
|
||||
typedef struct stbrp_node stbrp_node;
|
||||
typedef struct stbrp_rect stbrp_rect;
|
||||
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
typedef int stbrp_coord;
|
||||
#else
|
||||
typedef unsigned short stbrp_coord;
|
||||
#endif
|
||||
|
||||
STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
||||
// Assign packed locations to rectangles. The rectangles are of type
|
||||
// 'stbrp_rect' defined below, stored in the array 'rects', and there
|
||||
// are 'num_rects' many of them.
|
||||
//
|
||||
// Rectangles which are successfully packed have the 'was_packed' flag
|
||||
// set to a non-zero value and 'x' and 'y' store the minimum location
|
||||
// on each axis (i.e. bottom-left in cartesian coordinates, top-left
|
||||
// if you imagine y increasing downwards). Rectangles which do not fit
|
||||
// have the 'was_packed' flag set to 0.
|
||||
//
|
||||
// You should not try to access the 'rects' array from another thread
|
||||
// while this function is running, as the function temporarily reorders
|
||||
// the array while it executes.
|
||||
//
|
||||
// To pack into another rectangle, you need to call stbrp_init_target
|
||||
// again. To continue packing into the same rectangle, you can call
|
||||
// this function again. Calling this multiple times with multiple rect
|
||||
// arrays will probably produce worse packing results than calling it
|
||||
// a single time with the full rectangle array, but the option is
|
||||
// available.
|
||||
//
|
||||
// The function returns 1 if all of the rectangles were successfully
|
||||
// packed and 0 otherwise.
|
||||
|
||||
struct stbrp_rect
|
||||
{
|
||||
// reserved for your use:
|
||||
int id;
|
||||
|
||||
// input:
|
||||
stbrp_coord w, h;
|
||||
|
||||
// output:
|
||||
stbrp_coord x, y;
|
||||
int was_packed; // non-zero if valid packing
|
||||
|
||||
}; // 16 bytes, nominally
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_init_target (stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);
|
||||
// Initialize a rectangle packer to:
|
||||
// pack a rectangle that is 'width' by 'height' in dimensions
|
||||
// using temporary storage provided by the array 'nodes', which is 'num_nodes' long
|
||||
//
|
||||
// You must call this function every time you start packing into a new target.
|
||||
//
|
||||
// There is no "shutdown" function. The 'nodes' memory must stay valid for
|
||||
// the following stbrp_pack_rects() call (or calls), but can be freed after
|
||||
// the call (or calls) finish.
|
||||
//
|
||||
// Note: to guarantee best results, either:
|
||||
// 1. make sure 'num_nodes' >= 'width'
|
||||
// or 2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'
|
||||
//
|
||||
// If you don't do either of the above things, widths will be quantized to multiples
|
||||
// of small integers to guarantee the algorithm doesn't run out of temporary storage.
|
||||
//
|
||||
// If you do #2, then the non-quantized algorithm will be used, but the algorithm
|
||||
// may run out of temporary storage and be unable to pack some rectangles.
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem (stbrp_context *context, int allow_out_of_mem);
|
||||
// Optionally call this function after init but before doing any packing to
|
||||
// change the handling of the out-of-temp-memory scenario, described above.
|
||||
// If you call init again, this will be reset to the default (false).
|
||||
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic (stbrp_context *context, int heuristic);
|
||||
// Optionally select which packing heuristic the library should use. Different
|
||||
// heuristics will produce better/worse results for different data sets.
|
||||
// If you call init again, this will be reset to the default.
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP_HEURISTIC_Skyline_default=0,
|
||||
STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,
|
||||
STBRP_HEURISTIC_Skyline_BF_sortHeight
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// the details of the following structures don't matter to you, but they must
|
||||
// be visible so you can handle the memory allocations for them
|
||||
|
||||
struct stbrp_node
|
||||
{
|
||||
stbrp_coord x,y;
|
||||
stbrp_node *next;
|
||||
};
|
||||
|
||||
struct stbrp_context
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int align;
|
||||
int init_mode;
|
||||
int heuristic;
|
||||
int num_nodes;
|
||||
stbrp_node *active_head;
|
||||
stbrp_node *free_head;
|
||||
stbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPLEMENTATION SECTION
|
||||
//
|
||||
|
||||
#ifdef STB_RECT_PACK_IMPLEMENTATION
|
||||
#ifndef STBRP_SORT
|
||||
#include <stdlib.h>
|
||||
#define STBRP_SORT qsort
|
||||
#endif
|
||||
|
||||
#ifndef STBRP_ASSERT
|
||||
#include <assert.h>
|
||||
#define STBRP_ASSERT assert
|
||||
#endif
|
||||
|
||||
// [DEAR IMGUI] Added STBRP__CDECL
|
||||
#ifdef _MSC_VER
|
||||
#define STBRP__NOTUSED(v) (void)(v)
|
||||
#define STBRP__CDECL __cdecl
|
||||
#else
|
||||
#define STBRP__NOTUSED(v) (void)sizeof(v)
|
||||
#define STBRP__CDECL
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
STBRP__INIT_skyline = 1
|
||||
};
|
||||
|
||||
STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
|
||||
{
|
||||
switch (context->init_mode) {
|
||||
case STBRP__INIT_skyline:
|
||||
STBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);
|
||||
context->heuristic = heuristic;
|
||||
break;
|
||||
default:
|
||||
STBRP_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)
|
||||
{
|
||||
if (allow_out_of_mem)
|
||||
// if it's ok to run out of memory, then don't bother aligning them;
|
||||
// this gives better packing, but may fail due to OOM (even though
|
||||
// the rectangles easily fit). @TODO a smarter approach would be to only
|
||||
// quantize once we've hit OOM, then we could get rid of this parameter.
|
||||
context->align = 1;
|
||||
else {
|
||||
// if it's not ok to run out of memory, then quantize the widths
|
||||
// so that num_nodes is always enough nodes.
|
||||
//
|
||||
// I.e. num_nodes * align >= width
|
||||
// align >= width / num_nodes
|
||||
// align = ceil(width/num_nodes)
|
||||
|
||||
context->align = (context->width + context->num_nodes-1) / context->num_nodes;
|
||||
}
|
||||
}
|
||||
|
||||
STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)
|
||||
{
|
||||
int i;
|
||||
#ifndef STBRP_LARGE_RECTS
|
||||
STBRP_ASSERT(width <= 0xffff && height <= 0xffff);
|
||||
#endif
|
||||
|
||||
for (i=0; i < num_nodes-1; ++i)
|
||||
nodes[i].next = &nodes[i+1];
|
||||
nodes[i].next = NULL;
|
||||
context->init_mode = STBRP__INIT_skyline;
|
||||
context->heuristic = STBRP_HEURISTIC_Skyline_default;
|
||||
context->free_head = &nodes[0];
|
||||
context->active_head = &context->extra[0];
|
||||
context->width = width;
|
||||
context->height = height;
|
||||
context->num_nodes = num_nodes;
|
||||
stbrp_setup_allow_out_of_mem(context, 0);
|
||||
|
||||
// node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)
|
||||
context->extra[0].x = 0;
|
||||
context->extra[0].y = 0;
|
||||
context->extra[0].next = &context->extra[1];
|
||||
context->extra[1].x = (stbrp_coord) width;
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
context->extra[1].y = (1<<30);
|
||||
#else
|
||||
context->extra[1].y = 65535;
|
||||
#endif
|
||||
context->extra[1].next = NULL;
|
||||
}
|
||||
|
||||
// find minimum y position if it starts at x1
|
||||
static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)
|
||||
{
|
||||
stbrp_node *node = first;
|
||||
int x1 = x0 + width;
|
||||
int min_y, visited_width, waste_area;
|
||||
|
||||
STBRP__NOTUSED(c);
|
||||
|
||||
STBRP_ASSERT(first->x <= x0);
|
||||
|
||||
#if 0
|
||||
// skip in case we're past the node
|
||||
while (node->next->x <= x0)
|
||||
++node;
|
||||
#else
|
||||
STBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency
|
||||
#endif
|
||||
|
||||
STBRP_ASSERT(node->x <= x0);
|
||||
|
||||
min_y = 0;
|
||||
waste_area = 0;
|
||||
visited_width = 0;
|
||||
while (node->x < x1) {
|
||||
if (node->y > min_y) {
|
||||
// raise min_y higher.
|
||||
// we've accounted for all waste up to min_y,
|
||||
// but we'll now add more waste for everything we've visted
|
||||
waste_area += visited_width * (node->y - min_y);
|
||||
min_y = node->y;
|
||||
// the first time through, visited_width might be reduced
|
||||
if (node->x < x0)
|
||||
visited_width += node->next->x - x0;
|
||||
else
|
||||
visited_width += node->next->x - node->x;
|
||||
} else {
|
||||
// add waste area
|
||||
int under_width = node->next->x - node->x;
|
||||
if (under_width + visited_width > width)
|
||||
under_width = width - visited_width;
|
||||
waste_area += under_width * (min_y - node->y);
|
||||
visited_width += under_width;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
*pwaste = waste_area;
|
||||
return min_y;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x,y;
|
||||
stbrp_node **prev_link;
|
||||
} stbrp__findresult;
|
||||
|
||||
static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)
|
||||
{
|
||||
int best_waste = (1<<30), best_x, best_y = (1 << 30);
|
||||
stbrp__findresult fr;
|
||||
stbrp_node **prev, *node, *tail, **best = NULL;
|
||||
|
||||
// align to multiple of c->align
|
||||
width = (width + c->align - 1);
|
||||
width -= width % c->align;
|
||||
STBRP_ASSERT(width % c->align == 0);
|
||||
|
||||
// if it can't possibly fit, bail immediately
|
||||
if (width > c->width || height > c->height) {
|
||||
fr.prev_link = NULL;
|
||||
fr.x = fr.y = 0;
|
||||
return fr;
|
||||
}
|
||||
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
while (node->x + width <= c->width) {
|
||||
int y,waste;
|
||||
y = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL
|
||||
// bottom left
|
||||
if (y < best_y) {
|
||||
best_y = y;
|
||||
best = prev;
|
||||
}
|
||||
} else {
|
||||
// best-fit
|
||||
if (y + height <= c->height) {
|
||||
// can only use it if it first vertically
|
||||
if (y < best_y || (y == best_y && waste < best_waste)) {
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
best_x = (best == NULL) ? 0 : (*best)->x;
|
||||
|
||||
// if doing best-fit (BF), we also have to try aligning right edge to each node position
|
||||
//
|
||||
// e.g, if fitting
|
||||
//
|
||||
// ____________________
|
||||
// |____________________|
|
||||
//
|
||||
// into
|
||||
//
|
||||
// | |
|
||||
// | ____________|
|
||||
// |____________|
|
||||
//
|
||||
// then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned
|
||||
//
|
||||
// This makes BF take about 2x the time
|
||||
|
||||
if (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {
|
||||
tail = c->active_head;
|
||||
node = c->active_head;
|
||||
prev = &c->active_head;
|
||||
// find first node that's admissible
|
||||
while (tail->x < width)
|
||||
tail = tail->next;
|
||||
while (tail) {
|
||||
int xpos = tail->x - width;
|
||||
int y,waste;
|
||||
STBRP_ASSERT(xpos >= 0);
|
||||
// find the left position that matches this
|
||||
while (node->next->x <= xpos) {
|
||||
prev = &node->next;
|
||||
node = node->next;
|
||||
}
|
||||
STBRP_ASSERT(node->next->x > xpos && node->x <= xpos);
|
||||
y = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);
|
||||
if (y + height <= c->height) {
|
||||
if (y <= best_y) {
|
||||
if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) {
|
||||
best_x = xpos;
|
||||
STBRP_ASSERT(y <= best_y);
|
||||
best_y = y;
|
||||
best_waste = waste;
|
||||
best = prev;
|
||||
}
|
||||
}
|
||||
}
|
||||
tail = tail->next;
|
||||
}
|
||||
}
|
||||
|
||||
fr.prev_link = best;
|
||||
fr.x = best_x;
|
||||
fr.y = best_y;
|
||||
return fr;
|
||||
}
|
||||
|
||||
static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)
|
||||
{
|
||||
// find best position according to heuristic
|
||||
stbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);
|
||||
stbrp_node *node, *cur;
|
||||
|
||||
// bail if:
|
||||
// 1. it failed
|
||||
// 2. the best node doesn't fit (we don't always check this)
|
||||
// 3. we're out of memory
|
||||
if (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {
|
||||
res.prev_link = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
// on success, create new node
|
||||
node = context->free_head;
|
||||
node->x = (stbrp_coord) res.x;
|
||||
node->y = (stbrp_coord) (res.y + height);
|
||||
|
||||
context->free_head = node->next;
|
||||
|
||||
// insert the new node into the right starting point, and
|
||||
// let 'cur' point to the remaining nodes needing to be
|
||||
// stiched back in
|
||||
|
||||
cur = *res.prev_link;
|
||||
if (cur->x < res.x) {
|
||||
// preserve the existing one, so start testing with the next one
|
||||
stbrp_node *next = cur->next;
|
||||
cur->next = node;
|
||||
cur = next;
|
||||
} else {
|
||||
*res.prev_link = node;
|
||||
}
|
||||
|
||||
// from here, traverse cur and free the nodes, until we get to one
|
||||
// that shouldn't be freed
|
||||
while (cur->next && cur->next->x <= res.x + width) {
|
||||
stbrp_node *next = cur->next;
|
||||
// move the current node to the free list
|
||||
cur->next = context->free_head;
|
||||
context->free_head = cur;
|
||||
cur = next;
|
||||
}
|
||||
|
||||
// stitch the list back in
|
||||
node->next = cur;
|
||||
|
||||
if (cur->x < res.x + width)
|
||||
cur->x = (stbrp_coord) (res.x + width);
|
||||
|
||||
#ifdef _DEBUG
|
||||
cur = context->active_head;
|
||||
while (cur->x < context->width) {
|
||||
STBRP_ASSERT(cur->x < cur->next->x);
|
||||
cur = cur->next;
|
||||
}
|
||||
STBRP_ASSERT(cur->next == NULL);
|
||||
|
||||
{
|
||||
int count=0;
|
||||
cur = context->active_head;
|
||||
while (cur) {
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
cur = context->free_head;
|
||||
while (cur) {
|
||||
cur = cur->next;
|
||||
++count;
|
||||
}
|
||||
STBRP_ASSERT(count == context->num_nodes+2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// [DEAR IMGUI] Added STBRP__CDECL
|
||||
static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
if (p->h > q->h)
|
||||
return -1;
|
||||
if (p->h < q->h)
|
||||
return 1;
|
||||
return (p->w > q->w) ? -1 : (p->w < q->w);
|
||||
}
|
||||
|
||||
// [DEAR IMGUI] Added STBRP__CDECL
|
||||
static int STBRP__CDECL rect_original_order(const void *a, const void *b)
|
||||
{
|
||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||
return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);
|
||||
}
|
||||
|
||||
#ifdef STBRP_LARGE_RECTS
|
||||
#define STBRP__MAXVAL 0xffffffff
|
||||
#else
|
||||
#define STBRP__MAXVAL 0xffff
|
||||
#endif
|
||||
|
||||
STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
|
||||
{
|
||||
int i, all_rects_packed = 1;
|
||||
|
||||
// we use the 'was_packed' field internally to allow sorting/unsorting
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
rects[i].was_packed = i;
|
||||
}
|
||||
|
||||
// sort according to heuristic
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);
|
||||
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
if (rects[i].w == 0 || rects[i].h == 0) {
|
||||
rects[i].x = rects[i].y = 0; // empty rect needs no space
|
||||
} else {
|
||||
stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
|
||||
if (fr.prev_link) {
|
||||
rects[i].x = (stbrp_coord) fr.x;
|
||||
rects[i].y = (stbrp_coord) fr.y;
|
||||
} else {
|
||||
rects[i].x = rects[i].y = STBRP__MAXVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsort
|
||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
|
||||
|
||||
// set was_packed flags and all_rects_packed status
|
||||
for (i=0; i < num_rects; ++i) {
|
||||
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
||||
if (!rects[i].was_packed)
|
||||
all_rects_packed = 0;
|
||||
}
|
||||
|
||||
// return the all_rects_packed status
|
||||
return all_rects_packed;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
1417
neo/libs/imgui/imstb_textedit.h
Normal file
1417
neo/libs/imgui/imstb_textedit.h
Normal file
File diff suppressed because it is too large
Load diff
4903
neo/libs/imgui/imstb_truetype.h
Normal file
4903
neo/libs/imgui/imstb_truetype.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -394,6 +394,19 @@ public:
|
|||
|
||||
void SetTexParameters(); // update aniso and trilinear
|
||||
|
||||
// DG: added for imgui integration (to be used with ImGui::Image() etc)
|
||||
void* GetImGuiTextureID()
|
||||
{
|
||||
if( !IsLoaded() )
|
||||
{
|
||||
// load the image on demand here, which isn't our normal game operating mode
|
||||
ActuallyLoadImage( true );
|
||||
}
|
||||
|
||||
return ( void* )( intptr_t )texnum;
|
||||
}
|
||||
// DG end
|
||||
|
||||
private:
|
||||
friend class idImageManager;
|
||||
|
||||
|
@ -554,6 +567,7 @@ public:
|
|||
idImage* currentNormalsImage; // cheap G-Buffer replacement, holds normals and surface roughness
|
||||
idImage* ambientOcclusionImage[2]; // contain AO and bilateral filtering keys
|
||||
idImage* hierarchicalZbufferImage; // zbuffer with mip maps to accelerate screen space ray tracing
|
||||
idImage* imguiFontImage;
|
||||
|
||||
idImage* defaultUACIrradianceCube;
|
||||
idImage* defaultUACRadianceCube;
|
||||
|
|
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
|
||||
#include "RenderCommon.h"
|
||||
#include "SMAA/AreaTex.h"
|
||||
|
@ -813,6 +814,32 @@ static void R_CreateSMAASearchImage( idImage* image )
|
|||
image->GenerateImage( ( byte* )data, SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, TF_LINEAR, TR_CLAMP, TD_LOOKUP_TABLE_MONO );
|
||||
}
|
||||
|
||||
static void R_CreateImGuiFontImage( idImage* image )
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
byte* pixels = NULL;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32( &pixels, &width, &height ); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
|
||||
|
||||
/*
|
||||
glGenTextures( 1, &g_FontTexture );
|
||||
glBindTexture( GL_TEXTURE_2D, g_FontTexture );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels );
|
||||
*/
|
||||
|
||||
image->GenerateImage( ( byte* )pixels, width, height, TF_LINEAR, TR_CLAMP, TD_LOOKUP_TABLE_RGBA );
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = ( void* )( intptr_t )image->GetImGuiTextureID();
|
||||
|
||||
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||
//io.Fonts->ClearInputData();
|
||||
//io.Fonts->ClearTexData();
|
||||
}
|
||||
|
||||
// RB end
|
||||
|
||||
/*
|
||||
|
@ -875,6 +902,8 @@ void idImageManager::CreateIntrinsicImages()
|
|||
ambientOcclusionImage[1] = ImageFromFunction( "_ao1", R_SMAAImage_ResNative );
|
||||
|
||||
hierarchicalZbufferImage = ImageFromFunction( "_cszBuffer", R_HierarchicalZBufferImage_ResNative );
|
||||
|
||||
imguiFontImage = ImageFromFunction( "_imguiFont", R_CreateImGuiFontImage );
|
||||
// RB end
|
||||
|
||||
// scratchImage is used for screen wipes/doublevision etc..
|
||||
|
|
|
@ -537,10 +537,15 @@ void idRenderBackend::Init()
|
|||
|
||||
// Reset our gamma
|
||||
R_SetColorMappings();
|
||||
|
||||
// RB: prepare ImGui system
|
||||
ImGui_Init();
|
||||
}
|
||||
|
||||
void idRenderBackend::Shutdown()
|
||||
{
|
||||
ImGui_Shutdown();
|
||||
|
||||
GLimp_Shutdown();
|
||||
}
|
||||
|
||||
|
@ -1606,6 +1611,8 @@ void idRenderBackend::DrawStencilShadowPass( const drawSurf_t* drawSurf, const b
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
============================================================================
|
||||
|
||||
|
@ -2112,4 +2119,204 @@ void idRenderBackend::StereoRenderExecuteBackEndCommands( const emptyCommand_t*
|
|||
pc.totalMicroSec = backEndFinishTime - backEndStartTime;
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================================
|
||||
|
||||
IMGUI RENDERING
|
||||
|
||||
==============================================================================================
|
||||
*/
|
||||
#include "../../libs/imgui/imgui.h"
|
||||
|
||||
int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||
int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
||||
int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
||||
unsigned int g_VboHandle = 0, g_VaoHandle = 0, g_ElementsHandle = 0;
|
||||
|
||||
void idRenderBackend::ImGui_Init()
|
||||
{
|
||||
#if 1
|
||||
const GLchar* vertex_shader =
|
||||
"#version 330\n"
|
||||
"uniform mat4 ProjMtx;\n"
|
||||
"in vec2 Position;\n"
|
||||
"in vec2 UV;\n"
|
||||
"in vec4 Color;\n"
|
||||
"out vec2 Frag_UV;\n"
|
||||
"out vec4 Frag_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Frag_UV = UV;\n"
|
||||
" Frag_Color = Color;\n"
|
||||
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* fragment_shader =
|
||||
"#version 330\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"in vec2 Frag_UV;\n"
|
||||
"in vec4 Frag_Color;\n"
|
||||
"out vec4 Out_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
g_ShaderHandle = glCreateProgram();
|
||||
g_VertHandle = glCreateShader( GL_VERTEX_SHADER );
|
||||
g_FragHandle = glCreateShader( GL_FRAGMENT_SHADER );
|
||||
glShaderSource( g_VertHandle, 1, &vertex_shader, 0 );
|
||||
glShaderSource( g_FragHandle, 1, &fragment_shader, 0 );
|
||||
glCompileShader( g_VertHandle );
|
||||
glCompileShader( g_FragHandle );
|
||||
glAttachShader( g_ShaderHandle, g_VertHandle );
|
||||
glAttachShader( g_ShaderHandle, g_FragHandle );
|
||||
glLinkProgram( g_ShaderHandle );
|
||||
|
||||
g_AttribLocationTex = glGetUniformLocation( g_ShaderHandle, "Texture" );
|
||||
g_AttribLocationProjMtx = glGetUniformLocation( g_ShaderHandle, "ProjMtx" );
|
||||
g_AttribLocationPosition = glGetAttribLocation( g_ShaderHandle, "Position" );
|
||||
g_AttribLocationUV = glGetAttribLocation( g_ShaderHandle, "UV" );
|
||||
g_AttribLocationColor = glGetAttribLocation( g_ShaderHandle, "Color" );
|
||||
|
||||
glGenBuffers( 1, &g_VboHandle );
|
||||
glGenBuffers( 1, &g_ElementsHandle );
|
||||
|
||||
glGenVertexArrays( 1, &g_VaoHandle );
|
||||
glBindVertexArray( g_VaoHandle );
|
||||
glBindBuffer( GL_ARRAY_BUFFER, g_VboHandle );
|
||||
glEnableVertexAttribArray( g_AttribLocationPosition );
|
||||
glEnableVertexAttribArray( g_AttribLocationUV );
|
||||
glEnableVertexAttribArray( g_AttribLocationColor );
|
||||
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
glVertexAttribPointer( g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, pos ) );
|
||||
glVertexAttribPointer( g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, uv ) );
|
||||
glVertexAttribPointer( g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, col ) );
|
||||
#undef OFFSETOF
|
||||
glBindVertexArray( 0 );
|
||||
glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
void idRenderBackend::ImGui_Shutdown()
|
||||
{
|
||||
if( g_VaoHandle ) glDeleteVertexArrays( 1, &g_VaoHandle );
|
||||
if( g_VboHandle ) glDeleteBuffers( 1, &g_VboHandle );
|
||||
if( g_ElementsHandle ) glDeleteBuffers( 1, &g_ElementsHandle );
|
||||
g_VaoHandle = g_VboHandle = g_ElementsHandle = 0;
|
||||
|
||||
glDetachShader( g_ShaderHandle, g_VertHandle );
|
||||
glDeleteShader( g_VertHandle );
|
||||
g_VertHandle = 0;
|
||||
|
||||
glDetachShader( g_ShaderHandle, g_FragHandle );
|
||||
glDeleteShader( g_FragHandle );
|
||||
g_FragHandle = 0;
|
||||
|
||||
glDeleteProgram( g_ShaderHandle );
|
||||
g_ShaderHandle = 0;
|
||||
|
||||
//ImGui::GetIO().Fonts->TexID = 0;
|
||||
}
|
||||
|
||||
// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)
|
||||
// If text or lines are blurry when integrating ImGui in your engine:
|
||||
// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)
|
||||
void idRenderBackend::ImGui_RenderDrawLists( ImDrawData* draw_data )
|
||||
{
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
|
||||
GLint last_program, last_texture, polygon_mode[2];
|
||||
glGetIntegerv( GL_CURRENT_PROGRAM, &last_program );
|
||||
glGetIntegerv( GL_TEXTURE_BINDING_2D, &last_texture );
|
||||
glGetIntegerv( GL_POLYGON_MODE, polygon_mode );
|
||||
glEnable( GL_BLEND );
|
||||
glBlendEquation( GL_FUNC_ADD );
|
||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
glDisable( GL_CULL_FACE );
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
|
||||
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||
|
||||
// Setup orthographic projection matrix
|
||||
const float width = ImGui::GetIO().DisplaySize.x;
|
||||
const float height = ImGui::GetIO().DisplaySize.y;
|
||||
const float ortho_projection[4][4] =
|
||||
{
|
||||
{ 2.0f / width, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 2.0f / -height, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, -1.0f, 0.0f },
|
||||
{ -1.0f, 1.0f, 0.0f, 1.0f },
|
||||
};
|
||||
|
||||
glUseProgram( g_ShaderHandle );
|
||||
glUniform1i( g_AttribLocationTex, 0 );
|
||||
glUniformMatrix4fv( g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0] );
|
||||
glBindVertexArray( g_VaoHandle );
|
||||
|
||||
#if 0
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_VERTEX );
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_NORMAL );
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_COLOR );
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_COLOR2 );
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_ST );
|
||||
glDisableVertexAttribArray( PC_ATTRIB_INDEX_TANGENT );
|
||||
|
||||
//glVertexAttribPointer( PC_ATTRIB_INDEX_VERTEX, 4, GL_FLOAT, GL_FALSE, sizeof( idShadowVertSkinned ), ( void* )( SHADOWVERTSKINNED_XYZW_OFFSET ) );
|
||||
//glVertexAttribPointer( PC_ATTRIB_INDEX_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( idShadowVertSkinned ), ( void* )( SHADOWVERTSKINNED_COLOR_OFFSET ) );
|
||||
//glVertexAttribPointer( PC_ATTRIB_INDEX_COLOR2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( idShadowVertSkinned ), ( void* )( SHADOWVERTSKINNED_COLOR2_OFFSET ) );
|
||||
|
||||
glEnableVertexAttribArray( g_AttribLocationPosition );
|
||||
glEnableVertexAttribArray( g_AttribLocationUV );
|
||||
glEnableVertexAttribArray( g_AttribLocationColor );
|
||||
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
glVertexAttribPointer( g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, pos ) );
|
||||
glVertexAttribPointer( g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, uv ) );
|
||||
glVertexAttribPointer( g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof( ImDrawVert ), ( GLvoid* )OFFSETOF( ImDrawVert, col ) );
|
||||
#undef OFFSETOF
|
||||
|
||||
#endif
|
||||
tr.backend.vertexLayout = LAYOUT_DRAW_IMGUI_VERT;
|
||||
|
||||
for( int n = 0; n < draw_data->CmdListsCount; n++ )
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
const ImDrawIdx* idx_buffer_offset = 0;
|
||||
|
||||
glBindBuffer( GL_ARRAY_BUFFER, g_VboHandle );
|
||||
glBufferData( GL_ARRAY_BUFFER, ( GLsizeiptr )cmd_list->VtxBuffer.size() * sizeof( ImDrawVert ), ( GLvoid* )&cmd_list->VtxBuffer.front(), GL_STREAM_DRAW );
|
||||
|
||||
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle );
|
||||
glBufferData( GL_ELEMENT_ARRAY_BUFFER, ( GLsizeiptr )cmd_list->IdxBuffer.size() * sizeof( ImDrawIdx ), ( GLvoid* )&cmd_list->IdxBuffer.front(), GL_STREAM_DRAW );
|
||||
|
||||
for( const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++ )
|
||||
{
|
||||
if( pcmd->UserCallback )
|
||||
{
|
||||
pcmd->UserCallback( cmd_list, pcmd );
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture( GL_TEXTURE_2D, ( GLuint )( intptr_t )pcmd->TextureId );
|
||||
glScissor( ( int )pcmd->ClipRect.x, ( int )( height - pcmd->ClipRect.w ), ( int )( pcmd->ClipRect.z - pcmd->ClipRect.x ), ( int )( pcmd->ClipRect.w - pcmd->ClipRect.y ) );
|
||||
glDrawElements( GL_TRIANGLES, ( GLsizei )pcmd->ElemCount, GL_UNSIGNED_SHORT, idx_buffer_offset );
|
||||
}
|
||||
idx_buffer_offset += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore modified state
|
||||
//glPolygonMode( polygon_mode[0], polygon_mode[1] );
|
||||
glBindVertexArray( glConfig.global_vao );
|
||||
|
||||
glBindBuffer( GL_ARRAY_BUFFER, 0 );
|
||||
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
|
||||
glUseProgram( last_program );
|
||||
glDisable( GL_SCISSOR_TEST );
|
||||
glBindTexture( GL_TEXTURE_2D, last_texture );
|
||||
|
||||
renderProgManager.Unbind();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "RenderCommon.h"
|
||||
#include "Framebuffer.h"
|
||||
|
||||
#include "imgui/ImGui_Hooks.h"
|
||||
|
||||
|
||||
idCVar r_drawEyeColor( "r_drawEyeColor", "0", CVAR_RENDERER | CVAR_BOOL, "Draw a colored box, red = left eye, blue = right eye, grey = non-stereo" );
|
||||
idCVar r_motionBlur( "r_motionBlur", "0", CVAR_RENDERER | CVAR_INTEGER | CVAR_ARCHIVE, "1 - 5, log2 of the number of motion blur samples" );
|
||||
|
@ -5315,6 +5317,9 @@ void idRenderBackend::ExecuteBackEndCommands( const emptyCommand_t* cmds )
|
|||
|
||||
DrawFlickerBox();
|
||||
|
||||
// RB
|
||||
//ImGuiHook::Render();
|
||||
|
||||
GL_EndFrame();
|
||||
|
||||
// stop rendering on this thread
|
||||
|
|
|
@ -242,6 +242,14 @@ all state modified by the back end is separated from the front end state
|
|||
|
||||
===========================================================================
|
||||
*/
|
||||
//namespace ImGui
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
//#include "../libs/imgui/imgui.h"
|
||||
struct ImDrawData;
|
||||
|
||||
class idRenderBackend
|
||||
{
|
||||
friend class Framebuffer;
|
||||
|
@ -260,6 +268,10 @@ public:
|
|||
void Print();
|
||||
void CheckCVars();
|
||||
|
||||
static void ImGui_Init();
|
||||
static void ImGui_Shutdown();
|
||||
static void ImGui_RenderDrawLists( ImDrawData* draw_data );
|
||||
|
||||
private:
|
||||
void DrawFlickerBox();
|
||||
|
||||
|
|
|
@ -731,6 +731,7 @@ enum vertexLayoutType_t
|
|||
LAYOUT_DRAW_VERT,
|
||||
LAYOUT_DRAW_SHADOW_VERT,
|
||||
LAYOUT_DRAW_SHADOW_VERT_SKINNED,
|
||||
LAYOUT_DRAW_IMGUI_VERT,
|
||||
NUM_VERTEX_LAYOUTS
|
||||
};
|
||||
|
||||
|
|
|
@ -645,6 +645,9 @@ void idRenderSystemLocal::SwapCommandBuffers_FinishRendering(
|
|||
// After coming back from an autoswap, we won't have anything to render
|
||||
//if( frameData && frameData->cmdHead->next != NULL )
|
||||
{
|
||||
// RB: FIXME move this elsewhere
|
||||
ImGuiHook::Render();
|
||||
|
||||
// wait for our fence to hit, which means the swap has actually happened
|
||||
// We must do this before clearing any resources the GPU may be using
|
||||
backend.GL_BlockingSwapBuffers();
|
||||
|
|
|
@ -408,6 +408,10 @@ void R_SetNewMode( const bool fullInit )
|
|||
if( GLimp_Init( parms ) )
|
||||
{
|
||||
// it worked
|
||||
|
||||
// DG: ImGui must be initialized after the window has been created, it needs an opengl context
|
||||
ImGuiHook::Init( parms.width, parms.height );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -417,6 +421,9 @@ void R_SetNewMode( const bool fullInit )
|
|||
if( GLimp_SetScreenParms( parms ) )
|
||||
{
|
||||
// it worked
|
||||
|
||||
// DG: ImGui must know about the changed window size
|
||||
ImGuiHook::NotifyDisplaySizeChanged( parms.width, parms.height );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,6 +194,9 @@ LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
|||
r_windowWidth.SetInteger( glConfig.nativeScreenWidth );
|
||||
r_windowHeight.SetInteger( glConfig.nativeScreenHeight );
|
||||
}
|
||||
|
||||
// DG: ImGui must know about the changed window size
|
||||
ImGuiHook::NotifyDisplaySizeChanged( glConfig.nativeScreenWidth, glConfig.nativeScreenHeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
162
neo/tools/edit_public.h
Normal file
162
neo/tools/edit_public.h
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __EDIT_PUBLIC_H__
|
||||
#define __EDIT_PUBLIC_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Editors.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
|
||||
// RB begin
|
||||
#if defined(USE_MFC_TOOLS)
|
||||
|
||||
class idProgram;
|
||||
class idInterpreter;
|
||||
|
||||
// Radiant Level Editor
|
||||
void RadiantInit();
|
||||
void RadiantShutdown();
|
||||
void RadiantRun();
|
||||
void RadiantPrint( const char* text );
|
||||
void RadiantSync( const char* mapName, const idVec3& viewOrg, const idAngles& viewAngles );
|
||||
|
||||
|
||||
// in-game Light Editor
|
||||
void LightEditorInit( const idDict* spawnArgs );
|
||||
void LightEditorShutdown();
|
||||
void LightEditorRun();
|
||||
|
||||
|
||||
// in-game Sound Editor
|
||||
void SoundEditorInit( const idDict* spawnArgs );
|
||||
void SoundEditorShutdown();
|
||||
void SoundEditorRun();
|
||||
|
||||
|
||||
// in-game Articulated Figure Editor
|
||||
void AFEditorInit( const idDict* spawnArgs );
|
||||
void AFEditorShutdown();
|
||||
void AFEditorRun();
|
||||
|
||||
|
||||
// in-game Particle Editor
|
||||
void ParticleEditorInit( const idDict* spawnArgs );
|
||||
void ParticleEditorShutdown();
|
||||
void ParticleEditorRun();
|
||||
|
||||
|
||||
// in-game PDA Editor
|
||||
void PDAEditorInit( const idDict* spawnArgs );
|
||||
void PDAEditorShutdown();
|
||||
void PDAEditorRun();
|
||||
|
||||
|
||||
// in-game Script Editor
|
||||
void ScriptEditorInit( const idDict* spawnArgs );
|
||||
void ScriptEditorShutdown();
|
||||
void ScriptEditorRun();
|
||||
|
||||
|
||||
// in-game Declaration Browser
|
||||
void DeclBrowserInit( const idDict* spawnArgs );
|
||||
void DeclBrowserShutdown();
|
||||
void DeclBrowserRun();
|
||||
void DeclBrowserReloadDeclarations();
|
||||
|
||||
|
||||
// GUI Editor
|
||||
void GUIEditorInit();
|
||||
void GUIEditorShutdown();
|
||||
void GUIEditorRun();
|
||||
bool GUIEditorHandleMessage( void* msg );
|
||||
|
||||
|
||||
// Script Debugger
|
||||
void DebuggerClientLaunch();
|
||||
void DebuggerClientInit( const char* cmdline );
|
||||
bool DebuggerServerInit();
|
||||
void DebuggerServerShutdown();
|
||||
void DebuggerServerPrint( const char* text );
|
||||
void DebuggerServerCheckBreakpoint( idInterpreter* interpreter, idProgram* program, int instructionPointer );
|
||||
|
||||
//Material Editor
|
||||
void MaterialEditorInit();
|
||||
void MaterialEditorRun();
|
||||
void MaterialEditorShutdown();
|
||||
void MaterialEditorPrintConsole( const char* msg );
|
||||
|
||||
#endif // #if defined(USE_MFC_TOOLS)
|
||||
|
||||
|
||||
#if defined(USE_GTK_TOOLS)
|
||||
void GtkTestEditorInit();
|
||||
void GtkTestEditorShutdown();
|
||||
void GtkTestEditorRun();
|
||||
#endif
|
||||
|
||||
#if defined(USE_QT_TOOLS)
|
||||
void QtRadiantInit();
|
||||
void QtRadiantShutdown();
|
||||
void QtRadiantRun();
|
||||
void QtRadiantPrint( const char* text );
|
||||
|
||||
void QtStringEditorInit();
|
||||
void QtStringEditorShutdown();
|
||||
void QtStringEditorRun();
|
||||
#endif
|
||||
// RB end
|
||||
|
||||
|
||||
namespace ImGuiTools
|
||||
{
|
||||
|
||||
// things in impl need to be used in at least one other file, but should generally not be touched
|
||||
namespace impl
|
||||
{
|
||||
|
||||
void SetReleaseToolMouse( bool doRelease );
|
||||
|
||||
} //namespace impl
|
||||
|
||||
bool ReleaseMouseForTools();
|
||||
|
||||
bool AreEditorsActive();
|
||||
|
||||
void DrawToolWindows();
|
||||
|
||||
void LightEditorInit( const idDict* dict, idEntity* entity );
|
||||
|
||||
}
|
||||
|
||||
#endif /* !__EDIT_PUBLIC_H__ */
|
108
neo/tools/imgui/ImGuiTools.cpp
Normal file
108
neo/tools/imgui/ImGuiTools.cpp
Normal file
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 2016 Daniel Gibson
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "../imgui/BFGimgui.h"
|
||||
#include "../idlib/CmdArgs.h"
|
||||
|
||||
#include "lighteditor/LightEditor.h"
|
||||
|
||||
|
||||
extern idCVar g_editEntityMode;
|
||||
|
||||
static bool releaseMouse = false;
|
||||
#if 0 // currently this doesn't make too much sense
|
||||
void ShowEditors_f( const idCmdArgs& args )
|
||||
{
|
||||
showToolWindows = true;
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
namespace ImGuiTools
|
||||
{
|
||||
|
||||
// things in impl need to be used in at least one other file, but should generally not be touched
|
||||
namespace impl
|
||||
{
|
||||
|
||||
void SetReleaseToolMouse( bool doRelease )
|
||||
{
|
||||
releaseMouse = doRelease;
|
||||
}
|
||||
|
||||
} //namespace impl
|
||||
|
||||
bool AreEditorsActive()
|
||||
{
|
||||
// FIXME: this is not exactly clean and must be changed if we ever support game dlls
|
||||
return g_editEntityMode.GetInteger() > 0;
|
||||
}
|
||||
|
||||
bool ReleaseMouseForTools()
|
||||
{
|
||||
return AreEditorsActive() && releaseMouse;
|
||||
}
|
||||
|
||||
void DrawToolWindows()
|
||||
{
|
||||
#if 0
|
||||
ImGui::Begin( "Show Ingame Editors", &showToolWindows, 0 );
|
||||
|
||||
ImGui::Checkbox( "Light", &LightEditor::showIt );
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox( "Particle", &showParticlesEditor );
|
||||
#endif // 0
|
||||
|
||||
if( LightEditor::showIt )
|
||||
{
|
||||
LightEditor::Draw();
|
||||
}
|
||||
|
||||
// TODO: other editor windows..
|
||||
//ImGui::End();
|
||||
}
|
||||
|
||||
void LightEditorInit( const idDict* dict, idEntity* ent )
|
||||
{
|
||||
if( dict == NULL || ent == NULL ) return;
|
||||
|
||||
// NOTE: we can't access idEntity (it's just a declaration), because it should
|
||||
// be game/mod specific. but we can at least check the spawnclass from the dict.
|
||||
idassert( idStr::Icmp( dict->GetString( "spawnclass" ), "idLight" ) == 0
|
||||
&& "LightEditorInit() must only be called with light entities or NULL!" );
|
||||
|
||||
|
||||
LightEditor::showIt = true;
|
||||
impl::SetReleaseToolMouse( true );
|
||||
|
||||
LightEditor::ReInit( dict, ent );
|
||||
}
|
||||
|
||||
} //namespace ImGuiTools
|
620
neo/tools/imgui/lighteditor/LightEditor.cpp
Normal file
620
neo/tools/imgui/lighteditor/LightEditor.cpp
Normal file
|
@ -0,0 +1,620 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015 Daniel Gibson
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "LightEditor.h"
|
||||
|
||||
#include "../imgui/BFGimgui.h"
|
||||
|
||||
#include "renderer/Material.h"
|
||||
#include "renderer/Image.h"
|
||||
|
||||
namespace ImGuiTools
|
||||
{
|
||||
|
||||
void LightInfo::Defaults()
|
||||
{
|
||||
pointLight = true;
|
||||
fallOff = 1.0f;
|
||||
strTexture = "";
|
||||
equalRadius = true;
|
||||
explicitStartEnd = false;
|
||||
lightStart.Zero();
|
||||
lightEnd.Zero();
|
||||
lightUp.Zero();
|
||||
lightRight.Zero();
|
||||
lightTarget.Zero();
|
||||
lightCenter.Zero();
|
||||
color[0] = color[1] = color[2] = 1.0f;
|
||||
|
||||
#if 0 // FIXME: unused, delete?
|
||||
fog = false;
|
||||
fogDensity.Zero();
|
||||
|
||||
strobe = false;
|
||||
strobeSpeed = 0.0f;
|
||||
rotate = false;
|
||||
rotateSpeed = 0.0f;
|
||||
#endif // 0
|
||||
|
||||
lightRadius.Zero();
|
||||
castShadows = true;
|
||||
castSpecular = true;
|
||||
castDiffuse = true;
|
||||
hasCenter = false;
|
||||
isParallel = false;
|
||||
}
|
||||
|
||||
|
||||
void LightInfo::DefaultPoint()
|
||||
{
|
||||
idVec3 oldColor = color;
|
||||
Defaults();
|
||||
color = oldColor;
|
||||
pointLight = true;
|
||||
}
|
||||
|
||||
void LightInfo::DefaultProjected()
|
||||
{
|
||||
idVec3 oldColor = color;
|
||||
Defaults();
|
||||
color = oldColor;
|
||||
pointLight = false;
|
||||
lightTarget[2] = -256;
|
||||
lightUp[1] = -128;
|
||||
lightRight[0] = -128;
|
||||
}
|
||||
|
||||
void LightInfo::FromDict( const idDict* e )
|
||||
{
|
||||
|
||||
lightRadius.Zero();
|
||||
lightTarget.Zero();
|
||||
lightRight.Zero();
|
||||
lightUp.Zero();
|
||||
lightStart.Zero();
|
||||
lightEnd.Zero();
|
||||
lightCenter.Zero();
|
||||
|
||||
castShadows = !e->GetBool( "noshadows" );
|
||||
castSpecular = !e->GetBool( "nospecular" );
|
||||
castDiffuse = !e->GetBool( "nodiffuse" );
|
||||
fallOff = e->GetFloat( "falloff" );
|
||||
strTexture = e->GetString( "texture" );
|
||||
|
||||
isParallel = e->GetBool( "parallel" );
|
||||
|
||||
if( !e->GetVector( "_color", "", color ) )
|
||||
{
|
||||
color[0] = color[1] = color[2] = 1.0f;
|
||||
// NOTE: like the game, imgui uses color values between 0.0 and 1.0
|
||||
// even though it displays them as 0 to 255
|
||||
}
|
||||
|
||||
#if 0 // FIXME: unused, delete?
|
||||
if( e->GetVec4( "fog", "", fogDensity ) )
|
||||
{
|
||||
fog = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fog = false;
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
if( e->GetVector( "light_right", "", lightRight ) )
|
||||
{
|
||||
// projected light
|
||||
pointLight = false;
|
||||
e->GetVector( "light_target", "", lightTarget );
|
||||
e->GetVector( "light_up", "", lightUp );
|
||||
if( e->GetVector( "light_start", "", lightStart ) )
|
||||
{
|
||||
// explicit start and end points
|
||||
explicitStartEnd = true;
|
||||
if( !e->GetVector( "light_end", "", lightEnd ) )
|
||||
{
|
||||
// no end, use target
|
||||
lightEnd = lightTarget;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
explicitStartEnd = false;
|
||||
// create a start a quarter of the way to the target
|
||||
lightStart = lightTarget * 0.25;
|
||||
lightEnd = lightTarget;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pointLight = true;
|
||||
if( e->GetVector( "light_radius", "", lightRadius ) )
|
||||
{
|
||||
equalRadius = ( lightRadius.x == lightRadius.y && lightRadius.x == lightRadius.z );
|
||||
}
|
||||
else
|
||||
{
|
||||
float radius = e->GetFloat( "light" );
|
||||
if( radius == 0 )
|
||||
{
|
||||
radius = 300;
|
||||
}
|
||||
lightRadius[0] = lightRadius[1] = lightRadius[2] = radius;
|
||||
equalRadius = true;
|
||||
}
|
||||
if( e->GetVector( "light_center", "", lightCenter ) )
|
||||
{
|
||||
hasCenter = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the returned idDict is supposed to be used by idGameEdit::EntityChangeSpawnArgs()
|
||||
// and thus will contain pairs with value "" if the key should be removed from entity
|
||||
void LightInfo::ToDict( idDict* e )
|
||||
{
|
||||
// idGameEdit::EntityChangeSpawnArgs() will delete key/value from entity,
|
||||
// if value is "" => use DELETE_VAL for readability
|
||||
static const char* DELETE_VAL = "";
|
||||
|
||||
e->Set( "light", DELETE_VAL ); // we always use "light_radius" instead
|
||||
|
||||
e->Set( "noshadows", ( !castShadows ) ? "1" : "0" );
|
||||
e->Set( "nospecular", ( !castSpecular ) ? "1" : "0" );
|
||||
e->Set( "nodiffuse", ( !castDiffuse ) ? "1" : "0" );
|
||||
|
||||
e->SetFloat( "falloff", fallOff );
|
||||
|
||||
if( strTexture.Length() > 0 )
|
||||
{
|
||||
e->Set( "texture", strTexture );
|
||||
}
|
||||
else
|
||||
{
|
||||
e->Set( "texture", DELETE_VAL );
|
||||
}
|
||||
|
||||
e->Set( "_color", color.ToString( 4 ) ); // NOTE: e->SetVector() uses precision of 2, not enough for color
|
||||
|
||||
#if 0 // DG: I think this isn't used
|
||||
if( fog )
|
||||
{
|
||||
idVec4 tmp( fogDensity );
|
||||
tmp *= 1.0f / 255.0f; // TODO: why not just make fogdensity values between 0 and 1 to start with?
|
||||
e->SetVec4( "fog", tmp );
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
if( pointLight )
|
||||
{
|
||||
if( !equalRadius )
|
||||
{
|
||||
e->SetVector( "light_radius", lightRadius );
|
||||
}
|
||||
else
|
||||
{
|
||||
idVec3 tmp( lightRadius[0] ); // x, y and z have the same value
|
||||
e->SetVector( "light_radius", tmp );
|
||||
}
|
||||
|
||||
if( hasCenter )
|
||||
{
|
||||
e->SetVector( "light_center", lightCenter );
|
||||
}
|
||||
else
|
||||
{
|
||||
e->Set( "light_center", DELETE_VAL );
|
||||
}
|
||||
|
||||
e->Set( "parallel", isParallel ? "1" : DELETE_VAL );
|
||||
|
||||
// get rid of all the projected light specific stuff
|
||||
e->Set( "light_target", DELETE_VAL );
|
||||
e->Set( "light_up", DELETE_VAL );
|
||||
e->Set( "light_right", DELETE_VAL );
|
||||
e->Set( "light_start", DELETE_VAL );
|
||||
e->Set( "light_end", DELETE_VAL );
|
||||
}
|
||||
else
|
||||
{
|
||||
e->SetVector( "light_target", lightTarget );
|
||||
e->SetVector( "light_up", lightUp );
|
||||
e->SetVector( "light_right", lightRight );
|
||||
if( explicitStartEnd )
|
||||
{
|
||||
e->SetVector( "light_start", lightStart );
|
||||
e->SetVector( "light_end", lightEnd );
|
||||
}
|
||||
else
|
||||
{
|
||||
e->Set( "light_start", DELETE_VAL );
|
||||
e->Set( "light_end", DELETE_VAL );
|
||||
}
|
||||
|
||||
// get rid of the pointlight specific stuff
|
||||
e->Set( "light_radius", DELETE_VAL );
|
||||
e->Set( "light_center", DELETE_VAL );
|
||||
e->Set( "parallel", DELETE_VAL );
|
||||
}
|
||||
}
|
||||
|
||||
LightInfo::LightInfo()
|
||||
{
|
||||
Defaults();
|
||||
}
|
||||
|
||||
|
||||
// ########### LightEditor #############
|
||||
|
||||
// static
|
||||
LightEditor LightEditor::TheLightEditor;
|
||||
|
||||
// static
|
||||
bool LightEditor::showIt = false;
|
||||
|
||||
// static
|
||||
void LightEditor::ReInit( const idDict* dict, idEntity* light )
|
||||
{
|
||||
// TODO: if the lighteditor is currently shown, show a warning first about saving current changes to the last light?
|
||||
TheLightEditor.Init( dict, light );
|
||||
}
|
||||
|
||||
// static
|
||||
void LightEditor::Draw()
|
||||
{
|
||||
TheLightEditor.DrawWindow();
|
||||
}
|
||||
|
||||
void LightEditor::Init( const idDict* dict, idEntity* light )
|
||||
{
|
||||
Reset();
|
||||
|
||||
if( textureNames.Num() == 0 )
|
||||
{
|
||||
LoadLightTextures();
|
||||
}
|
||||
|
||||
if( dict )
|
||||
{
|
||||
original.FromDict( dict );
|
||||
//current = original;
|
||||
cur.FromDict( dict );
|
||||
|
||||
const char* name = dict->GetString( "name", NULL );
|
||||
if( name )
|
||||
{
|
||||
entityName = name;
|
||||
title.Format( "Light Editor: %s", name );
|
||||
}
|
||||
else
|
||||
{
|
||||
idassert( 0 && "LightEditor::Init(): Given entity has no 'name' property?!" );
|
||||
entityName = ""; // TODO: generate name or handle gracefully or something?
|
||||
}
|
||||
|
||||
currentTextureIndex = 0;
|
||||
currentTexture = NULL;
|
||||
if( original.strTexture.Length() > 0 )
|
||||
{
|
||||
const char* curTex = original.strTexture.c_str();
|
||||
for( int i = 0; i < textureNames.Num(); ++i )
|
||||
{
|
||||
if( textureNames[i] == curTex )
|
||||
{
|
||||
currentTextureIndex = i + 1; // remember, 0 is "<No Texture>"
|
||||
LoadCurrentTexture();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->lightEntity = light;
|
||||
}
|
||||
|
||||
void LightEditor::Reset()
|
||||
{
|
||||
title = "Light Editor: no Light selected!";
|
||||
original.Defaults();
|
||||
cur.Defaults();
|
||||
lightEntity = NULL;
|
||||
currentTextureIndex = 0;
|
||||
currentTexture = NULL;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class idSort_textureNames : public idSort_Quick< idStr, idSort_textureNames >
|
||||
{
|
||||
public:
|
||||
int Compare( const idStr& a, const idStr& b ) const
|
||||
{
|
||||
return a.Icmp( b );
|
||||
}
|
||||
};
|
||||
} //anon. namespace
|
||||
|
||||
void LightEditor::LoadLightTextures()
|
||||
{
|
||||
textureNames.Clear();
|
||||
int count = declManager->GetNumDecls( DECL_MATERIAL );
|
||||
const idMaterial* mat;
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
mat = declManager->MaterialByIndex( i, false );
|
||||
idStr str = mat->GetName();
|
||||
str.ToLower(); // FIXME: why? (this is from old doom3 code)
|
||||
if( str.Icmpn( "lights/", strlen( "lights/" ) ) == 0 || str.Icmpn( "fogs/", strlen( "fogs/" ) ) == 0 )
|
||||
{
|
||||
textureNames.Append( str );
|
||||
}
|
||||
}
|
||||
textureNames.SortWithTemplate( idSort_textureNames() );
|
||||
}
|
||||
|
||||
// static
|
||||
bool LightEditor::TextureItemsGetter( void* data, int idx, const char** out_text )
|
||||
{
|
||||
LightEditor* self = static_cast<LightEditor*>( data );
|
||||
if( idx == 0 )
|
||||
{
|
||||
*out_text = "<No Texture>";
|
||||
return true;
|
||||
}
|
||||
--idx; // as index 0 has special purpose, the "real" index is one less
|
||||
if( idx < 0 || idx >= self->textureNames.Num() )
|
||||
{
|
||||
*out_text = "<Invalid Index!>";
|
||||
return false;
|
||||
}
|
||||
*out_text = self->textureNames[idx].c_str();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LightEditor::LoadCurrentTexture()
|
||||
{
|
||||
currentTexture = NULL;
|
||||
if( currentTextureIndex > 0 && cur.strTexture.Length() > 0 )
|
||||
{
|
||||
const idMaterial* mat = declManager->FindMaterial( cur.strTexture, false );
|
||||
if( mat != NULL )
|
||||
{
|
||||
currentTexture = mat->GetEditorImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LightEditor::TempApplyChanges()
|
||||
{
|
||||
if( lightEntity != NULL )
|
||||
{
|
||||
idDict d;
|
||||
cur.ToDict( &d );
|
||||
gameEdit->EntityChangeSpawnArgs( lightEntity, &d );
|
||||
gameEdit->EntityUpdateChangeableSpawnArgs( lightEntity, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
void LightEditor::SaveChanges()
|
||||
{
|
||||
idDict d;
|
||||
cur.ToDict( &d );
|
||||
if( entityName[0] != '\0' )
|
||||
{
|
||||
gameEdit->MapCopyDictToEntity( entityName, &d );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( 0 && "FIXME: implement LightEditor::SaveChanges() properly for entities without names (new ones?)" );
|
||||
|
||||
#if 0 // TODO: I'm not quite sure about this, we prolly need to set a name before anyway for TempApplyChanges()
|
||||
entityName = "light_42"; // FIXME: generate unique name!!
|
||||
title.Format( "Light Editor: %s", entityName );
|
||||
|
||||
d.Set( "name", entityName );
|
||||
|
||||
d.Set( "classname", "light" );
|
||||
d.Set( "spawnclass", "idLight" );
|
||||
|
||||
gameEdit->MapAddEntity( &d );
|
||||
#endif // 0
|
||||
}
|
||||
gameEdit->MapSave();
|
||||
}
|
||||
|
||||
void LightEditor::CancelChanges()
|
||||
{
|
||||
if( lightEntity != NULL )
|
||||
{
|
||||
idDict d;
|
||||
original.ToDict( &d );
|
||||
gameEdit->EntityChangeSpawnArgs( lightEntity, &d );
|
||||
gameEdit->EntityUpdateChangeableSpawnArgs( lightEntity, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
// a kinda ugly hack to get a float* (as used by imgui) from idVec3
|
||||
static float* vecToArr( idVec3& v )
|
||||
{
|
||||
return &v.x;
|
||||
}
|
||||
|
||||
void LightEditor::DrawWindow()
|
||||
{
|
||||
bool showWindow = showIt;
|
||||
if( ImGui::Begin( title, &showWindow ) ) //, ImGuiWindowFlags_ShowBorders ) )
|
||||
{
|
||||
bool changes = false;
|
||||
|
||||
changes |= ImGui::Checkbox( "Cast Shadows", &cur.castShadows );
|
||||
ImGui::SameLine();
|
||||
changes |= ImGui::Checkbox( "Cast Diffuse", &cur.castDiffuse );
|
||||
changes |= ImGui::Checkbox( "Cast Specular", &cur.castSpecular );
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
changes |= ImGui::ColorEdit3( "Color", vecToArr( cur.color ) );
|
||||
|
||||
// TODO: fog, fogDensity - probably unused!
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
int lightSelectionRadioBtn = cur.pointLight ? 0 : 1;
|
||||
|
||||
changes |= ImGui::RadioButton( "Point Light", &lightSelectionRadioBtn, 0 );
|
||||
ImGui::SameLine();
|
||||
changes |= ImGui::RadioButton( "Projected Light", &lightSelectionRadioBtn, 1 );
|
||||
|
||||
cur.pointLight = ( lightSelectionRadioBtn == 0 );
|
||||
|
||||
ImGui::Indent();
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if( lightSelectionRadioBtn == 0 )
|
||||
{
|
||||
ImGui::PushItemWidth( -1.0f ); // align end of Drag* with right window border
|
||||
|
||||
changes |= ImGui::Checkbox( "Equilateral Radius", &cur.equalRadius );
|
||||
ImGui::Text( "Radius:" );
|
||||
ImGui::Indent();
|
||||
if( cur.equalRadius )
|
||||
{
|
||||
if( ImGui::DragFloat( "##radEquil", &cur.lightRadius.x, 1.0f, 0.0f, 10000.0f, "%.1f" ) )
|
||||
{
|
||||
cur.lightRadius.z = cur.lightRadius.y = cur.lightRadius.x;
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
changes |= ImGui::DragVec3( "##radXYZ", cur.lightRadius );
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
// TODO: this could as well be a slider or something, if 0/0.5/1 is too restricting
|
||||
|
||||
ImGui::Text( "Fall-off:" );
|
||||
ImGui::SameLine();
|
||||
#if 0
|
||||
ImGui::RadioButton( "0.0", &fallOffRadio, 0 );
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton( "0.5", &fallOffRadio, 1 );
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton( "1.0", &fallOffRadio, 2 );
|
||||
#endif // 0
|
||||
|
||||
// a slider is easier than radiobuttons.. does it really have to be radiobuttons?
|
||||
changes |= ImGui::SliderFloat( "##FallOff", &cur.fallOff, 0.0f, 1.0f, "%.1f" );
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
changes |= ImGui::Checkbox( "Parallel", &cur.isParallel );
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
changes |= ImGui::Checkbox( "Center", &cur.hasCenter );
|
||||
if( cur.hasCenter )
|
||||
{
|
||||
ImGui::Indent();
|
||||
changes |= ImGui::DragVec3( "##centerXYZ", cur.lightCenter, 1.0f, 0.0f, 10000.0f, "%.1f" );
|
||||
ImGui::Unindent();
|
||||
}
|
||||
ImGui::PopItemWidth(); // back to default alignment on right side
|
||||
}
|
||||
else if( lightSelectionRadioBtn == 1 )
|
||||
{
|
||||
changes |= ImGui::DragVec3( "Target", cur.lightTarget, 1.0f, 0.0f, 0.0f, "%.1f" );
|
||||
changes |= ImGui::DragVec3( "Right", cur.lightRight, 1.0f, 0.0f, 0.0f, "%.1f" );
|
||||
changes |= ImGui::DragVec3( "Up", cur.lightUp, 1.0f, 0.0f, 0.0f, "%.1f" );
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
changes |= ImGui::Checkbox( "Explicit start/end points", &cur.explicitStartEnd );
|
||||
|
||||
ImGui::Spacing();
|
||||
if( cur.explicitStartEnd )
|
||||
{
|
||||
changes |= ImGui::DragVec3( "Start", cur.lightStart, 1.0f, 0.0f, 0.0f, "%.1f" );
|
||||
changes |= ImGui::DragVec3( "End", cur.lightEnd, 1.0f, 0.0f, 0.0f, "%.1f" );
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Unindent();
|
||||
|
||||
if( ImGui::Combo( "Texture", ¤tTextureIndex, TextureItemsGetter, this, textureNames.Num() + 1 ) )
|
||||
{
|
||||
changes = true;
|
||||
// -1 because 0 is "<No Texture>"
|
||||
cur.strTexture = ( currentTextureIndex > 0 ) ? textureNames[currentTextureIndex - 1] : "";
|
||||
LoadCurrentTexture();
|
||||
}
|
||||
|
||||
if( currentTexture != NULL )
|
||||
{
|
||||
ImVec2 size( currentTexture->GetUploadWidth(), currentTexture->GetUploadHeight() );
|
||||
ImGui::Image( currentTexture->GetImGuiTextureID(), size, ImVec2( 0, 0 ), ImVec2( 1, 1 ),
|
||||
ImColor( 255, 255, 255, 255 ), ImColor( 255, 255, 255, 128 ) );
|
||||
}
|
||||
|
||||
// TODO: allow multiple lights selected at the same time + "apply different" button?
|
||||
// then only the changed attribute (e.g. color) would be set to all lights,
|
||||
// but they'd keep their other individual properties (eg radius)
|
||||
|
||||
if( ImGui::Button( "Save to .map" ) )
|
||||
{
|
||||
SaveChanges();
|
||||
showWindow = false;
|
||||
}
|
||||
else if( ImGui::SameLine(), ImGui::Button( "Cancel" ) )
|
||||
{
|
||||
CancelChanges();
|
||||
showWindow = false;
|
||||
}
|
||||
else if( changes )
|
||||
{
|
||||
TempApplyChanges();
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
if( showIt && !showWindow )
|
||||
{
|
||||
// TODO: do the same as when pressing cancel?
|
||||
showIt = showWindow;
|
||||
impl::SetReleaseToolMouse( false );
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace ImGuiTools
|
129
neo/tools/imgui/lighteditor/LightEditor.h
Normal file
129
neo/tools/imgui/lighteditor/LightEditor.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 2015 Daniel Gibson
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// a GUI light editor, based loosely on the one from original Doom3 (neo/tools/radiant/LightDlg.*)
|
||||
// LightInfo was CLightInfo, the LightEditor itself was written from scratch.
|
||||
|
||||
#ifndef NEO_TOOLS_EDITORS_LIGHTEDITOR_H_
|
||||
#define NEO_TOOLS_EDITORS_LIGHTEDITOR_H_
|
||||
|
||||
#include <idlib/Dict.h>
|
||||
#include "../../edit_public.h"
|
||||
|
||||
|
||||
namespace ImGuiTools
|
||||
{
|
||||
|
||||
class LightInfo
|
||||
{
|
||||
public:
|
||||
bool pointLight;
|
||||
float fallOff;
|
||||
idStr strTexture;
|
||||
bool equalRadius;
|
||||
bool explicitStartEnd;
|
||||
idVec3 lightStart;
|
||||
idVec3 lightEnd;
|
||||
idVec3 lightUp;
|
||||
idVec3 lightRight;
|
||||
idVec3 lightTarget;
|
||||
idVec3 lightCenter;
|
||||
idVec3 color;
|
||||
|
||||
|
||||
#if 0 // FIXME: unused, delete?
|
||||
bool fog;
|
||||
idVec4 fogDensity;
|
||||
|
||||
bool strobe;
|
||||
float strobeSpeed;
|
||||
bool rotate;
|
||||
float rotateSpeed;
|
||||
#endif // 0
|
||||
|
||||
idVec3 lightRadius;
|
||||
bool castShadows;
|
||||
bool castSpecular;
|
||||
bool castDiffuse;
|
||||
bool hasCenter;
|
||||
bool isParallel;
|
||||
|
||||
LightInfo();
|
||||
|
||||
void Defaults();
|
||||
void DefaultProjected();
|
||||
void DefaultPoint();
|
||||
void FromDict( const idDict* e );
|
||||
void ToDict( idDict* e );
|
||||
};
|
||||
|
||||
class LightEditor
|
||||
{
|
||||
idStr title;
|
||||
idStr entityName;
|
||||
LightInfo original;
|
||||
LightInfo cur; // current status of the light
|
||||
|
||||
idEntity* lightEntity;
|
||||
|
||||
idList<idStr> textureNames;
|
||||
int currentTextureIndex;
|
||||
idImage* currentTexture;
|
||||
|
||||
void Init( const idDict* dict, idEntity* light );
|
||||
void Reset();
|
||||
|
||||
void LoadLightTextures();
|
||||
static bool TextureItemsGetter( void* data, int idx, const char** out_text );
|
||||
void LoadCurrentTexture();
|
||||
|
||||
void DrawWindow();
|
||||
|
||||
void TempApplyChanges();
|
||||
void SaveChanges();
|
||||
void CancelChanges();
|
||||
|
||||
LightEditor()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
static LightEditor TheLightEditor; // FIXME: maybe at some point we could allow more than one..
|
||||
|
||||
public:
|
||||
static void ReInit( const idDict* dict, idEntity* light );
|
||||
|
||||
static void Draw();
|
||||
|
||||
static bool showIt;
|
||||
};
|
||||
|
||||
} //namespace ImGuiTools
|
||||
|
||||
#endif /* NEO_TOOLS_EDITORS_LIGHTEDITOR_H_ */
|
Loading…
Reference in a new issue