mirror of
https://github.com/theclub654/ProjectCane.git
synced 2024-11-23 06:19:53 +00:00
Fixed alot of heap corruptions and also integrated imgui
This commit is contained in:
parent
9c2f98be9f
commit
60bf9578c5
36
.gitignore
vendored
36
.gitignore
vendored
@ -1,20 +1,22 @@
|
||||
.vs/
|
||||
Sly1/x64/
|
||||
x64/
|
||||
Sly1/jb_intro
|
||||
Sly1/uw_bonus_drivewheels_final
|
||||
Sly1/uw_bonus_library
|
||||
Sly1/uw_bonus_security
|
||||
Sly1/uw_boss_blimp
|
||||
Sly1/uw_c2_final
|
||||
Sly1/uw_exterior_approach
|
||||
Sly1/uw_rip_off
|
||||
Sly1/uw_t3_final
|
||||
Sly1/ms_approach
|
||||
Sly1/ms_casino
|
||||
Sly1/ms_exterior
|
||||
Sly1/ms_inspector
|
||||
Sly1/ms_rooftop
|
||||
Sly1/ms_sniper
|
||||
Sly1/ms_suv
|
||||
Sly1/ms_vertigo
|
||||
Sly1/jb_intro.brx
|
||||
Sly1/uw_bonus_drivewheels_final.brx
|
||||
Sly1/uw_bonus_library.brx
|
||||
Sly1/uw_bonus_security.brx
|
||||
Sly1/uw_boss_blimp.brx
|
||||
Sly1/uw_c2_final.brx
|
||||
Sly1/uw_exterior_approach.brx
|
||||
Sly1/uw_rip_off.brx
|
||||
Sly1/uw_t3_final.brx
|
||||
Sly1/ms_approach.brx
|
||||
Sly1/ms_casino.brx
|
||||
Sly1/ms_exterior.brx
|
||||
Sly1/ms_inspector.brx
|
||||
Sly1/ms_rooftop.brx
|
||||
Sly1/ms_sniper.brx
|
||||
Sly1/ms_suv.brx
|
||||
Sly1/ms_vertigo.brx
|
||||
Sly1/Sunset Snake Eyes
|
||||
Sly1/Tide of Terror
|
4431
Libraries/include/imgui/ImGuiFileDialog.cpp
Normal file
4431
Libraries/include/imgui/ImGuiFileDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1959
Libraries/include/imgui/ImGuiFileDialog.h
Normal file
1959
Libraries/include/imgui/ImGuiFileDialog.h
Normal file
File diff suppressed because it is too large
Load Diff
127
Libraries/include/imgui/ImGuiFileDialogConfig.h
Normal file
127
Libraries/include/imgui/ImGuiFileDialogConfig.h
Normal file
@ -0,0 +1,127 @@
|
||||
#pragma once
|
||||
|
||||
// uncomment and modify defines under for customize ImGuiFileDialog
|
||||
|
||||
//this options need c++17
|
||||
//#define USE_STD_FILESYSTEM
|
||||
|
||||
//#define MAX_FILE_DIALOG_NAME_BUFFER 1024
|
||||
//#define MAX_PATH_BUFFER_SIZE 1024
|
||||
|
||||
// the slash's buttons in path cna be used for quick select parallles directories
|
||||
//#define USE_QUICK_PATH_SELECT
|
||||
|
||||
// the spacing between button path's can be customized.
|
||||
// if disabled the spacing is defined by the imgui theme
|
||||
// define the space between path buttons
|
||||
//#define CUSTOM_PATH_SPACING 2
|
||||
|
||||
//#define USE_THUMBNAILS
|
||||
//the thumbnail generation use the stb_image and stb_resize lib who need to define the implementation
|
||||
//btw if you already use them in your app, you can have compiler error due to "implemntation found in double"
|
||||
//so uncomment these line for prevent the creation of implementation of these libs again
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_IMPLEMENTATION
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||
//#define IMGUI_RADIO_BUTTON RadioButton
|
||||
//#define DisplayMode_ThumbailsList_ImageHeight 32.0f
|
||||
//#define tableHeaderFileThumbnailsString "Thumbnails"
|
||||
//#define DisplayMode_FilesList_ButtonString "FL"
|
||||
//#define DisplayMode_FilesList_ButtonHelp "File List"
|
||||
//#define DisplayMode_ThumbailsList_ButtonString "TL"
|
||||
//#define DisplayMode_ThumbailsList_ButtonHelp "Thumbnails List"
|
||||
// todo
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonString "TG"
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonHelp "Thumbnails Grid"
|
||||
|
||||
//#define USE_EXPLORATION_BY_KEYS
|
||||
// this mapping by default is for GLFW but you can use another
|
||||
//#include <GLFW/glfw3.h>
|
||||
// Up key for explore to the top
|
||||
//#define IGFD_KEY_UP ImGuiKey_UpArrow
|
||||
// Down key for explore to the bottom
|
||||
//#define IGFD_KEY_DOWN ImGuiKey_DownArrow
|
||||
// Enter key for open directory
|
||||
//#define IGFD_KEY_ENTER ImGuiKey_Enter
|
||||
// BackSpace for comming back to the last directory
|
||||
//#define IGFD_KEY_BACKSPACE ImGuiKey_Backspace
|
||||
|
||||
// by ex you can quit the dialog by pressing the key excape
|
||||
//#define USE_DIALOG_EXIT_WITH_KEY
|
||||
//#define IGFD_EXIT_KEY ImGuiKey_Escape
|
||||
|
||||
// widget
|
||||
// begin combo widget
|
||||
// #define IMGUI_BEGIN_COMBO ImGui::BeginCombo
|
||||
// filter combobox width
|
||||
//#define FILTER_COMBO_WIDTH 120.0f
|
||||
// button widget use for compose path
|
||||
//#define IMGUI_PATH_BUTTON ImGui::Button
|
||||
// standard button
|
||||
//#define IMGUI_BUTTON ImGui::Button
|
||||
|
||||
// locales string
|
||||
//#define createDirButtonString "+"
|
||||
//#define resetButtonString "R"
|
||||
//#define drivesButtonString "Drives"
|
||||
//#define editPathButtonString "E"
|
||||
//#define searchString "Search"
|
||||
//#define dirEntryString "[DIR] "
|
||||
//#define linkEntryString "[LINK] "
|
||||
//#define fileEntryString "[FILE] "
|
||||
//#define fileNameString "File Name : "
|
||||
//#define dirNameString "Directory Path :"
|
||||
//#define buttonResetSearchString "Reset search"
|
||||
//#define buttonDriveString "Drives"
|
||||
//#define buttonEditPathString "Edit path\nYou can also right click on path buttons"
|
||||
//#define buttonResetPathString "Reset to current directory"
|
||||
//#define buttonCreateDirString "Create Directory"
|
||||
//#define OverWriteDialogTitleString "The file Already Exist !"
|
||||
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
|
||||
//#define OverWriteDialogConfirmButtonString "Confirm"
|
||||
//#define OverWriteDialogCancelButtonString "Cancel"
|
||||
|
||||
//Validation buttons
|
||||
//#define okButtonString " OK"
|
||||
//#define okButtonWidth 0.0f
|
||||
//#define cancelButtonString " Cancel"
|
||||
//#define cancelButtonWidth 0.0f
|
||||
//alignement [0:1], 0.0 is left, 0.5 middle, 1.0 right, and other ratios
|
||||
//#define okCancelButtonAlignement 0.0f
|
||||
//#define invertOkAndCancelButtons 0
|
||||
|
||||
// DateTimeFormat
|
||||
// see strftime functionin <ctime> for customize
|
||||
// "%Y/%m/%d %H:%M" give 2021:01:22 11:47
|
||||
// "%Y/%m/%d %i:%M%p" give 2021:01:22 11:45PM
|
||||
//#define DateTimeFormat "%Y/%m/%d %i:%M%p"
|
||||
|
||||
// theses icons will appear in table headers
|
||||
//#define USE_CUSTOM_SORTING_ICON
|
||||
//#define tableHeaderAscendingIcon "A|"
|
||||
//#define tableHeaderDescendingIcon "D|"
|
||||
//#define tableHeaderFileNameString " File name"
|
||||
//#define tableHeaderFileTypeString " Type"
|
||||
//#define tableHeaderFileSizeString " Size"
|
||||
//#define tableHeaderFileDateTimeString " Date"
|
||||
//#define fileSizeBytes "o"
|
||||
//#define fileSizeKiloBytes "Ko"
|
||||
//#define fileSizeMegaBytes "Mo"
|
||||
//#define fileSizeGigaBytes "Go"
|
||||
|
||||
// default table sort field (must be FIELD_FILENAME, FIELD_TYPE, FIELD_SIZE, FIELD_DATE or FIELD_THUMBNAILS)
|
||||
//#define defaultSortField FIELD_FILENAME
|
||||
|
||||
// default table sort order for each field (true => Descending, false => Ascending)
|
||||
//#define defaultSortOrderFilename true
|
||||
//#define defaultSortOrderType true
|
||||
//#define defaultSortOrderSize true
|
||||
//#define defaultSortOrderDate true
|
||||
//#define defaultSortOrderThumbnails true
|
||||
|
||||
//#define USE_BOOKMARK
|
||||
//#define bookmarkPaneWith 150.0f
|
||||
//#define IMGUI_TOGGLE_BUTTON ToggleButton
|
||||
//#define bookmarksButtonString "Bookmark"
|
||||
//#define bookmarksButtonHelpString "Bookmark"
|
||||
//#define addBookmarkButtonString "+"
|
||||
//#define removeBookmarkButtonString "-"
|
129
Libraries/include/imgui/dirent/ChangeLog
Normal file
129
Libraries/include/imgui/dirent/ChangeLog
Normal file
@ -0,0 +1,129 @@
|
||||
2018-05-08 Toni Rönkkö
|
||||
|
||||
* Version 1.23.2: fixes bad scandir prototype.
|
||||
|
||||
2017-08-27 Toni Rönkkö
|
||||
|
||||
* Version 1.23: support readdir_r and scandir functions.
|
||||
|
||||
2017-07-18 Toni Rönkkö
|
||||
|
||||
* Created release branches v1.22 and v1.21 to Git. Published version
|
||||
1.22 at softagalleria.net.
|
||||
|
||||
2016-09-11 Toni Rönkkö
|
||||
|
||||
* Version 1.22: added support for CMake. Thanks to Paul Fultz II.
|
||||
|
||||
2014-09-25 Toni Rönkkö
|
||||
|
||||
* Version 1.21: compiles correctly under Open Watcom. Thanks to
|
||||
Virgil Banowetz for a patch!
|
||||
|
||||
2014-04-07 Toni Rönkkö
|
||||
|
||||
* Version 1.20.1: the zip file from the previous version did not open
|
||||
correctly with Microsoft's compressed folders. Thanks to Alexandre
|
||||
for info!
|
||||
|
||||
2014-03-17 Toni Ronkko
|
||||
|
||||
* Version 1.20: dirent.h compiles correctly in 64-bit architecture.
|
||||
Thanks to Aaron Simmons!
|
||||
|
||||
2014-03-03 Toni Ronkko
|
||||
|
||||
* Version 1.13.2: define DT_LNK for compatibility with Unix
|
||||
programs. Thanks to Joel Bruick for suggestion!
|
||||
|
||||
2013-01-27 Toni Ronkko
|
||||
|
||||
* Version 1.13.1: patch from Edward Berner fixes set_errno() on
|
||||
Windows NT 4.0.
|
||||
|
||||
* Revised wcstombs() and mbstowcs() wrappers to make sure that they do
|
||||
not write past their target string.
|
||||
|
||||
* PATH_MAX from windows.h includes zero terminator so there is no
|
||||
need to add one extra byte to variables and structures.
|
||||
|
||||
2012-12-12 Toni Ronkko
|
||||
|
||||
* Version 1.13: use the traditional 8+3 file naming scheme if a file
|
||||
name cannot be represented in the default ANSI code page. Now
|
||||
compiles again with MSVC 6.0. Thanks to Konstantin Khomoutov for
|
||||
testing.
|
||||
|
||||
2012-10-01 Toni Ronkko
|
||||
|
||||
* Version 1.12.1: renamed wide-character DIR structure _wDIR to
|
||||
_WDIR (with capital W) in order to maintain compatibility with MingW.
|
||||
|
||||
2012-09-30 Toni Ronkko
|
||||
|
||||
* Version 1.12: define PATH_MAX and NAME_MAX. Added wide-character
|
||||
variants _wDIR, _wdirent, _wopendir(), _wreaddir(), _wclosedir() and
|
||||
_wrewinddir(). Thanks to Edgar Buerkle and Jan Nijtmans for ideas
|
||||
and code.
|
||||
|
||||
* Now avoiding windows.h. This allows dirent.h to be integrated
|
||||
more easily into programs using winsock. Thanks to Fernando
|
||||
Azaldegui.
|
||||
|
||||
2011-03-15 Toni Ronkko
|
||||
|
||||
* Version 1.11: defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
|
||||
|
||||
2010-08-11 Toni Ronkko
|
||||
|
||||
* Version 1.10: added d_type and d_namlen fields to dirent structure.
|
||||
The former is especially useful for determining whether directory
|
||||
entry represents a file or a directory. For more information, see
|
||||
http://www.delorie.com/gnu/docs/glibc/libc_270.html
|
||||
|
||||
* Improved conformance to the standards. For example, errno is now
|
||||
set properly on failure and assert() is never used. Thanks to Peter
|
||||
Brockam for suggestions.
|
||||
|
||||
* Fixed a bug in rewinddir(): when using relative directory names,
|
||||
change of working directory no longer causes rewinddir() to fail.
|
||||
|
||||
2009-12-15 John Cunningham
|
||||
|
||||
* Version 1.9: added rewinddir member function
|
||||
|
||||
2008-01-18 Toni Ronkko
|
||||
|
||||
* Version 1.8: Using FindFirstFileA and WIN32_FIND_DATAA to avoid
|
||||
converting string between multi-byte and unicode representations.
|
||||
This makes the code simpler and also allows the code to be compiled
|
||||
under MingW. Thanks to Azriel Fasten for the suggestion.
|
||||
|
||||
2007-03-04 Toni Ronkko
|
||||
|
||||
* Bug fix: due to the strncpy_s() function this file only compiled in
|
||||
Visual Studio 2005. Using the new string functions only when the
|
||||
compiler version allows.
|
||||
|
||||
2006-11-02 Toni Ronkko
|
||||
|
||||
* Major update: removed support for Watcom C, MS-DOS and Turbo C to
|
||||
simplify the file, updated the code to compile cleanly on Visual
|
||||
Studio 2005 with both unicode and multi-byte character strings,
|
||||
removed rewinddir() as it had a bug.
|
||||
|
||||
2006-08-20 Toni Ronkko
|
||||
|
||||
* Removed all remarks about MSVC 1.0, which is antiqued now.
|
||||
Simplified comments by removing SGML tags.
|
||||
|
||||
2002-05-14 Toni Ronkko
|
||||
|
||||
* Embedded the function definitions directly to the header so that no
|
||||
source modules need to be included in the Visual Studio project.
|
||||
Removed all the dependencies to other projects so that this header
|
||||
file can be used independently.
|
||||
|
||||
1998-05-28 Toni Ronkko
|
||||
|
||||
* First version.
|
21
Libraries/include/imgui/dirent/LICENSE
Normal file
21
Libraries/include/imgui/dirent/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 1998-2019 Toni Ronkko
|
||||
|
||||
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.
|
96
Libraries/include/imgui/dirent/README.md
Normal file
96
Libraries/include/imgui/dirent/README.md
Normal file
@ -0,0 +1,96 @@
|
||||
# Dirent
|
||||
Dirent is a C/C++ programming interface that allows programmers to retrieve
|
||||
information about files and directories under Linux/UNIX. This project
|
||||
provides Linux compatible Dirent interface for Microsoft Windows.
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
Download the latest Dirent installation package from
|
||||
[GitHub](https://github.com/tronkko/dirent/releases) and
|
||||
unpack the installation file with 7-zip, for example. The installation
|
||||
package contains dirent.h file as well as a few example programs and
|
||||
tests.
|
||||
|
||||
|
||||
## Install Dirent for All Programs
|
||||
|
||||
To make dirent.h available for all C/C++ programs, simply copy the
|
||||
``include/dirent.h`` file to the system include directory. System include
|
||||
directory contains header files such as assert.h and windows.h. In Visual
|
||||
Studio 2008, for example, the system include may be found at
|
||||
``C:\Program Files\Microsoft Visual Studio 9.0\VC\include``.
|
||||
|
||||
Everything you need is included in the single dirent.h file, and you can
|
||||
start using Dirent immediately -- there is no need to add files to your
|
||||
Visual Studio project.
|
||||
|
||||
|
||||
## Embed Dirent into Your Own Project
|
||||
|
||||
If you wish to distribute dirent.h alongside with your own source code, then
|
||||
copy ``include/dirent.h`` file to a new sub-directory within your project and
|
||||
add that directory to include path on Windows while omitting the directory
|
||||
under Linux/UNIX. This allows your project to be compiled against native
|
||||
dirent.h on Linux/UNIX while substituting the functionality on Microsoft
|
||||
Windows.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
The installation package contains four example programs:
|
||||
|
||||
Program | Purpose
|
||||
-------- | -----------------------------------------------------------------
|
||||
ls | List files in a directory, e.g. ls "c:\Program Files"
|
||||
find | Find files in subdirectories, e.g. find "c:\Program Files\CMake"
|
||||
updatedb | Build database of files in a drive, e.g. updatedb c:\
|
||||
locate | Locate a file from database, e.g. locate notepad.exe
|
||||
|
||||
To build the example programs, first install [CMake](https://cmake.org/).
|
||||
Then, with CMake installed, open command prompt and create a temporary
|
||||
directory ``c:\temp\dirent`` for the build files as
|
||||
|
||||
```
|
||||
c:\
|
||||
mkdir temp
|
||||
mkdir temp\dirent
|
||||
cd temp\dirent
|
||||
```
|
||||
|
||||
Generate build files as
|
||||
|
||||
```
|
||||
cmake d:\dirent
|
||||
```
|
||||
|
||||
where ``d:\dirent`` is the root directory of the Dirent package (containing
|
||||
this README.md and LICENSE file).
|
||||
|
||||
Once CMake is finished, open Visual Studio, load the generated dirent.sln file
|
||||
from the build directory and build the solution. Once the build completes, run
|
||||
the example programs from the command prompt as
|
||||
|
||||
```
|
||||
cd Debug
|
||||
ls .
|
||||
find .
|
||||
updatedb c:\
|
||||
locate cmd.exe
|
||||
```
|
||||
|
||||
|
||||
# Copying
|
||||
|
||||
Dirent may be freely distributed under the MIT license. See the
|
||||
[LICENSE](LICENSE) file for details.
|
||||
|
||||
|
||||
# Alternatives to Dirent
|
||||
|
||||
I ported Dirent to Microsoft Windows in 1998 when only a few alternatives
|
||||
were available. However, the situation has changed since then and nowadays
|
||||
both [Cygwin](http://www.cygwin.com) and [MingW](http://www.mingw.org)
|
||||
allow you to compile a great number of UNIX programs in Microsoft Windows.
|
||||
They both provide a full dirent API as well as many other UNIX APIs. MingW
|
||||
can even be used for commercial applications!
|
1160
Libraries/include/imgui/dirent/dirent.h
Normal file
1160
Libraries/include/imgui/dirent/dirent.h
Normal file
File diff suppressed because it is too large
Load Diff
129
Libraries/include/imgui/imconfig.h
Normal file
129
Libraries/include/imgui/imconfig.h
Normal file
@ -0,0 +1,129 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// DEAR IMGUI COMPILE-TIME OPTIONS
|
||||
// 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/rebased branch with your modifications to it)
|
||||
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 file 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().
|
||||
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
||||
//#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.
|
||||
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
||||
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to clean your code of obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
|
||||
|
||||
//---- Disable all of Dear ImGui or don't implement standard windows/tools.
|
||||
// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp.
|
||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty.
|
||||
//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowIDStackToolWindow() will be empty.
|
||||
|
||||
//---- 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. (user32.lib/.a, kernel32.lib/.a)
|
||||
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
|
||||
//#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', this is why this is not the default).
|
||||
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
|
||||
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
|
||||
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
|
||||
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
|
||||
//#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().
|
||||
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
|
||||
|
||||
//---- 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
|
||||
|
||||
//---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
||||
//#define IMGUI_USE_WCHAR32
|
||||
|
||||
//---- 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 Dear ImGui sources 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_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if IMGUI_USE_STB_SPRINTF is defined.
|
||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_SPRINTF_IMPLEMENTATION // only disabled if IMGUI_USE_STB_SPRINTF is defined.
|
||||
|
||||
//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
|
||||
// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h.
|
||||
//#define IMGUI_USE_STB_SPRINTF
|
||||
|
||||
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
|
||||
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
|
||||
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
|
||||
//#define IMGUI_ENABLE_FREETYPE
|
||||
|
||||
//---- Use FreeType+lunasvg library to render OpenType SVG fonts (SVGinOT)
|
||||
// Requires lunasvg headers to be available in the include path + program to be linked with the lunasvg library (not provided).
|
||||
// Only works in combination with IMGUI_ENABLE_FREETYPE.
|
||||
// (implementation is based on Freetype's rsvg-port.c which is licensed under CeCILL-C Free Software License Agreement)
|
||||
//#define IMGUI_ENABLE_FREETYPE_LUNASVG
|
||||
|
||||
//---- Use stb_truetype to build and rasterize the font atlas (default)
|
||||
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
|
||||
//#define IMGUI_ENABLE_STB_TRUETYPE
|
||||
|
||||
//---- 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 \
|
||||
constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \
|
||||
operator MyVec2() const { return MyVec2(x,y); }
|
||||
|
||||
#define IM_VEC4_CLASS_EXTRA \
|
||||
constexpr 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); }
|
||||
*/
|
||||
//---- ...Or use Dear ImGui's own very basic math operators.
|
||||
//#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
|
||||
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
|
||||
// Another way to allow large meshes while keeping 16-bit 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 backends 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: Macro to break in Debugger (we provide a default implementation of this in the codebase)
|
||||
// (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()
|
||||
|
||||
//---- Debug Tools: Enable slower asserts
|
||||
//#define IMGUI_DEBUG_PARANOID
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace from anywhere (e.g. your own sources/header files)
|
||||
/*
|
||||
namespace ImGui
|
||||
{
|
||||
void MyFunction(const char* name, MyMatrix44* mtx);
|
||||
}
|
||||
*/
|
15256
Libraries/include/imgui/imgui.cpp
Normal file
15256
Libraries/include/imgui/imgui.cpp
Normal file
File diff suppressed because it is too large
Load Diff
3270
Libraries/include/imgui/imgui.h
Normal file
3270
Libraries/include/imgui/imgui.h
Normal file
File diff suppressed because it is too large
Load Diff
8446
Libraries/include/imgui/imgui_demo.cpp
Normal file
8446
Libraries/include/imgui/imgui_demo.cpp
Normal file
File diff suppressed because it is too large
Load Diff
4301
Libraries/include/imgui/imgui_draw.cpp
Normal file
4301
Libraries/include/imgui/imgui_draw.cpp
Normal file
File diff suppressed because it is too large
Load Diff
816
Libraries/include/imgui/imgui_impl_glfw.cpp
Normal file
816
Libraries/include/imgui/imgui_impl_glfw.cpp
Normal file
@ -0,0 +1,816 @@
|
||||
// dear imgui: Platform Backend for GLFW
|
||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
|
||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
// (Requires: GLFW 3.1+. Prefer GLFW 3.3+ or GLFW 3.4+ for full feature support.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
|
||||
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2023-10-05: Inputs: Added support for extra ImGuiKey values: F13 to F24 function keys.
|
||||
// 2023-07-18: Inputs: Revert ignoring mouse data on GLFW_CURSOR_DISABLED as it can be used differently. User may set ImGuiConfigFLags_NoMouse if desired. (#5625, #6609)
|
||||
// 2023-06-12: Accept glfwGetTime() not returning a monotonically increasing value. This seems to happens on some Windows setup when peripherals disconnect, and is likely to also happen on browser + Emscripten. (#6491)
|
||||
// 2023-04-04: Inputs: Added support for io.AddMouseSourceEvent() to discriminate ImGuiMouseSource_Mouse/ImGuiMouseSource_TouchScreen/ImGuiMouseSource_Pen on Windows ONLY, using a custom WndProc hook. (#2702)
|
||||
// 2023-03-16: Inputs: Fixed key modifiers handling on secondary viewports (docking branch). Broken on 2023/01/04. (#6248, #6034)
|
||||
// 2023-03-14: Emscripten: Avoid using glfwGetError() and glfwGetGamepadState() which are not correctly implemented in Emscripten emulation. (#6240)
|
||||
// 2023-02-03: Emscripten: Registering custom low-level mouse wheel handler to get more accurate scrolling impulses on Emscripten. (#4019, #6096)
|
||||
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
|
||||
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
|
||||
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
|
||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
|
||||
// 2022-09-01: Inputs: Honor GLFW_CURSOR_DISABLED by not setting mouse position *EDIT* Reverted 2023-07-18.
|
||||
// 2022-04-30: Inputs: Fixed ImGui_ImplGlfw_TranslateUntranslatedKey() for lower case letters on OSX.
|
||||
// 2022-03-23: Inputs: Fixed a regression in 1.87 which resulted in keyboard modifiers events being reported incorrectly on Linux/X11.
|
||||
// 2022-02-07: Added ImGui_ImplGlfw_InstallCallbacks()/ImGui_ImplGlfw_RestoreCallbacks() helpers to facilitate user installing callbacks after initializing backend.
|
||||
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
|
||||
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
|
||||
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
|
||||
// 2022-01-17: Inputs: always update key mods next and before key event (not in NewFrame) to fix input queue with very low framerates.
|
||||
// 2022-01-12: *BREAKING CHANGE*: Now using glfwSetCursorPosCallback(). If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetCursorPosCallback() and forward it to the backend via ImGui_ImplGlfw_CursorPosCallback().
|
||||
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
|
||||
// 2022-01-05: Inputs: Converting GLFW untranslated keycodes back to translated keycodes (in the ImGui_ImplGlfw_KeyCallback() function) in order to match the behavior of every other backend, and facilitate the use of GLFW with lettered-shortcuts API.
|
||||
// 2021-08-17: *BREAKING CHANGE*: Now using glfwSetWindowFocusCallback() to calling io.AddFocusEvent(). If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetWindowFocusCallback() and forward it to the backend via ImGui_ImplGlfw_WindowFocusCallback().
|
||||
// 2021-07-29: *BREAKING CHANGE*: Now using glfwSetCursorEnterCallback(). MousePos is correctly reported when the host platform window is hovered but not focused. If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetWindowFocusCallback() callback and forward it to the backend via ImGui_ImplGlfw_CursorEnterCallback().
|
||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||
// 2020-01-17: Inputs: Disable error callback while assigning mouse cursors because some X11 setup don't have them and it generates errors.
|
||||
// 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor).
|
||||
// 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
|
||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
|
||||
// 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
|
||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
||||
// 2018-11-07: Inputs: When installing our GLFW callbacks, we save user's previously installed ones - if any - and chain call them.
|
||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
||||
// 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
|
||||
// 2018-01-25: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
|
||||
// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
|
||||
// 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
|
||||
// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
|
||||
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_glfw.h"
|
||||
|
||||
// Clang warnings with -Weverything
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
|
||||
#endif
|
||||
|
||||
// GLFW
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef APIENTRY
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#include <GLFW/glfw3native.h> // for glfwGetWin32Window()
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#include <GLFW/glfw3native.h> // for glfwGetCocoaWindow()
|
||||
#endif
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#endif
|
||||
|
||||
// We gather version tests as define in order to easily see which features are version-dependent.
|
||||
#define GLFW_VERSION_COMBINED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 + GLFW_VERSION_REVISION)
|
||||
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
|
||||
#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_COMBINED >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
|
||||
#else
|
||||
#define GLFW_HAS_NEW_CURSORS (0)
|
||||
#endif
|
||||
#define GLFW_HAS_GAMEPAD_API (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetGamepadState() new api
|
||||
#define GLFW_HAS_GETKEYNAME (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwGetKeyName()
|
||||
#define GLFW_HAS_GETERROR (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetError()
|
||||
|
||||
// GLFW data
|
||||
enum GlfwClientApi
|
||||
{
|
||||
GlfwClientApi_Unknown,
|
||||
GlfwClientApi_OpenGL,
|
||||
GlfwClientApi_Vulkan
|
||||
};
|
||||
|
||||
struct ImGui_ImplGlfw_Data
|
||||
{
|
||||
GLFWwindow* Window;
|
||||
GlfwClientApi ClientApi;
|
||||
double Time;
|
||||
GLFWwindow* MouseWindow;
|
||||
GLFWcursor* MouseCursors[ImGuiMouseCursor_COUNT];
|
||||
ImVec2 LastValidMousePos;
|
||||
bool InstalledCallbacks;
|
||||
bool CallbacksChainForAllWindows;
|
||||
|
||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||
GLFWwindowfocusfun PrevUserCallbackWindowFocus;
|
||||
GLFWcursorposfun PrevUserCallbackCursorPos;
|
||||
GLFWcursorenterfun PrevUserCallbackCursorEnter;
|
||||
GLFWmousebuttonfun PrevUserCallbackMousebutton;
|
||||
GLFWscrollfun PrevUserCallbackScroll;
|
||||
GLFWkeyfun PrevUserCallbackKey;
|
||||
GLFWcharfun PrevUserCallbackChar;
|
||||
GLFWmonitorfun PrevUserCallbackMonitor;
|
||||
#ifdef _WIN32
|
||||
WNDPROC GlfwWndProc;
|
||||
#endif
|
||||
|
||||
ImGui_ImplGlfw_Data() { memset((void*)this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
|
||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||
// FIXME: multi-context support is not well tested and probably dysfunctional in this backend.
|
||||
// - Because glfwPollEvents() process all windows and some events may be called outside of it, you will need to register your own callbacks
|
||||
// (passing install_callbacks=false in ImGui_ImplGlfw_InitXXX functions), set the current dear imgui context and then call our callbacks.
|
||||
// - Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it.
|
||||
// FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.
|
||||
static ImGui_ImplGlfw_Data* ImGui_ImplGlfw_GetBackendData()
|
||||
{
|
||||
return ImGui::GetCurrentContext() ? (ImGui_ImplGlfw_Data*)ImGui::GetIO().BackendPlatformUserData : nullptr;
|
||||
}
|
||||
|
||||
// Functions
|
||||
static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
|
||||
{
|
||||
return glfwGetClipboardString((GLFWwindow*)user_data);
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
|
||||
{
|
||||
glfwSetClipboardString((GLFWwindow*)user_data, text);
|
||||
}
|
||||
|
||||
static ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case GLFW_KEY_TAB: return ImGuiKey_Tab;
|
||||
case GLFW_KEY_LEFT: return ImGuiKey_LeftArrow;
|
||||
case GLFW_KEY_RIGHT: return ImGuiKey_RightArrow;
|
||||
case GLFW_KEY_UP: return ImGuiKey_UpArrow;
|
||||
case GLFW_KEY_DOWN: return ImGuiKey_DownArrow;
|
||||
case GLFW_KEY_PAGE_UP: return ImGuiKey_PageUp;
|
||||
case GLFW_KEY_PAGE_DOWN: return ImGuiKey_PageDown;
|
||||
case GLFW_KEY_HOME: return ImGuiKey_Home;
|
||||
case GLFW_KEY_END: return ImGuiKey_End;
|
||||
case GLFW_KEY_INSERT: return ImGuiKey_Insert;
|
||||
case GLFW_KEY_DELETE: return ImGuiKey_Delete;
|
||||
case GLFW_KEY_BACKSPACE: return ImGuiKey_Backspace;
|
||||
case GLFW_KEY_SPACE: return ImGuiKey_Space;
|
||||
case GLFW_KEY_ENTER: return ImGuiKey_Enter;
|
||||
case GLFW_KEY_ESCAPE: return ImGuiKey_Escape;
|
||||
case GLFW_KEY_APOSTROPHE: return ImGuiKey_Apostrophe;
|
||||
case GLFW_KEY_COMMA: return ImGuiKey_Comma;
|
||||
case GLFW_KEY_MINUS: return ImGuiKey_Minus;
|
||||
case GLFW_KEY_PERIOD: return ImGuiKey_Period;
|
||||
case GLFW_KEY_SLASH: return ImGuiKey_Slash;
|
||||
case GLFW_KEY_SEMICOLON: return ImGuiKey_Semicolon;
|
||||
case GLFW_KEY_EQUAL: return ImGuiKey_Equal;
|
||||
case GLFW_KEY_LEFT_BRACKET: return ImGuiKey_LeftBracket;
|
||||
case GLFW_KEY_BACKSLASH: return ImGuiKey_Backslash;
|
||||
case GLFW_KEY_RIGHT_BRACKET: return ImGuiKey_RightBracket;
|
||||
case GLFW_KEY_GRAVE_ACCENT: return ImGuiKey_GraveAccent;
|
||||
case GLFW_KEY_CAPS_LOCK: return ImGuiKey_CapsLock;
|
||||
case GLFW_KEY_SCROLL_LOCK: return ImGuiKey_ScrollLock;
|
||||
case GLFW_KEY_NUM_LOCK: return ImGuiKey_NumLock;
|
||||
case GLFW_KEY_PRINT_SCREEN: return ImGuiKey_PrintScreen;
|
||||
case GLFW_KEY_PAUSE: return ImGuiKey_Pause;
|
||||
case GLFW_KEY_KP_0: return ImGuiKey_Keypad0;
|
||||
case GLFW_KEY_KP_1: return ImGuiKey_Keypad1;
|
||||
case GLFW_KEY_KP_2: return ImGuiKey_Keypad2;
|
||||
case GLFW_KEY_KP_3: return ImGuiKey_Keypad3;
|
||||
case GLFW_KEY_KP_4: return ImGuiKey_Keypad4;
|
||||
case GLFW_KEY_KP_5: return ImGuiKey_Keypad5;
|
||||
case GLFW_KEY_KP_6: return ImGuiKey_Keypad6;
|
||||
case GLFW_KEY_KP_7: return ImGuiKey_Keypad7;
|
||||
case GLFW_KEY_KP_8: return ImGuiKey_Keypad8;
|
||||
case GLFW_KEY_KP_9: return ImGuiKey_Keypad9;
|
||||
case GLFW_KEY_KP_DECIMAL: return ImGuiKey_KeypadDecimal;
|
||||
case GLFW_KEY_KP_DIVIDE: return ImGuiKey_KeypadDivide;
|
||||
case GLFW_KEY_KP_MULTIPLY: return ImGuiKey_KeypadMultiply;
|
||||
case GLFW_KEY_KP_SUBTRACT: return ImGuiKey_KeypadSubtract;
|
||||
case GLFW_KEY_KP_ADD: return ImGuiKey_KeypadAdd;
|
||||
case GLFW_KEY_KP_ENTER: return ImGuiKey_KeypadEnter;
|
||||
case GLFW_KEY_KP_EQUAL: return ImGuiKey_KeypadEqual;
|
||||
case GLFW_KEY_LEFT_SHIFT: return ImGuiKey_LeftShift;
|
||||
case GLFW_KEY_LEFT_CONTROL: return ImGuiKey_LeftCtrl;
|
||||
case GLFW_KEY_LEFT_ALT: return ImGuiKey_LeftAlt;
|
||||
case GLFW_KEY_LEFT_SUPER: return ImGuiKey_LeftSuper;
|
||||
case GLFW_KEY_RIGHT_SHIFT: return ImGuiKey_RightShift;
|
||||
case GLFW_KEY_RIGHT_CONTROL: return ImGuiKey_RightCtrl;
|
||||
case GLFW_KEY_RIGHT_ALT: return ImGuiKey_RightAlt;
|
||||
case GLFW_KEY_RIGHT_SUPER: return ImGuiKey_RightSuper;
|
||||
case GLFW_KEY_MENU: return ImGuiKey_Menu;
|
||||
case GLFW_KEY_0: return ImGuiKey_0;
|
||||
case GLFW_KEY_1: return ImGuiKey_1;
|
||||
case GLFW_KEY_2: return ImGuiKey_2;
|
||||
case GLFW_KEY_3: return ImGuiKey_3;
|
||||
case GLFW_KEY_4: return ImGuiKey_4;
|
||||
case GLFW_KEY_5: return ImGuiKey_5;
|
||||
case GLFW_KEY_6: return ImGuiKey_6;
|
||||
case GLFW_KEY_7: return ImGuiKey_7;
|
||||
case GLFW_KEY_8: return ImGuiKey_8;
|
||||
case GLFW_KEY_9: return ImGuiKey_9;
|
||||
case GLFW_KEY_A: return ImGuiKey_A;
|
||||
case GLFW_KEY_B: return ImGuiKey_B;
|
||||
case GLFW_KEY_C: return ImGuiKey_C;
|
||||
case GLFW_KEY_D: return ImGuiKey_D;
|
||||
case GLFW_KEY_E: return ImGuiKey_E;
|
||||
case GLFW_KEY_F: return ImGuiKey_F;
|
||||
case GLFW_KEY_G: return ImGuiKey_G;
|
||||
case GLFW_KEY_H: return ImGuiKey_H;
|
||||
case GLFW_KEY_I: return ImGuiKey_I;
|
||||
case GLFW_KEY_J: return ImGuiKey_J;
|
||||
case GLFW_KEY_K: return ImGuiKey_K;
|
||||
case GLFW_KEY_L: return ImGuiKey_L;
|
||||
case GLFW_KEY_M: return ImGuiKey_M;
|
||||
case GLFW_KEY_N: return ImGuiKey_N;
|
||||
case GLFW_KEY_O: return ImGuiKey_O;
|
||||
case GLFW_KEY_P: return ImGuiKey_P;
|
||||
case GLFW_KEY_Q: return ImGuiKey_Q;
|
||||
case GLFW_KEY_R: return ImGuiKey_R;
|
||||
case GLFW_KEY_S: return ImGuiKey_S;
|
||||
case GLFW_KEY_T: return ImGuiKey_T;
|
||||
case GLFW_KEY_U: return ImGuiKey_U;
|
||||
case GLFW_KEY_V: return ImGuiKey_V;
|
||||
case GLFW_KEY_W: return ImGuiKey_W;
|
||||
case GLFW_KEY_X: return ImGuiKey_X;
|
||||
case GLFW_KEY_Y: return ImGuiKey_Y;
|
||||
case GLFW_KEY_Z: return ImGuiKey_Z;
|
||||
case GLFW_KEY_F1: return ImGuiKey_F1;
|
||||
case GLFW_KEY_F2: return ImGuiKey_F2;
|
||||
case GLFW_KEY_F3: return ImGuiKey_F3;
|
||||
case GLFW_KEY_F4: return ImGuiKey_F4;
|
||||
case GLFW_KEY_F5: return ImGuiKey_F5;
|
||||
case GLFW_KEY_F6: return ImGuiKey_F6;
|
||||
case GLFW_KEY_F7: return ImGuiKey_F7;
|
||||
case GLFW_KEY_F8: return ImGuiKey_F8;
|
||||
case GLFW_KEY_F9: return ImGuiKey_F9;
|
||||
case GLFW_KEY_F10: return ImGuiKey_F10;
|
||||
case GLFW_KEY_F11: return ImGuiKey_F11;
|
||||
case GLFW_KEY_F12: return ImGuiKey_F12;
|
||||
case GLFW_KEY_F13: return ImGuiKey_F13;
|
||||
case GLFW_KEY_F14: return ImGuiKey_F14;
|
||||
case GLFW_KEY_F15: return ImGuiKey_F15;
|
||||
case GLFW_KEY_F16: return ImGuiKey_F16;
|
||||
case GLFW_KEY_F17: return ImGuiKey_F17;
|
||||
case GLFW_KEY_F18: return ImGuiKey_F18;
|
||||
case GLFW_KEY_F19: return ImGuiKey_F19;
|
||||
case GLFW_KEY_F20: return ImGuiKey_F20;
|
||||
case GLFW_KEY_F21: return ImGuiKey_F21;
|
||||
case GLFW_KEY_F22: return ImGuiKey_F22;
|
||||
case GLFW_KEY_F23: return ImGuiKey_F23;
|
||||
case GLFW_KEY_F24: return ImGuiKey_F24;
|
||||
default: return ImGuiKey_None;
|
||||
}
|
||||
}
|
||||
|
||||
// X11 does not include current pressed/released modifier key in 'mods' flags submitted by GLFW
|
||||
// See https://github.com/ocornut/imgui/issues/6034 and https://github.com/glfw/glfw/issues/1630
|
||||
static void ImGui_ImplGlfw_UpdateKeyModifiers(GLFWwindow* window)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddKeyEvent(ImGuiMod_Ctrl, (glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
|
||||
io.AddKeyEvent(ImGuiMod_Shift, (glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
|
||||
io.AddKeyEvent(ImGuiMod_Alt, (glfwGetKey(window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
|
||||
io.AddKeyEvent(ImGuiMod_Super, (glfwGetKey(window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS) || (glfwGetKey(window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
|
||||
}
|
||||
|
||||
static bool ImGui_ImplGlfw_ShouldChainCallback(GLFWwindow* window)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
return bd->CallbacksChainForAllWindows ? true : (window == bd->Window);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackMousebutton != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackMousebutton(window, button, action, mods);
|
||||
|
||||
ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (button >= 0 && button < ImGuiMouseButton_COUNT)
|
||||
io.AddMouseButtonEvent(button, action == GLFW_PRESS);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackScroll != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Ignore GLFW events: will be processed in ImGui_ImplEmscripten_WheelCallback().
|
||||
return;
|
||||
#endif
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
|
||||
}
|
||||
|
||||
static int ImGui_ImplGlfw_TranslateUntranslatedKey(int key, int scancode)
|
||||
{
|
||||
#if GLFW_HAS_GETKEYNAME && !defined(__EMSCRIPTEN__)
|
||||
// GLFW 3.1+ attempts to "untranslate" keys, which goes the opposite of what every other framework does, making using lettered shortcuts difficult.
|
||||
// (It had reasons to do so: namely GLFW is/was more likely to be used for WASD-type game controls rather than lettered shortcuts, but IHMO the 3.1 change could have been done differently)
|
||||
// See https://github.com/glfw/glfw/issues/1502 for details.
|
||||
// Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
|
||||
// This won't cover edge cases but this is at least going to cover common cases.
|
||||
if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL)
|
||||
return key;
|
||||
GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr);
|
||||
const char* key_name = glfwGetKeyName(key, scancode);
|
||||
glfwSetErrorCallback(prev_error_callback);
|
||||
#if GLFW_HAS_GETERROR && !defined(__EMSCRIPTEN__) // Eat errors (see #5908)
|
||||
(void)glfwGetError(nullptr);
|
||||
#endif
|
||||
if (key_name && key_name[0] != 0 && key_name[1] == 0)
|
||||
{
|
||||
const char char_names[] = "`-=[]\\,;\'./";
|
||||
const int char_keys[] = { GLFW_KEY_GRAVE_ACCENT, GLFW_KEY_MINUS, GLFW_KEY_EQUAL, GLFW_KEY_LEFT_BRACKET, GLFW_KEY_RIGHT_BRACKET, GLFW_KEY_BACKSLASH, GLFW_KEY_COMMA, GLFW_KEY_SEMICOLON, GLFW_KEY_APOSTROPHE, GLFW_KEY_PERIOD, GLFW_KEY_SLASH, 0 };
|
||||
IM_ASSERT(IM_ARRAYSIZE(char_names) == IM_ARRAYSIZE(char_keys));
|
||||
if (key_name[0] >= '0' && key_name[0] <= '9') { key = GLFW_KEY_0 + (key_name[0] - '0'); }
|
||||
else if (key_name[0] >= 'A' && key_name[0] <= 'Z') { key = GLFW_KEY_A + (key_name[0] - 'A'); }
|
||||
else if (key_name[0] >= 'a' && key_name[0] <= 'z') { key = GLFW_KEY_A + (key_name[0] - 'a'); }
|
||||
else if (const char* p = strchr(char_names, key_name[0])) { key = char_keys[p - char_names]; }
|
||||
}
|
||||
// if (action == GLFW_PRESS) printf("key %d scancode %d name '%s'\n", key, scancode, key_name);
|
||||
#else
|
||||
IM_UNUSED(scancode);
|
||||
#endif
|
||||
return key;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int keycode, int scancode, int action, int mods)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackKey != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackKey(window, keycode, scancode, action, mods);
|
||||
|
||||
if (action != GLFW_PRESS && action != GLFW_RELEASE)
|
||||
return;
|
||||
|
||||
ImGui_ImplGlfw_UpdateKeyModifiers(window);
|
||||
|
||||
keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiKey imgui_key = ImGui_ImplGlfw_KeyToImGuiKey(keycode);
|
||||
io.AddKeyEvent(imgui_key, (action == GLFW_PRESS));
|
||||
io.SetKeyEventNativeData(imgui_key, keycode, scancode); // To support legacy indexing (<1.87 user code)
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackWindowFocus != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackWindowFocus(window, focused);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddFocusEvent(focused != 0);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackCursorPos != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackCursorPos(window, x, y);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddMousePosEvent((float)x, (float)y);
|
||||
bd->LastValidMousePos = ImVec2((float)x, (float)y);
|
||||
}
|
||||
|
||||
// Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position,
|
||||
// so we back it up and restore on Leave/Enter (see https://github.com/ocornut/imgui/issues/4984)
|
||||
void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackCursorEnter != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackCursorEnter(window, entered);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (entered)
|
||||
{
|
||||
bd->MouseWindow = window;
|
||||
io.AddMousePosEvent(bd->LastValidMousePos.x, bd->LastValidMousePos.y);
|
||||
}
|
||||
else if (!entered && bd->MouseWindow == window)
|
||||
{
|
||||
bd->LastValidMousePos = io.MousePos;
|
||||
bd->MouseWindow = nullptr;
|
||||
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if (bd->PrevUserCallbackChar != nullptr && ImGui_ImplGlfw_ShouldChainCallback(window))
|
||||
bd->PrevUserCallbackChar(window, c);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddInputCharacter(c);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor*, int)
|
||||
{
|
||||
// Unused in 'master' branch but 'docking' branch will use this, so we declare it ahead of it so if you have to install callbacks you can install this one too.
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
static EM_BOOL ImGui_ImplEmscripten_WheelCallback(int, const EmscriptenWheelEvent* ev, void*)
|
||||
{
|
||||
// Mimic Emscripten_HandleWheel() in SDL.
|
||||
// Corresponding equivalent in GLFW JS emulation layer has incorrect quantizing preventing small values. See #6096
|
||||
float multiplier = 0.0f;
|
||||
if (ev->deltaMode == DOM_DELTA_PIXEL) { multiplier = 1.0f / 100.0f; } // 100 pixels make up a step.
|
||||
else if (ev->deltaMode == DOM_DELTA_LINE) { multiplier = 1.0f / 3.0f; } // 3 lines make up a step.
|
||||
else if (ev->deltaMode == DOM_DELTA_PAGE) { multiplier = 80.0f; } // A page makes up 80 steps.
|
||||
float wheel_x = ev->deltaX * -multiplier;
|
||||
float wheel_y = ev->deltaY * -multiplier;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddMouseWheelEvent(wheel_x, wheel_y);
|
||||
//IMGUI_DEBUG_LOG("[Emsc] mode %d dx: %.2f, dy: %.2f, dz: %.2f --> feed %.2f %.2f\n", (int)ev->deltaMode, ev->deltaX, ev->deltaY, ev->deltaZ, wheel_x, wheel_y);
|
||||
return EM_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// GLFW doesn't allow to distinguish Mouse vs TouchScreen vs Pen.
|
||||
// Add support for Win32 (based on imgui_impl_win32), because we rely on _TouchScreen info to trickle inputs differently.
|
||||
static ImGuiMouseSource GetMouseSourceFromMessageExtraInfo()
|
||||
{
|
||||
LPARAM extra_info = ::GetMessageExtraInfo();
|
||||
if ((extra_info & 0xFFFFFF80) == 0xFF515700)
|
||||
return ImGuiMouseSource_Pen;
|
||||
if ((extra_info & 0xFFFFFF80) == 0xFF515780)
|
||||
return ImGuiMouseSource_TouchScreen;
|
||||
return ImGuiMouseSource_Mouse;
|
||||
}
|
||||
static LRESULT CALLBACK ImGui_ImplGlfw_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
switch (msg)
|
||||
{
|
||||
case WM_MOUSEMOVE: case WM_NCMOUSEMOVE:
|
||||
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_LBUTTONUP:
|
||||
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_RBUTTONUP:
|
||||
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: case WM_MBUTTONUP:
|
||||
case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK: case WM_XBUTTONUP:
|
||||
ImGui::GetIO().AddMouseSourceEvent(GetMouseSourceFromMessageExtraInfo());
|
||||
break;
|
||||
}
|
||||
return ::CallWindowProc(bd->GlfwWndProc, hWnd, msg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
IM_ASSERT(bd->InstalledCallbacks == false && "Callbacks already installed!");
|
||||
IM_ASSERT(bd->Window == window);
|
||||
|
||||
bd->PrevUserCallbackWindowFocus = glfwSetWindowFocusCallback(window, ImGui_ImplGlfw_WindowFocusCallback);
|
||||
bd->PrevUserCallbackCursorEnter = glfwSetCursorEnterCallback(window, ImGui_ImplGlfw_CursorEnterCallback);
|
||||
bd->PrevUserCallbackCursorPos = glfwSetCursorPosCallback(window, ImGui_ImplGlfw_CursorPosCallback);
|
||||
bd->PrevUserCallbackMousebutton = glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
|
||||
bd->PrevUserCallbackScroll = glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
|
||||
bd->PrevUserCallbackKey = glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
|
||||
bd->PrevUserCallbackChar = glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
|
||||
bd->PrevUserCallbackMonitor = glfwSetMonitorCallback(ImGui_ImplGlfw_MonitorCallback);
|
||||
bd->InstalledCallbacks = true;
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
IM_ASSERT(bd->InstalledCallbacks == true && "Callbacks not installed!");
|
||||
IM_ASSERT(bd->Window == window);
|
||||
|
||||
glfwSetWindowFocusCallback(window, bd->PrevUserCallbackWindowFocus);
|
||||
glfwSetCursorEnterCallback(window, bd->PrevUserCallbackCursorEnter);
|
||||
glfwSetCursorPosCallback(window, bd->PrevUserCallbackCursorPos);
|
||||
glfwSetMouseButtonCallback(window, bd->PrevUserCallbackMousebutton);
|
||||
glfwSetScrollCallback(window, bd->PrevUserCallbackScroll);
|
||||
glfwSetKeyCallback(window, bd->PrevUserCallbackKey);
|
||||
glfwSetCharCallback(window, bd->PrevUserCallbackChar);
|
||||
glfwSetMonitorCallback(bd->PrevUserCallbackMonitor);
|
||||
bd->InstalledCallbacks = false;
|
||||
bd->PrevUserCallbackWindowFocus = nullptr;
|
||||
bd->PrevUserCallbackCursorEnter = nullptr;
|
||||
bd->PrevUserCallbackCursorPos = nullptr;
|
||||
bd->PrevUserCallbackMousebutton = nullptr;
|
||||
bd->PrevUserCallbackScroll = nullptr;
|
||||
bd->PrevUserCallbackKey = nullptr;
|
||||
bd->PrevUserCallbackChar = nullptr;
|
||||
bd->PrevUserCallbackMonitor = nullptr;
|
||||
}
|
||||
|
||||
// Set to 'true' to enable chaining installed callbacks for all windows (including secondary viewports created by backends or by user.
|
||||
// This is 'false' by default meaning we only chain callbacks for the main viewport.
|
||||
// We cannot set this to 'true' by default because user callbacks code may be not testing the 'window' parameter of their callback.
|
||||
// If you set this to 'true' your user callback code will need to make sure you are testing the 'window' parameter.
|
||||
void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows)
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
bd->CallbacksChainForAllWindows = chain_for_all_windows;
|
||||
}
|
||||
|
||||
static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
|
||||
//printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED);
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGui_ImplGlfw_Data* bd = IM_NEW(ImGui_ImplGlfw_Data)();
|
||||
io.BackendPlatformUserData = (void*)bd;
|
||||
io.BackendPlatformName = "imgui_impl_glfw";
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||
|
||||
bd->Window = window;
|
||||
bd->Time = 0.0;
|
||||
|
||||
io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
|
||||
io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
|
||||
io.ClipboardUserData = bd->Window;
|
||||
|
||||
// Create mouse cursors
|
||||
// (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
|
||||
// GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
|
||||
// Missing cursors will return nullptr and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
|
||||
GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr);
|
||||
bd->MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
|
||||
#if GLFW_HAS_NEW_CURSORS
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_RESIZE_ALL_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_RESIZE_NESW_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_RESIZE_NWSE_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_NOT_ALLOWED_CURSOR);
|
||||
#else
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
|
||||
#endif
|
||||
glfwSetErrorCallback(prev_error_callback);
|
||||
#if GLFW_HAS_GETERROR && !defined(__EMSCRIPTEN__) // Eat errors (see #5908)
|
||||
(void)glfwGetError(nullptr);
|
||||
#endif
|
||||
|
||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||
if (install_callbacks)
|
||||
ImGui_ImplGlfw_InstallCallbacks(window);
|
||||
// Register Emscripten Wheel callback to workaround issue in Emscripten GLFW Emulation (#6096)
|
||||
// We intentionally do not check 'if (install_callbacks)' here, as some users may set it to false and call GLFW callback themselves.
|
||||
// FIXME: May break chaining in case user registered their own Emscripten callback?
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, nullptr, false, ImGui_ImplEmscripten_WheelCallback);
|
||||
#endif
|
||||
|
||||
// Set platform dependent data in viewport
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
#ifdef _WIN32
|
||||
main_viewport->PlatformHandleRaw = glfwGetWin32Window(bd->Window);
|
||||
#elif defined(__APPLE__)
|
||||
main_viewport->PlatformHandleRaw = (void*)glfwGetCocoaWindow(bd->Window);
|
||||
#else
|
||||
IM_UNUSED(main_viewport);
|
||||
#endif
|
||||
|
||||
// Windows: register a WndProc hook so we can intercept some messages.
|
||||
#ifdef _WIN32
|
||||
bd->GlfwWndProc = (WNDPROC)::GetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC);
|
||||
IM_ASSERT(bd->GlfwWndProc != nullptr);
|
||||
::SetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc);
|
||||
#endif
|
||||
|
||||
bd->ClientApi = client_api;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_OpenGL);
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Vulkan);
|
||||
}
|
||||
|
||||
bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks)
|
||||
{
|
||||
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Unknown);
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_Shutdown()
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if (bd->InstalledCallbacks)
|
||||
ImGui_ImplGlfw_RestoreCallbacks(bd->Window);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, nullptr, false, nullptr);
|
||||
#endif
|
||||
|
||||
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
||||
glfwDestroyCursor(bd->MouseCursors[cursor_n]);
|
||||
|
||||
// Windows: register a WndProc hook so we can intercept some messages.
|
||||
#ifdef _WIN32
|
||||
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
::SetWindowLongPtr((HWND)main_viewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)bd->GlfwWndProc);
|
||||
bd->GlfwWndProc = nullptr;
|
||||
#endif
|
||||
|
||||
io.BackendPlatformName = nullptr;
|
||||
io.BackendPlatformUserData = nullptr;
|
||||
io.BackendFlags &= ~(ImGuiBackendFlags_HasMouseCursors | ImGuiBackendFlags_HasSetMousePos | ImGuiBackendFlags_HasGamepad);
|
||||
IM_DELETE(bd);
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfw_UpdateMouseData()
|
||||
{
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
|
||||
// (those braces are here to reduce diff with multi-viewports support in 'docking' branch)
|
||||
{
|
||||
GLFWwindow* window = bd->Window;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
const bool is_window_focused = true;
|
||||
#else
|
||||
const bool is_window_focused = glfwGetWindowAttrib(window, GLFW_FOCUSED) != 0;
|
||||
#endif
|
||||
if (is_window_focused)
|
||||
{
|
||||
// (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||
if (io.WantSetMousePos)
|
||||
glfwSetCursorPos(window, (double)io.MousePos.x, (double)io.MousePos.y);
|
||||
|
||||
// (Optional) Fallback to provide mouse position when focused (ImGui_ImplGlfw_CursorPosCallback already provides this when hovered or captured)
|
||||
if (bd->MouseWindow == nullptr)
|
||||
{
|
||||
double mouse_x, mouse_y;
|
||||
glfwGetCursorPos(window, &mouse_x, &mouse_y);
|
||||
bd->LastValidMousePos = ImVec2((float)mouse_x, (float)mouse_y);
|
||||
io.AddMousePosEvent((float)mouse_x, (float)mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ImGui_ImplGlfw_UpdateMouseCursor()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
|
||||
return;
|
||||
|
||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||
// (those braces are here to reduce diff with multi-viewports support in 'docking' branch)
|
||||
{
|
||||
GLFWwindow* window = bd->Window;
|
||||
if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)
|
||||
{
|
||||
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show OS mouse cursor
|
||||
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
|
||||
glfwSetCursor(window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update gamepad inputs
|
||||
static inline float Saturate(float v) { return v < 0.0f ? 0.0f : v > 1.0f ? 1.0f : v; }
|
||||
static void ImGui_ImplGlfw_UpdateGamepads()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||
return;
|
||||
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||
#if GLFW_HAS_GAMEPAD_API && !defined(__EMSCRIPTEN__)
|
||||
GLFWgamepadstate gamepad;
|
||||
if (!glfwGetGamepadState(GLFW_JOYSTICK_1, &gamepad))
|
||||
return;
|
||||
#define MAP_BUTTON(KEY_NO, BUTTON_NO, _UNUSED) do { io.AddKeyEvent(KEY_NO, gamepad.buttons[BUTTON_NO] != 0); } while (0)
|
||||
#define MAP_ANALOG(KEY_NO, AXIS_NO, _UNUSED, V0, V1) do { float v = gamepad.axes[AXIS_NO]; v = (v - V0) / (V1 - V0); io.AddKeyAnalogEvent(KEY_NO, v > 0.10f, Saturate(v)); } while (0)
|
||||
#else
|
||||
int axes_count = 0, buttons_count = 0;
|
||||
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
|
||||
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
|
||||
if (axes_count == 0 || buttons_count == 0)
|
||||
return;
|
||||
#define MAP_BUTTON(KEY_NO, _UNUSED, BUTTON_NO) do { io.AddKeyEvent(KEY_NO, (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS)); } while (0)
|
||||
#define MAP_ANALOG(KEY_NO, _UNUSED, AXIS_NO, V0, V1) do { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); io.AddKeyAnalogEvent(KEY_NO, v > 0.10f, Saturate(v)); } while (0)
|
||||
#endif
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
||||
MAP_BUTTON(ImGuiKey_GamepadStart, GLFW_GAMEPAD_BUTTON_START, 7);
|
||||
MAP_BUTTON(ImGuiKey_GamepadBack, GLFW_GAMEPAD_BUTTON_BACK, 6);
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceLeft, GLFW_GAMEPAD_BUTTON_X, 2); // Xbox X, PS Square
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceRight, GLFW_GAMEPAD_BUTTON_B, 1); // Xbox B, PS Circle
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceUp, GLFW_GAMEPAD_BUTTON_Y, 3); // Xbox Y, PS Triangle
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceDown, GLFW_GAMEPAD_BUTTON_A, 0); // Xbox A, PS Cross
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadLeft, GLFW_GAMEPAD_BUTTON_DPAD_LEFT, 13);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadRight, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, 11);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadUp, GLFW_GAMEPAD_BUTTON_DPAD_UP, 10);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadDown, GLFW_GAMEPAD_BUTTON_DPAD_DOWN, 12);
|
||||
MAP_BUTTON(ImGuiKey_GamepadL1, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, 4);
|
||||
MAP_BUTTON(ImGuiKey_GamepadR1, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, 5);
|
||||
MAP_ANALOG(ImGuiKey_GamepadL2, GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, 4, -0.75f, +1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadR2, GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, 5, -0.75f, +1.0f);
|
||||
MAP_BUTTON(ImGuiKey_GamepadL3, GLFW_GAMEPAD_BUTTON_LEFT_THUMB, 8);
|
||||
MAP_BUTTON(ImGuiKey_GamepadR3, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, 9);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickLeft, GLFW_GAMEPAD_AXIS_LEFT_X, 0, -0.25f, -1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickRight, GLFW_GAMEPAD_AXIS_LEFT_X, 0, +0.25f, +1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickUp, GLFW_GAMEPAD_AXIS_LEFT_Y, 1, -0.25f, -1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickDown, GLFW_GAMEPAD_AXIS_LEFT_Y, 1, +0.25f, +1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickLeft, GLFW_GAMEPAD_AXIS_RIGHT_X, 2, -0.25f, -1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickRight, GLFW_GAMEPAD_AXIS_RIGHT_X, 2, +0.25f, +1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickUp, GLFW_GAMEPAD_AXIS_RIGHT_Y, 3, -0.25f, -1.0f);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickDown, GLFW_GAMEPAD_AXIS_RIGHT_Y, 3, +0.25f, +1.0f);
|
||||
#undef MAP_BUTTON
|
||||
#undef MAP_ANALOG
|
||||
}
|
||||
|
||||
void ImGui_ImplGlfw_NewFrame()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplGlfw_InitForXXX()?");
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
int w, h;
|
||||
int display_w, display_h;
|
||||
glfwGetWindowSize(bd->Window, &w, &h);
|
||||
glfwGetFramebufferSize(bd->Window, &display_w, &display_h);
|
||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||
if (w > 0 && h > 0)
|
||||
io.DisplayFramebufferScale = ImVec2((float)display_w / (float)w, (float)display_h / (float)h);
|
||||
|
||||
// Setup time step
|
||||
// (Accept glfwGetTime() not returning a monotonically increasing value. Seems to happens on disconnecting peripherals and probably on VMs and Emscripten, see #6491, #6189, #6114, #3644)
|
||||
double current_time = glfwGetTime();
|
||||
if (current_time <= bd->Time)
|
||||
current_time = bd->Time + 0.00001f;
|
||||
io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
|
||||
bd->Time = current_time;
|
||||
|
||||
ImGui_ImplGlfw_UpdateMouseData();
|
||||
ImGui_ImplGlfw_UpdateMouseCursor();
|
||||
|
||||
// Update game controllers (if enabled and available)
|
||||
ImGui_ImplGlfw_UpdateGamepads();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
53
Libraries/include/imgui/imgui_impl_glfw.h
Normal file
53
Libraries/include/imgui/imgui_impl_glfw.h
Normal file
@ -0,0 +1,53 @@
|
||||
// dear imgui: Platform Backend for GLFW
|
||||
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
|
||||
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Mouse support. Can discriminate Mouse/TouchScreen/Pen (Windows only).
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
|
||||
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
struct GLFWwindow;
|
||||
struct GLFWmonitor;
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
|
||||
|
||||
// GLFW callbacks install
|
||||
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
|
||||
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
|
||||
|
||||
// GFLW callbacks options:
|
||||
// - Set 'chain_for_all_windows=true' to enable chaining callbacks for all windows (including secondary viewports created by backends or by user)
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_SetCallbacksChainForAllWindows(bool chain_for_all_windows);
|
||||
|
||||
// GLFW callbacks (individual callbacks to call yourself if you didn't install callbacks)
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
|
||||
IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
946
Libraries/include/imgui/imgui_impl_opengl3.cpp
Normal file
946
Libraries/include/imgui/imgui_impl_opengl3.cpp
Normal file
@ -0,0 +1,946 @@
|
||||
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||
// - Desktop GL: 2.x 3.x 4.x
|
||||
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only).
|
||||
|
||||
// About WebGL/ES:
|
||||
// - You need to '#define IMGUI_IMPL_OPENGL_ES2' or '#define IMGUI_IMPL_OPENGL_ES3' to use WebGL or OpenGL ES.
|
||||
// - This is done automatically on iOS, Android and Emscripten targets.
|
||||
// - For other targets, the define needs to be visible from the imgui_impl_opengl3.cpp compilation unit. If unsure, define globally or in imconfig.h.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2023-10-05: OpenGL: Rename symbols in our internal loader so that LTO compilation with another copy of gl3w is possible. (#6875, #6668, #4445)
|
||||
// 2023-06-20: OpenGL: Fixed erroneous use glGetIntegerv(GL_CONTEXT_PROFILE_MASK) on contexts lower than 3.2. (#6539, #6333)
|
||||
// 2023-05-09: OpenGL: Support for glBindSampler() backup/restore on ES3. (#6375)
|
||||
// 2023-04-18: OpenGL: Restore front and back polygon mode separately when supported by context. (#6333)
|
||||
// 2023-03-23: OpenGL: Properly restoring "no shader program bound" if it was the case prior to running the rendering function. (#6267, #6220, #6224)
|
||||
// 2023-03-15: OpenGL: Fixed GL loader crash when GL_VERSION returns NULL. (#6154, #4445, #3530)
|
||||
// 2023-03-06: OpenGL: Fixed restoration of a potentially deleted OpenGL program, by calling glIsProgram(). (#6220, #6224)
|
||||
// 2022-11-09: OpenGL: Reverted use of glBufferSubData(), too many corruptions issues + old issues seemingly can't be reproed with Intel drivers nowadays (revert 2021-12-15 and 2022-05-23 changes).
|
||||
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
|
||||
// 2022-09-27: OpenGL: Added ability to '#define IMGUI_IMPL_OPENGL_DEBUG'.
|
||||
// 2022-05-23: OpenGL: Reworking 2021-12-15 "Using buffer orphaning" so it only happens on Intel GPU, seems to cause problems otherwise. (#4468, #4825, #4832, #5127).
|
||||
// 2022-05-13: OpenGL: Fixed state corruption on OpenGL ES 2.0 due to not preserving GL_ELEMENT_ARRAY_BUFFER_BINDING and vertex attribute states.
|
||||
// 2021-12-15: OpenGL: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers.
|
||||
// 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions.
|
||||
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
|
||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||
// 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state.
|
||||
// 2021-06-21: OpenGL: Destroy individual vertex/fragment shader objects right after they are linked into the main shader.
|
||||
// 2021-05-24: OpenGL: Access GL_CLIP_ORIGIN when "GL_ARB_clip_control" extension is detected, inside of just OpenGL 4.5 version.
|
||||
// 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||
// 2021-04-06: OpenGL: Don't try to read GL_CLIP_ORIGIN unless we're OpenGL 4.5 or greater.
|
||||
// 2021-02-18: OpenGL: Change blending equation to preserve alpha in output buffer.
|
||||
// 2021-01-03: OpenGL: Backup, setup and restore GL_STENCIL_TEST state.
|
||||
// 2020-10-23: OpenGL: Backup, setup and restore GL_PRIMITIVE_RESTART state.
|
||||
// 2020-10-15: OpenGL: Use glGetString(GL_VERSION) instead of glGetIntegerv(GL_MAJOR_VERSION, ...) when the later returns zero (e.g. Desktop GL 2.x)
|
||||
// 2020-09-17: OpenGL: Fix to avoid compiling/calling glBindSampler() on ES or pre 3.3 context which have the defines set by a loader.
|
||||
// 2020-07-10: OpenGL: Added support for glad2 OpenGL loader.
|
||||
// 2020-05-08: OpenGL: Made default GLSL version 150 (instead of 130) on OSX.
|
||||
// 2020-04-21: OpenGL: Fixed handling of glClipControl(GL_UPPER_LEFT) by inverting projection matrix.
|
||||
// 2020-04-12: OpenGL: Fixed context version check mistakenly testing for 4.0+ instead of 3.2+ to enable ImGuiBackendFlags_RendererHasVtxOffset.
|
||||
// 2020-03-24: OpenGL: Added support for glbinding 2.x OpenGL loader.
|
||||
// 2020-01-07: OpenGL: Added support for glbinding 3.x OpenGL loader.
|
||||
// 2019-10-25: OpenGL: Using a combination of GL define and runtime GL version to decide whether to use glDrawElementsBaseVertex(). Fix building with pre-3.2 GL loaders.
|
||||
// 2019-09-22: OpenGL: Detect default GL loader using __has_include compiler facility.
|
||||
// 2019-09-16: OpenGL: Tweak initialization code to allow application calling ImGui_ImplOpenGL3_CreateFontsTexture() before the first NewFrame() call.
|
||||
// 2019-05-29: OpenGL: Desktop GL only: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||
// 2019-03-29: OpenGL: Not calling glBindBuffer more than necessary in the render loop.
|
||||
// 2019-03-15: OpenGL: Added a GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized GL function loaders early.
|
||||
// 2019-03-03: OpenGL: Fix support for ES 2.0 (WebGL 1.0).
|
||||
// 2019-02-20: OpenGL: Fix for OSX not supporting OpenGL 4.5, we don't try to read GL_CLIP_ORIGIN even if defined by the headers/loader.
|
||||
// 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
|
||||
// 2019-02-01: OpenGL: Using GLSL 410 shaders for any version over 410 (e.g. 430, 450).
|
||||
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||
// 2018-11-13: OpenGL: Support for GL 4.5's glClipControl(GL_UPPER_LEFT) / GL_CLIP_ORIGIN.
|
||||
// 2018-08-29: OpenGL: Added support for more OpenGL loaders: glew and glad, with comments indicative that any loader can be used.
|
||||
// 2018-08-09: OpenGL: Default to OpenGL ES 3 on iOS and Android. GLSL version default to "#version 300 ES".
|
||||
// 2018-07-30: OpenGL: Support for GLSL 300 ES and 410 core. Fixes for Emscripten compilation.
|
||||
// 2018-07-10: OpenGL: Support for more GLSL versions (based on the GLSL version string). Added error output when shaders fail to compile/link.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl3.cpp/.h away from the old combined GLFW/SDL+OpenGL3 examples.
|
||||
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||
// 2018-05-25: OpenGL: Removed unnecessary backup/restore of GL_ELEMENT_ARRAY_BUFFER_BINDING since this is part of the VAO state.
|
||||
// 2018-05-14: OpenGL: Making the call to glBindSampler() optional so 3.2 context won't fail if the function is a nullptr pointer.
|
||||
// 2018-03-06: OpenGL: Added const char* glsl_version parameter to ImGui_ImplOpenGL3_Init() so user can override the GLSL version e.g. "#version 150".
|
||||
// 2018-02-23: OpenGL: Create the VAO in the render function so the setup can more easily be used with multiple shared GL context.
|
||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplSdlGL3_RenderDrawData() in the .h file so you can call it yourself.
|
||||
// 2018-01-07: OpenGL: Changed GLSL shader version from 330 to 150.
|
||||
// 2017-09-01: OpenGL: Save and restore current bound sampler. Save and restore current polygon mode.
|
||||
// 2017-05-01: OpenGL: Fixed save and restore of current blend func state.
|
||||
// 2017-05-01: OpenGL: Fixed save and restore of current GL_ACTIVE_TEXTURE.
|
||||
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
|
||||
// 2016-07-29: OpenGL: Explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
||||
|
||||
//----------------------------------------
|
||||
// OpenGL GLSL GLSL
|
||||
// version version string
|
||||
//----------------------------------------
|
||||
// 2.0 110 "#version 110"
|
||||
// 2.1 120 "#version 120"
|
||||
// 3.0 130 "#version 130"
|
||||
// 3.1 140 "#version 140"
|
||||
// 3.2 150 "#version 150"
|
||||
// 3.3 330 "#version 330 core"
|
||||
// 4.0 400 "#version 400 core"
|
||||
// 4.1 410 "#version 410 core"
|
||||
// 4.2 420 "#version 410 core"
|
||||
// 4.3 430 "#version 430 core"
|
||||
// ES 2.0 100 "#version 100" = WebGL 1.0
|
||||
// ES 3.0 300 "#version 300 es" = WebGL 2.0
|
||||
//----------------------------------------
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "imgui_impl_opengl3.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h> // intptr_t
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
// Clang/GCC warnings with -Weverything
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
|
||||
#pragma clang diagnostic ignored "-Wunused-macros" // warning: macro is not used
|
||||
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
|
||||
#pragma clang diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||||
#pragma GCC diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx'
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader)
|
||||
#endif
|
||||
|
||||
// GL includes
|
||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
|
||||
#include <OpenGLES/ES2/gl.h> // Use GL ES 2
|
||||
#else
|
||||
#include <GLES2/gl2.h> // Use GL ES 2
|
||||
#endif
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
#ifndef GL_GLEXT_PROTOTYPES
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#endif
|
||||
#include <GLES2/gl2ext.h>
|
||||
#endif
|
||||
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
|
||||
#include <OpenGLES/ES3/gl.h> // Use GL ES 3
|
||||
#else
|
||||
#include <GLES3/gl3.h> // Use GL ES 3
|
||||
#endif
|
||||
#elif !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||
// Modern desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
|
||||
// Helper libraries are often used for this purpose! Here we are using our own minimal custom loader based on gl3w.
|
||||
// In the rest of your app/engine, you can use another loader of your choice (gl3w, glew, glad, glbinding, glext, glLoadGen, etc.).
|
||||
// If you happen to be developing a new feature for this backend (imgui_impl_opengl3.cpp):
|
||||
// - You may need to regenerate imgui_impl_opengl3_loader.h to add new symbols. See https://github.com/dearimgui/gl3w_stripped
|
||||
// - You can temporarily use an unstripped version. See https://github.com/dearimgui/gl3w_stripped/releases
|
||||
// Changes to this backend using new APIs should be accompanied by a regenerated stripped loader version.
|
||||
#define IMGL3W_IMPL
|
||||
#include "imgui_impl_opengl3_loader.h"
|
||||
#endif
|
||||
|
||||
// Vertex arrays are not supported on ES2/WebGL1 unless Emscripten which uses an extension
|
||||
#ifndef IMGUI_IMPL_OPENGL_ES2
|
||||
#define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
#define IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
#define glBindVertexArray glBindVertexArrayOES
|
||||
#define glGenVertexArrays glGenVertexArraysOES
|
||||
#define glDeleteVertexArrays glDeleteVertexArraysOES
|
||||
#define GL_VERTEX_ARRAY_BINDING GL_VERTEX_ARRAY_BINDING_OES
|
||||
#endif
|
||||
|
||||
// Desktop GL 2.0+ has glPolygonMode() which GL ES and WebGL don't have.
|
||||
#ifdef GL_POLYGON_MODE
|
||||
#define IMGUI_IMPL_HAS_POLYGON_MODE
|
||||
#endif
|
||||
|
||||
// Desktop GL 3.2+ has glDrawElementsBaseVertex() which GL ES and WebGL don't have.
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_2)
|
||||
#define IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||
#endif
|
||||
|
||||
// Desktop GL 3.3+ and GL ES 3.0+ have glBindSampler()
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && (defined(IMGUI_IMPL_OPENGL_ES3) || defined(GL_VERSION_3_3))
|
||||
#define IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||
#endif
|
||||
|
||||
// Desktop GL 3.1+ has GL_PRIMITIVE_RESTART state
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && defined(GL_VERSION_3_1)
|
||||
#define IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||
#endif
|
||||
|
||||
// Desktop GL use extension detection
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
#define IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS
|
||||
#endif
|
||||
|
||||
// [Debugging]
|
||||
//#define IMGUI_IMPL_OPENGL_DEBUG
|
||||
#ifdef IMGUI_IMPL_OPENGL_DEBUG
|
||||
#include <stdio.h>
|
||||
#define GL_CALL(_CALL) do { _CALL; GLenum gl_err = glGetError(); if (gl_err != 0) fprintf(stderr, "GL error 0x%x returned from '%s'.\n", gl_err, #_CALL); } while (0) // Call with error check
|
||||
#else
|
||||
#define GL_CALL(_CALL) _CALL // Call without error check
|
||||
#endif
|
||||
|
||||
// OpenGL Data
|
||||
struct ImGui_ImplOpenGL3_Data
|
||||
{
|
||||
GLuint GlVersion; // Extracted at runtime using GL_MAJOR_VERSION, GL_MINOR_VERSION queries (e.g. 320 for GL 3.2)
|
||||
char GlslVersionString[32]; // Specified by user or detected based on compile time GL settings.
|
||||
bool GlProfileIsES2;
|
||||
bool GlProfileIsES3;
|
||||
bool GlProfileIsCompat;
|
||||
GLint GlProfileMask;
|
||||
GLuint FontTexture;
|
||||
GLuint ShaderHandle;
|
||||
GLint AttribLocationTex; // Uniforms location
|
||||
GLint AttribLocationProjMtx;
|
||||
GLuint AttribLocationVtxPos; // Vertex attributes location
|
||||
GLuint AttribLocationVtxUV;
|
||||
GLuint AttribLocationVtxColor;
|
||||
unsigned int VboHandle, ElementsHandle;
|
||||
GLsizeiptr VertexBufferSize;
|
||||
GLsizeiptr IndexBufferSize;
|
||||
bool HasClipOrigin;
|
||||
bool UseBufferSubData;
|
||||
|
||||
ImGui_ImplOpenGL3_Data() { memset((void*)this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||
static ImGui_ImplOpenGL3_Data* ImGui_ImplOpenGL3_GetBackendData()
|
||||
{
|
||||
return ImGui::GetCurrentContext() ? (ImGui_ImplOpenGL3_Data*)ImGui::GetIO().BackendRendererUserData : nullptr;
|
||||
}
|
||||
|
||||
// OpenGL vertex attribute state (for ES 1.0 and ES 2.0 only)
|
||||
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
struct ImGui_ImplOpenGL3_VtxAttribState
|
||||
{
|
||||
GLint Enabled, Size, Type, Normalized, Stride;
|
||||
GLvoid* Ptr;
|
||||
|
||||
void GetState(GLint index)
|
||||
{
|
||||
glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &Enabled);
|
||||
glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_SIZE, &Size);
|
||||
glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_TYPE, &Type);
|
||||
glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &Normalized);
|
||||
glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &Stride);
|
||||
glGetVertexAttribPointerv(index, GL_VERTEX_ATTRIB_ARRAY_POINTER, &Ptr);
|
||||
}
|
||||
void SetState(GLint index)
|
||||
{
|
||||
glVertexAttribPointer(index, Size, Type, (GLboolean)Normalized, Stride, Ptr);
|
||||
if (Enabled) glEnableVertexAttribArray(index); else glDisableVertexAttribArray(index);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
// Functions
|
||||
bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");
|
||||
|
||||
// Initialize our loader
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||
if (imgl3wInit() != 0)
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize OpenGL loader!\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGui_ImplOpenGL3_Data* bd = IM_NEW(ImGui_ImplOpenGL3_Data)();
|
||||
io.BackendRendererUserData = (void*)bd;
|
||||
io.BackendRendererName = "imgui_impl_opengl3";
|
||||
|
||||
// Query for GL version (e.g. 320 for GL 3.2)
|
||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||
// GLES 2
|
||||
bd->GlVersion = 200;
|
||||
bd->GlProfileIsES2 = true;
|
||||
#else
|
||||
// Desktop or GLES 3
|
||||
GLint major = 0;
|
||||
GLint minor = 0;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||
if (major == 0 && minor == 0)
|
||||
{
|
||||
// Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
|
||||
const char* gl_version = (const char*)glGetString(GL_VERSION);
|
||||
sscanf(gl_version, "%d.%d", &major, &minor);
|
||||
}
|
||||
bd->GlVersion = (GLuint)(major * 100 + minor * 10);
|
||||
#if defined(GL_CONTEXT_PROFILE_MASK)
|
||||
if (bd->GlVersion >= 320)
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &bd->GlProfileMask);
|
||||
bd->GlProfileIsCompat = (bd->GlProfileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
|
||||
#endif
|
||||
|
||||
#if defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
bd->GlProfileIsES3 = true;
|
||||
#endif
|
||||
|
||||
bd->UseBufferSubData = false;
|
||||
/*
|
||||
// Query vendor to enable glBufferSubData kludge
|
||||
#ifdef _WIN32
|
||||
if (const char* vendor = (const char*)glGetString(GL_VENDOR))
|
||||
if (strncmp(vendor, "Intel", 5) == 0)
|
||||
bd->UseBufferSubData = true;
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef IMGUI_IMPL_OPENGL_DEBUG
|
||||
printf("GlVersion = %d\nGlProfileIsCompat = %d\nGlProfileMask = 0x%X\nGlProfileIsES2 = %d, GlProfileIsES3 = %d\nGL_VENDOR = '%s'\nGL_RENDERER = '%s'\n", bd->GlVersion, bd->GlProfileIsCompat, bd->GlProfileMask, bd->GlProfileIsES2, bd->GlProfileIsES3, (const char*)glGetString(GL_VENDOR), (const char*)glGetString(GL_RENDERER)); // [DEBUG]
|
||||
#endif
|
||||
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||
if (bd->GlVersion >= 320)
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||
#endif
|
||||
|
||||
// Store GLSL version string so we can refer to it later in case we recreate shaders.
|
||||
// Note: GLSL version is NOT the same as GL version. Leave this to nullptr if unsure.
|
||||
if (glsl_version == nullptr)
|
||||
{
|
||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||
glsl_version = "#version 100";
|
||||
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
glsl_version = "#version 300 es";
|
||||
#elif defined(__APPLE__)
|
||||
glsl_version = "#version 150";
|
||||
#else
|
||||
glsl_version = "#version 130";
|
||||
#endif
|
||||
}
|
||||
IM_ASSERT((int)strlen(glsl_version) + 2 < IM_ARRAYSIZE(bd->GlslVersionString));
|
||||
strcpy(bd->GlslVersionString, glsl_version);
|
||||
strcat(bd->GlslVersionString, "\n");
|
||||
|
||||
// Make an arbitrary GL call (we don't actually need the result)
|
||||
// IF YOU GET A CRASH HERE: it probably means the OpenGL function loader didn't do its job. Let us know!
|
||||
GLint current_texture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture);
|
||||
|
||||
// Detect extensions we support
|
||||
bd->HasClipOrigin = (bd->GlVersion >= 450);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_EXTENSIONS
|
||||
GLint num_extensions = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||
for (GLint i = 0; i < num_extensions; i++)
|
||||
{
|
||||
const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, i);
|
||||
if (extension != nullptr && strcmp(extension, "GL_ARB_clip_control") == 0)
|
||||
bd->HasClipOrigin = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL3_Shutdown()
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||
io.BackendRendererName = nullptr;
|
||||
io.BackendRendererUserData = nullptr;
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasVtxOffset;
|
||||
IM_DELETE(bd);
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL3_NewFrame()
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplOpenGL3_Init()?");
|
||||
|
||||
if (!bd->ShaderHandle)
|
||||
ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL3_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height, GLuint vertex_array_object)
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||
if (bd->GlVersion >= 310)
|
||||
glDisable(GL_PRIMITIVE_RESTART);
|
||||
#endif
|
||||
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
#endif
|
||||
|
||||
// Support for GL 4.5 rarely used glClipControl(GL_UPPER_LEFT)
|
||||
#if defined(GL_CLIP_ORIGIN)
|
||||
bool clip_origin_lower_left = true;
|
||||
if (bd->HasClipOrigin)
|
||||
{
|
||||
GLenum current_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)¤t_clip_origin);
|
||||
if (current_clip_origin == GL_UPPER_LEFT)
|
||||
clip_origin_lower_left = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
|
||||
GL_CALL(glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height));
|
||||
float L = draw_data->DisplayPos.x;
|
||||
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
||||
float T = draw_data->DisplayPos.y;
|
||||
float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
|
||||
#if defined(GL_CLIP_ORIGIN)
|
||||
if (!clip_origin_lower_left) { float tmp = T; T = B; B = tmp; } // Swap top and bottom if origin is upper left
|
||||
#endif
|
||||
const float ortho_projection[4][4] =
|
||||
{
|
||||
{ 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, -1.0f, 0.0f },
|
||||
{ (R+L)/(L-R), (T+B)/(B-T), 0.0f, 1.0f },
|
||||
};
|
||||
glUseProgram(bd->ShaderHandle);
|
||||
glUniform1i(bd->AttribLocationTex, 0);
|
||||
glUniformMatrix4fv(bd->AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||
if (bd->GlVersion >= 330 || bd->GlProfileIsES3)
|
||||
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 and GL ES 3.0 may set that otherwise.
|
||||
#endif
|
||||
|
||||
(void)vertex_array_object;
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
glBindVertexArray(vertex_array_object);
|
||||
#endif
|
||||
|
||||
// Bind vertex/index buffers and setup attributes for ImDrawVert
|
||||
GL_CALL(glBindBuffer(GL_ARRAY_BUFFER, bd->VboHandle));
|
||||
GL_CALL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bd->ElementsHandle));
|
||||
GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxPos));
|
||||
GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxUV));
|
||||
GL_CALL(glEnableVertexAttribArray(bd->AttribLocationVtxColor));
|
||||
GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxPos, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos)));
|
||||
GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv)));
|
||||
GL_CALL(glVertexAttribPointer(bd->AttribLocationVtxColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col)));
|
||||
}
|
||||
|
||||
// OpenGL3 Render function.
|
||||
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly.
|
||||
// This is in order to be able to run within an OpenGL engine that doesn't do so.
|
||||
void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
||||
{
|
||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||
int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
|
||||
int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
|
||||
if (fb_width <= 0 || fb_height <= 0)
|
||||
return;
|
||||
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
|
||||
// Backup GL state
|
||||
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program);
|
||||
GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||
GLuint last_sampler; if (bd->GlVersion >= 330 || bd->GlProfileIsES3) { glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler); } else { last_sampler = 0; }
|
||||
#endif
|
||||
GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
|
||||
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
// This is part of VAO on OpenGL 3.0+ and OpenGL ES 3.0+.
|
||||
GLint last_element_array_buffer; glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
|
||||
ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_pos; last_vtx_attrib_state_pos.GetState(bd->AttribLocationVtxPos);
|
||||
ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_uv; last_vtx_attrib_state_uv.GetState(bd->AttribLocationVtxUV);
|
||||
ImGui_ImplOpenGL3_VtxAttribState last_vtx_attrib_state_color; last_vtx_attrib_state_color.GetState(bd->AttribLocationVtxColor);
|
||||
#endif
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object);
|
||||
#endif
|
||||
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||
#endif
|
||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||
GLenum last_blend_src_rgb; glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
||||
GLenum last_blend_dst_rgb; glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb);
|
||||
GLenum last_blend_src_alpha; glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha);
|
||||
GLenum last_blend_dst_alpha; glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha);
|
||||
GLenum last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb);
|
||||
GLenum last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha);
|
||||
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||
GLboolean last_enable_stencil_test = glIsEnabled(GL_STENCIL_TEST);
|
||||
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||
GLboolean last_enable_primitive_restart = (bd->GlVersion >= 310) ? glIsEnabled(GL_PRIMITIVE_RESTART) : GL_FALSE;
|
||||
#endif
|
||||
|
||||
// Setup desired GL state
|
||||
// Recreate the VAO every time (this is to easily allow multiple GL contexts to be rendered to. VAO are not shared among GL contexts)
|
||||
// The renderer would actually work without any VAO bound, but then our VertexAttrib calls would overwrite the default one currently bound.
|
||||
GLuint vertex_array_object = 0;
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
GL_CALL(glGenVertexArrays(1, &vertex_array_object));
|
||||
#endif
|
||||
ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
|
||||
|
||||
// Will project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
||||
|
||||
// Render command lists
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
|
||||
// Upload vertex/index buffers
|
||||
// - OpenGL drivers are in a very sorry state nowadays....
|
||||
// During 2021 we attempted to switch from glBufferData() to orphaning+glBufferSubData() following reports
|
||||
// of leaks on Intel GPU when using multi-viewports on Windows.
|
||||
// - After this we kept hearing of various display corruptions issues. We started disabling on non-Intel GPU, but issues still got reported on Intel.
|
||||
// - We are now back to using exclusively glBufferData(). So bd->UseBufferSubData IS ALWAYS FALSE in this code.
|
||||
// We are keeping the old code path for a while in case people finding new issues may want to test the bd->UseBufferSubData path.
|
||||
// - See https://github.com/ocornut/imgui/issues/4468 and please report any corruption issues.
|
||||
const GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
|
||||
const GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
|
||||
if (bd->UseBufferSubData)
|
||||
{
|
||||
if (bd->VertexBufferSize < vtx_buffer_size)
|
||||
{
|
||||
bd->VertexBufferSize = vtx_buffer_size;
|
||||
GL_CALL(glBufferData(GL_ARRAY_BUFFER, bd->VertexBufferSize, nullptr, GL_STREAM_DRAW));
|
||||
}
|
||||
if (bd->IndexBufferSize < idx_buffer_size)
|
||||
{
|
||||
bd->IndexBufferSize = idx_buffer_size;
|
||||
GL_CALL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, bd->IndexBufferSize, nullptr, GL_STREAM_DRAW));
|
||||
}
|
||||
GL_CALL(glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data));
|
||||
GL_CALL(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data));
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CALL(glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW));
|
||||
GL_CALL(glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW));
|
||||
}
|
||||
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback != nullptr)
|
||||
{
|
||||
// User callback, registered via ImDrawList::AddCallback()
|
||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||
ImGui_ImplOpenGL3_SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
|
||||
else
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
||||
continue;
|
||||
|
||||
// Apply scissor/clipping rectangle (Y is inverted in OpenGL)
|
||||
GL_CALL(glScissor((int)clip_min.x, (int)((float)fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)));
|
||||
|
||||
// Bind texture, Draw
|
||||
GL_CALL(glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID()));
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||
if (bd->GlVersion >= 320)
|
||||
GL_CALL(glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset));
|
||||
else
|
||||
#endif
|
||||
GL_CALL(glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy the temporary VAO
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
GL_CALL(glDeleteVertexArrays(1, &vertex_array_object));
|
||||
#endif
|
||||
|
||||
// Restore modified GL state
|
||||
// This "glIsProgram()" check is required because if the program is "pending deletion" at the time of binding backup, it will have been deleted by now and will cause an OpenGL error. See #6220.
|
||||
if (last_program == 0 || glIsProgram(last_program)) glUseProgram(last_program);
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_BIND_SAMPLER
|
||||
if (bd->GlVersion >= 330 || bd->GlProfileIsES3)
|
||||
glBindSampler(0, last_sampler);
|
||||
#endif
|
||||
glActiveTexture(last_active_texture);
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
glBindVertexArray(last_vertex_array_object);
|
||||
#endif
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
#ifndef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
|
||||
last_vtx_attrib_state_pos.SetState(bd->AttribLocationVtxPos);
|
||||
last_vtx_attrib_state_uv.SetState(bd->AttribLocationVtxUV);
|
||||
last_vtx_attrib_state_color.SetState(bd->AttribLocationVtxColor);
|
||||
#endif
|
||||
glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
||||
glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
|
||||
if (last_enable_blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
|
||||
if (last_enable_cull_face) glEnable(GL_CULL_FACE); else glDisable(GL_CULL_FACE);
|
||||
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||
if (last_enable_stencil_test) glEnable(GL_STENCIL_TEST); else glDisable(GL_STENCIL_TEST);
|
||||
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_PRIMITIVE_RESTART
|
||||
if (bd->GlVersion >= 310) { if (last_enable_primitive_restart) glEnable(GL_PRIMITIVE_RESTART); else glDisable(GL_PRIMITIVE_RESTART); }
|
||||
#endif
|
||||
|
||||
#ifdef IMGUI_IMPL_HAS_POLYGON_MODE
|
||||
// Desktop OpenGL 3.0 and OpenGL 3.1 had separate polygon draw modes for front-facing and back-facing faces of polygons
|
||||
if (bd->GlVersion <= 310 || bd->GlProfileIsCompat)
|
||||
{
|
||||
glPolygonMode(GL_FRONT, (GLenum)last_polygon_mode[0]);
|
||||
glPolygonMode(GL_BACK, (GLenum)last_polygon_mode[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
||||
}
|
||||
#endif // IMGUI_IMPL_HAS_POLYGON_MODE
|
||||
|
||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||
(void)bd; // Not all compilation paths use this
|
||||
}
|
||||
|
||||
bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
|
||||
// Build texture atlas
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||
|
||||
// Upload texture to graphics system
|
||||
// (Bilinear sampling is required by default. Set 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines' or 'style.AntiAliasedLinesUseTex = false' to allow point/nearest sampling)
|
||||
GLint last_texture;
|
||||
GL_CALL(glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture));
|
||||
GL_CALL(glGenTextures(1, &bd->FontTexture));
|
||||
GL_CALL(glBindTexture(GL_TEXTURE_2D, bd->FontTexture));
|
||||
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
#ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES
|
||||
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0));
|
||||
#endif
|
||||
GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);
|
||||
|
||||
// Restore state
|
||||
GL_CALL(glBindTexture(GL_TEXTURE_2D, last_texture));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL3_DestroyFontsTexture()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
if (bd->FontTexture)
|
||||
{
|
||||
glDeleteTextures(1, &bd->FontTexture);
|
||||
io.Fonts->SetTexID(0);
|
||||
bd->FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If you get an error please report on github. You may try different GL context version or GLSL version. See GL<>GLSL version table at the top of this file.
|
||||
static bool CheckShader(GLuint handle, const char* desc)
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
GLint status = 0, log_length = 0;
|
||||
glGetShaderiv(handle, GL_COMPILE_STATUS, &status);
|
||||
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||
if ((GLboolean)status == GL_FALSE)
|
||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to compile %s! With GLSL: %s\n", desc, bd->GlslVersionString);
|
||||
if (log_length > 1)
|
||||
{
|
||||
ImVector<char> buf;
|
||||
buf.resize((int)(log_length + 1));
|
||||
glGetShaderInfoLog(handle, log_length, nullptr, (GLchar*)buf.begin());
|
||||
fprintf(stderr, "%s\n", buf.begin());
|
||||
}
|
||||
return (GLboolean)status == GL_TRUE;
|
||||
}
|
||||
|
||||
// If you get an error please report on GitHub. You may try different GL context version or GLSL version.
|
||||
static bool CheckProgram(GLuint handle, const char* desc)
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
GLint status = 0, log_length = 0;
|
||||
glGetProgramiv(handle, GL_LINK_STATUS, &status);
|
||||
glGetProgramiv(handle, GL_INFO_LOG_LENGTH, &log_length);
|
||||
if ((GLboolean)status == GL_FALSE)
|
||||
fprintf(stderr, "ERROR: ImGui_ImplOpenGL3_CreateDeviceObjects: failed to link %s! With GLSL %s\n", desc, bd->GlslVersionString);
|
||||
if (log_length > 1)
|
||||
{
|
||||
ImVector<char> buf;
|
||||
buf.resize((int)(log_length + 1));
|
||||
glGetProgramInfoLog(handle, log_length, nullptr, (GLchar*)buf.begin());
|
||||
fprintf(stderr, "%s\n", buf.begin());
|
||||
}
|
||||
return (GLboolean)status == GL_TRUE;
|
||||
}
|
||||
|
||||
bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
|
||||
// Backup GL state
|
||||
GLint last_texture, last_array_buffer;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
GLint last_vertex_array;
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||
#endif
|
||||
|
||||
// Parse GLSL version string
|
||||
int glsl_version = 130;
|
||||
sscanf(bd->GlslVersionString, "#version %d", &glsl_version);
|
||||
|
||||
const GLchar* vertex_shader_glsl_120 =
|
||||
"uniform mat4 ProjMtx;\n"
|
||||
"attribute vec2 Position;\n"
|
||||
"attribute vec2 UV;\n"
|
||||
"attribute vec4 Color;\n"
|
||||
"varying vec2 Frag_UV;\n"
|
||||
"varying 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* vertex_shader_glsl_130 =
|
||||
"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* vertex_shader_glsl_300_es =
|
||||
"precision highp float;\n"
|
||||
"layout (location = 0) in vec2 Position;\n"
|
||||
"layout (location = 1) in vec2 UV;\n"
|
||||
"layout (location = 2) in vec4 Color;\n"
|
||||
"uniform mat4 ProjMtx;\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* vertex_shader_glsl_410_core =
|
||||
"layout (location = 0) in vec2 Position;\n"
|
||||
"layout (location = 1) in vec2 UV;\n"
|
||||
"layout (location = 2) in vec4 Color;\n"
|
||||
"uniform mat4 ProjMtx;\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_glsl_120 =
|
||||
"#ifdef GL_ES\n"
|
||||
" precision mediump float;\n"
|
||||
"#endif\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"varying vec2 Frag_UV;\n"
|
||||
"varying vec4 Frag_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* fragment_shader_glsl_130 =
|
||||
"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";
|
||||
|
||||
const GLchar* fragment_shader_glsl_300_es =
|
||||
"precision mediump float;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"in vec2 Frag_UV;\n"
|
||||
"in vec4 Frag_Color;\n"
|
||||
"layout (location = 0) out vec4 Out_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* fragment_shader_glsl_410_core =
|
||||
"in vec2 Frag_UV;\n"
|
||||
"in vec4 Frag_Color;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"layout (location = 0) out vec4 Out_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
// Select shaders matching our GLSL versions
|
||||
const GLchar* vertex_shader = nullptr;
|
||||
const GLchar* fragment_shader = nullptr;
|
||||
if (glsl_version < 130)
|
||||
{
|
||||
vertex_shader = vertex_shader_glsl_120;
|
||||
fragment_shader = fragment_shader_glsl_120;
|
||||
}
|
||||
else if (glsl_version >= 410)
|
||||
{
|
||||
vertex_shader = vertex_shader_glsl_410_core;
|
||||
fragment_shader = fragment_shader_glsl_410_core;
|
||||
}
|
||||
else if (glsl_version == 300)
|
||||
{
|
||||
vertex_shader = vertex_shader_glsl_300_es;
|
||||
fragment_shader = fragment_shader_glsl_300_es;
|
||||
}
|
||||
else
|
||||
{
|
||||
vertex_shader = vertex_shader_glsl_130;
|
||||
fragment_shader = fragment_shader_glsl_130;
|
||||
}
|
||||
|
||||
// Create shaders
|
||||
const GLchar* vertex_shader_with_version[2] = { bd->GlslVersionString, vertex_shader };
|
||||
GLuint vert_handle = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(vert_handle, 2, vertex_shader_with_version, nullptr);
|
||||
glCompileShader(vert_handle);
|
||||
CheckShader(vert_handle, "vertex shader");
|
||||
|
||||
const GLchar* fragment_shader_with_version[2] = { bd->GlslVersionString, fragment_shader };
|
||||
GLuint frag_handle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(frag_handle, 2, fragment_shader_with_version, nullptr);
|
||||
glCompileShader(frag_handle);
|
||||
CheckShader(frag_handle, "fragment shader");
|
||||
|
||||
// Link
|
||||
bd->ShaderHandle = glCreateProgram();
|
||||
glAttachShader(bd->ShaderHandle, vert_handle);
|
||||
glAttachShader(bd->ShaderHandle, frag_handle);
|
||||
glLinkProgram(bd->ShaderHandle);
|
||||
CheckProgram(bd->ShaderHandle, "shader program");
|
||||
|
||||
glDetachShader(bd->ShaderHandle, vert_handle);
|
||||
glDetachShader(bd->ShaderHandle, frag_handle);
|
||||
glDeleteShader(vert_handle);
|
||||
glDeleteShader(frag_handle);
|
||||
|
||||
bd->AttribLocationTex = glGetUniformLocation(bd->ShaderHandle, "Texture");
|
||||
bd->AttribLocationProjMtx = glGetUniformLocation(bd->ShaderHandle, "ProjMtx");
|
||||
bd->AttribLocationVtxPos = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Position");
|
||||
bd->AttribLocationVtxUV = (GLuint)glGetAttribLocation(bd->ShaderHandle, "UV");
|
||||
bd->AttribLocationVtxColor = (GLuint)glGetAttribLocation(bd->ShaderHandle, "Color");
|
||||
|
||||
// Create buffers
|
||||
glGenBuffers(1, &bd->VboHandle);
|
||||
glGenBuffers(1, &bd->ElementsHandle);
|
||||
|
||||
ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||
|
||||
// Restore modified GL state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
#ifdef IMGUI_IMPL_OPENGL_USE_VERTEX_ARRAY
|
||||
glBindVertexArray(last_vertex_array);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL3_DestroyDeviceObjects()
|
||||
{
|
||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||
if (bd->VboHandle) { glDeleteBuffers(1, &bd->VboHandle); bd->VboHandle = 0; }
|
||||
if (bd->ElementsHandle) { glDeleteBuffers(1, &bd->ElementsHandle); bd->ElementsHandle = 0; }
|
||||
if (bd->ShaderHandle) { glDeleteProgram(bd->ShaderHandle); bd->ShaderHandle = 0; }
|
||||
ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
66
Libraries/include/imgui/imgui_impl_opengl3.h
Normal file
66
Libraries/include/imgui/imgui_impl_opengl3.h
Normal file
@ -0,0 +1,66 @@
|
||||
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||
// - Desktop GL: 2.x 3.x 4.x
|
||||
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only).
|
||||
|
||||
// About WebGL/ES:
|
||||
// - You need to '#define IMGUI_IMPL_OPENGL_ES2' or '#define IMGUI_IMPL_OPENGL_ES3' to use WebGL or OpenGL ES.
|
||||
// - This is done automatically on iOS, Android and Emscripten targets.
|
||||
// - For other targets, the define needs to be visible from the imgui_impl_opengl3.cpp compilation unit. If unsure, define globally or in imconfig.h.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// About GLSL version:
|
||||
// The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string.
|
||||
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
// Backend API
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr);
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// (Optional) Called by Init/NewFrame/Shutdown
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||
|
||||
// Specific OpenGL ES versions
|
||||
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
||||
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
||||
|
||||
// You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
|
||||
// Try to detect GLES on matching platforms
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__amigaos4__)
|
||||
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||
#else
|
||||
// Otherwise imgui_impl_opengl3_loader.h will be used.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
809
Libraries/include/imgui/imgui_impl_opengl3_loader.h
Normal file
809
Libraries/include/imgui/imgui_impl_opengl3_loader.h
Normal file
@ -0,0 +1,809 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// About imgui_impl_opengl3_loader.h:
|
||||
//
|
||||
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours,
|
||||
// which proved to be endless problems for users.
|
||||
// Our loader is custom-generated, based on gl3w but automatically filtered to only include
|
||||
// enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small.
|
||||
//
|
||||
// YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY.
|
||||
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
|
||||
//
|
||||
// IF YOU GET BUILD ERRORS IN THIS FILE (commonly macro redefinitions or function redefinitions):
|
||||
// IT LIKELY MEANS THAT YOU ARE BUILDING 'imgui_impl_opengl3.cpp' OR INCUDING 'imgui_impl_opengl3_loader.h'
|
||||
// IN THE SAME COMPILATION UNIT AS ONE OF YOUR FILE WHICH IS USING A THIRD-PARTY OPENGL LOADER.
|
||||
// (e.g. COULD HAPPEN IF YOU ARE DOING A UNITY/JUMBO BUILD, OR INCLUDING .CPP FILES FROM OTHERS)
|
||||
// YOU SHOULD NOT BUILD BOTH IN THE SAME COMPILATION UNIT.
|
||||
// BUT IF YOU REALLY WANT TO, you can '#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM' and imgui_impl_opengl3.cpp
|
||||
// WILL NOT BE USING OUR LOADER, AND INSTEAD EXPECT ANOTHER/YOUR LOADER TO BE AVAILABLE IN THE COMPILATION UNIT.
|
||||
//
|
||||
// Regenerate with:
|
||||
// python gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt
|
||||
//
|
||||
// More info:
|
||||
// https://github.com/dearimgui/gl3w_stripped
|
||||
// https://github.com/ocornut/imgui/issues/4445
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* This file was generated with gl3w_gen.py, part of imgl3w
|
||||
* (hosted at https://github.com/dearimgui/gl3w_stripped)
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __gl3w_h_
|
||||
#define __gl3w_h_
|
||||
|
||||
// Adapted from KHR/khrplatform.h to avoid including entire file.
|
||||
#ifndef __khrplatform_h_
|
||||
typedef float khronos_float_t;
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
typedef signed __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)
|
||||
#include <stdint.h>
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#else
|
||||
typedef signed long long khronos_int64_t;
|
||||
typedef unsigned long long khronos_uint64_t;
|
||||
#endif
|
||||
#endif // __khrplatform_h_
|
||||
|
||||
#ifndef __gl_glcorearb_h_
|
||||
#define __gl_glcorearb_h_ 1
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
** Copyright 2013-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: MIT
|
||||
**
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
/* glcorearb.h is for use with OpenGL core profile implementations.
|
||||
** It should should be placed in the same directory as gl.h and
|
||||
** included as <GL/glcorearb.h>.
|
||||
**
|
||||
** glcorearb.h includes only APIs in the latest OpenGL core profile
|
||||
** implementation together with APIs in newer ARB extensions which
|
||||
** can be supported by the core profile. It does not, and never will
|
||||
** include functionality removed from the core profile, such as
|
||||
** fixed-function vertex and fragment processing.
|
||||
**
|
||||
** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or
|
||||
** <GL/glext.h> in the same source file.
|
||||
*/
|
||||
/* Generated C header for:
|
||||
* API: gl
|
||||
* Profile: core
|
||||
* Versions considered: .*
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: glcore
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
#ifndef GL_VERSION_1_0
|
||||
typedef void GLvoid;
|
||||
typedef unsigned int GLenum;
|
||||
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef int GLint;
|
||||
typedef int GLsizei;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef double GLdouble;
|
||||
typedef unsigned int GLuint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
#define GL_POLYGON_MODE 0x0B40
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_UNPACK_ROW_LENGTH 0x0CF2
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_FILL 0x1B02
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
|
||||
typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||
typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
||||
typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (APIENTRYP PFNGLFLUSHPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||
typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
|
||||
GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GLAPI void APIENTRY glClear (GLbitfield mask);
|
||||
GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GLAPI void APIENTRY glDisable (GLenum cap);
|
||||
GLAPI void APIENTRY glEnable (GLenum cap);
|
||||
GLAPI void APIENTRY glFlush (void);
|
||||
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
GLAPI GLenum APIENTRY glGetError (void);
|
||||
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||
GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
|
||||
GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
|
||||
GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
#endif /* GL_VERSION_1_0 */
|
||||
#ifndef GL_VERSION_1_1
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef double GLclampd;
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
|
||||
typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
|
||||
typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
#endif
|
||||
#endif /* GL_VERSION_1_1 */
|
||||
#ifndef GL_VERSION_1_3
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glActiveTexture (GLenum texture);
|
||||
#endif
|
||||
#endif /* GL_VERSION_1_3 */
|
||||
#ifndef GL_VERSION_1_4
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
GLAPI void APIENTRY glBlendEquation (GLenum mode);
|
||||
#endif
|
||||
#endif /* GL_VERSION_1_4 */
|
||||
#ifndef GL_VERSION_1_5
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
#endif
|
||||
#endif /* GL_VERSION_1_5 */
|
||||
#ifndef GL_VERSION_2_0
|
||||
typedef char GLchar;
|
||||
typedef khronos_int16_t GLshort;
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef khronos_uint16_t GLushort;
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
#define GL_UPPER_LEFT 0x8CA2
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||
typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||
typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||
typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||
typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||
typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
|
||||
typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GLAPI void APIENTRY glCompileShader (GLuint shader);
|
||||
GLAPI GLuint APIENTRY glCreateProgram (void);
|
||||
GLAPI GLuint APIENTRY glCreateShader (GLenum type);
|
||||
GLAPI void APIENTRY glDeleteProgram (GLuint program);
|
||||
GLAPI void APIENTRY glDeleteShader (GLuint shader);
|
||||
GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
|
||||
GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
|
||||
GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
|
||||
GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
|
||||
GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
|
||||
GLAPI void APIENTRY glLinkProgram (GLuint program);
|
||||
GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
GLAPI void APIENTRY glUseProgram (GLuint program);
|
||||
GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
|
||||
GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
#endif
|
||||
#endif /* GL_VERSION_2_0 */
|
||||
#ifndef GL_VERSION_3_0
|
||||
typedef khronos_uint16_t GLhalf;
|
||||
#define GL_MAJOR_VERSION 0x821B
|
||||
#define GL_MINOR_VERSION 0x821C
|
||||
#define GL_NUM_EXTENSIONS 0x821D
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
#define GL_VERTEX_ARRAY_BINDING 0x85B5
|
||||
typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
|
||||
typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
|
||||
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||
typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
|
||||
typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
|
||||
typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
|
||||
GLAPI void APIENTRY glBindVertexArray (GLuint array);
|
||||
GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
|
||||
GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
|
||||
#endif
|
||||
#endif /* GL_VERSION_3_0 */
|
||||
#ifndef GL_VERSION_3_1
|
||||
#define GL_VERSION_3_1 1
|
||||
#define GL_PRIMITIVE_RESTART 0x8F9D
|
||||
#endif /* GL_VERSION_3_1 */
|
||||
#ifndef GL_VERSION_3_2
|
||||
#define GL_VERSION_3_2 1
|
||||
typedef struct __GLsync *GLsync;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef khronos_int64_t GLint64;
|
||||
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
#define GL_CONTEXT_PROFILE_MASK 0x9126
|
||||
typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||
typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
|
||||
#endif
|
||||
#endif /* GL_VERSION_3_2 */
|
||||
#ifndef GL_VERSION_3_3
|
||||
#define GL_VERSION_3_3 1
|
||||
#define GL_SAMPLER_BINDING 0x8919
|
||||
typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
|
||||
#endif
|
||||
#endif /* GL_VERSION_3_3 */
|
||||
#ifndef GL_VERSION_4_1
|
||||
typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
|
||||
typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
|
||||
#endif /* GL_VERSION_4_1 */
|
||||
#ifndef GL_VERSION_4_3
|
||||
typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
|
||||
#endif /* GL_VERSION_4_3 */
|
||||
#ifndef GL_VERSION_4_5
|
||||
#define GL_CLIP_ORIGIN 0x935C
|
||||
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param);
|
||||
typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
|
||||
#endif /* GL_VERSION_4_5 */
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
typedef khronos_uint64_t GLuint64EXT;
|
||||
#endif /* GL_ARB_bindless_texture */
|
||||
#ifndef GL_ARB_cl_event
|
||||
struct _cl_context;
|
||||
struct _cl_event;
|
||||
#endif /* GL_ARB_cl_event */
|
||||
#ifndef GL_ARB_clip_control
|
||||
#define GL_ARB_clip_control 1
|
||||
#endif /* GL_ARB_clip_control */
|
||||
#ifndef GL_ARB_debug_output
|
||||
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
|
||||
#endif /* GL_ARB_debug_output */
|
||||
#ifndef GL_EXT_EGL_image_storage
|
||||
typedef void *GLeglImageOES;
|
||||
#endif /* GL_EXT_EGL_image_storage */
|
||||
#ifndef GL_EXT_direct_state_access
|
||||
typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
|
||||
#endif /* GL_EXT_direct_state_access */
|
||||
#ifndef GL_NV_draw_vulkan_image
|
||||
typedef void (APIENTRY *GLVULKANPROCNV)(void);
|
||||
#endif /* GL_NV_draw_vulkan_image */
|
||||
#ifndef GL_NV_gpu_shader5
|
||||
typedef khronos_int64_t GLint64EXT;
|
||||
#endif /* GL_NV_gpu_shader5 */
|
||||
#ifndef GL_NV_vertex_buffer_unified_memory
|
||||
typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
|
||||
#endif /* GL_NV_vertex_buffer_unified_memory */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL3W_API
|
||||
#define GL3W_API
|
||||
#endif
|
||||
|
||||
#ifndef __gl_h_
|
||||
#define __gl_h_
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GL3W_OK 0
|
||||
#define GL3W_ERROR_INIT -1
|
||||
#define GL3W_ERROR_LIBRARY_OPEN -2
|
||||
#define GL3W_ERROR_OPENGL_VERSION -3
|
||||
|
||||
typedef void (*GL3WglProc)(void);
|
||||
typedef GL3WglProc (*GL3WGetProcAddressProc)(const char *proc);
|
||||
|
||||
/* gl3w api */
|
||||
GL3W_API int imgl3wInit(void);
|
||||
GL3W_API int imgl3wInit2(GL3WGetProcAddressProc proc);
|
||||
GL3W_API int imgl3wIsSupported(int major, int minor);
|
||||
GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
|
||||
|
||||
/* gl3w internal state */
|
||||
union ImGL3WProcs {
|
||||
GL3WglProc ptr[59];
|
||||
struct {
|
||||
PFNGLACTIVETEXTUREPROC ActiveTexture;
|
||||
PFNGLATTACHSHADERPROC AttachShader;
|
||||
PFNGLBINDBUFFERPROC BindBuffer;
|
||||
PFNGLBINDSAMPLERPROC BindSampler;
|
||||
PFNGLBINDTEXTUREPROC BindTexture;
|
||||
PFNGLBINDVERTEXARRAYPROC BindVertexArray;
|
||||
PFNGLBLENDEQUATIONPROC BlendEquation;
|
||||
PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
|
||||
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
|
||||
PFNGLBUFFERDATAPROC BufferData;
|
||||
PFNGLBUFFERSUBDATAPROC BufferSubData;
|
||||
PFNGLCLEARPROC Clear;
|
||||
PFNGLCLEARCOLORPROC ClearColor;
|
||||
PFNGLCOMPILESHADERPROC CompileShader;
|
||||
PFNGLCREATEPROGRAMPROC CreateProgram;
|
||||
PFNGLCREATESHADERPROC CreateShader;
|
||||
PFNGLDELETEBUFFERSPROC DeleteBuffers;
|
||||
PFNGLDELETEPROGRAMPROC DeleteProgram;
|
||||
PFNGLDELETESHADERPROC DeleteShader;
|
||||
PFNGLDELETETEXTURESPROC DeleteTextures;
|
||||
PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays;
|
||||
PFNGLDETACHSHADERPROC DetachShader;
|
||||
PFNGLDISABLEPROC Disable;
|
||||
PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray;
|
||||
PFNGLDRAWELEMENTSPROC DrawElements;
|
||||
PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex;
|
||||
PFNGLENABLEPROC Enable;
|
||||
PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray;
|
||||
PFNGLFLUSHPROC Flush;
|
||||
PFNGLGENBUFFERSPROC GenBuffers;
|
||||
PFNGLGENTEXTURESPROC GenTextures;
|
||||
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
||||
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
|
||||
PFNGLGETERRORPROC GetError;
|
||||
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
|
||||
PFNGLGETPROGRAMIVPROC GetProgramiv;
|
||||
PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog;
|
||||
PFNGLGETSHADERIVPROC GetShaderiv;
|
||||
PFNGLGETSTRINGPROC GetString;
|
||||
PFNGLGETSTRINGIPROC GetStringi;
|
||||
PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation;
|
||||
PFNGLGETVERTEXATTRIBPOINTERVPROC GetVertexAttribPointerv;
|
||||
PFNGLGETVERTEXATTRIBIVPROC GetVertexAttribiv;
|
||||
PFNGLISENABLEDPROC IsEnabled;
|
||||
PFNGLISPROGRAMPROC IsProgram;
|
||||
PFNGLLINKPROGRAMPROC LinkProgram;
|
||||
PFNGLPIXELSTOREIPROC PixelStorei;
|
||||
PFNGLPOLYGONMODEPROC PolygonMode;
|
||||
PFNGLREADPIXELSPROC ReadPixels;
|
||||
PFNGLSCISSORPROC Scissor;
|
||||
PFNGLSHADERSOURCEPROC ShaderSource;
|
||||
PFNGLTEXIMAGE2DPROC TexImage2D;
|
||||
PFNGLTEXPARAMETERIPROC TexParameteri;
|
||||
PFNGLUNIFORM1IPROC Uniform1i;
|
||||
PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv;
|
||||
PFNGLUSEPROGRAMPROC UseProgram;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer;
|
||||
PFNGLVIEWPORTPROC Viewport;
|
||||
} gl;
|
||||
};
|
||||
|
||||
GL3W_API extern union ImGL3WProcs imgl3wProcs;
|
||||
|
||||
/* OpenGL functions */
|
||||
#define glActiveTexture imgl3wProcs.gl.ActiveTexture
|
||||
#define glAttachShader imgl3wProcs.gl.AttachShader
|
||||
#define glBindBuffer imgl3wProcs.gl.BindBuffer
|
||||
#define glBindSampler imgl3wProcs.gl.BindSampler
|
||||
#define glBindTexture imgl3wProcs.gl.BindTexture
|
||||
#define glBindVertexArray imgl3wProcs.gl.BindVertexArray
|
||||
#define glBlendEquation imgl3wProcs.gl.BlendEquation
|
||||
#define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate
|
||||
#define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate
|
||||
#define glBufferData imgl3wProcs.gl.BufferData
|
||||
#define glBufferSubData imgl3wProcs.gl.BufferSubData
|
||||
#define glClear imgl3wProcs.gl.Clear
|
||||
#define glClearColor imgl3wProcs.gl.ClearColor
|
||||
#define glCompileShader imgl3wProcs.gl.CompileShader
|
||||
#define glCreateProgram imgl3wProcs.gl.CreateProgram
|
||||
#define glCreateShader imgl3wProcs.gl.CreateShader
|
||||
#define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers
|
||||
#define glDeleteProgram imgl3wProcs.gl.DeleteProgram
|
||||
#define glDeleteShader imgl3wProcs.gl.DeleteShader
|
||||
#define glDeleteTextures imgl3wProcs.gl.DeleteTextures
|
||||
#define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays
|
||||
#define glDetachShader imgl3wProcs.gl.DetachShader
|
||||
#define glDisable imgl3wProcs.gl.Disable
|
||||
#define glDisableVertexAttribArray imgl3wProcs.gl.DisableVertexAttribArray
|
||||
#define glDrawElements imgl3wProcs.gl.DrawElements
|
||||
#define glDrawElementsBaseVertex imgl3wProcs.gl.DrawElementsBaseVertex
|
||||
#define glEnable imgl3wProcs.gl.Enable
|
||||
#define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray
|
||||
#define glFlush imgl3wProcs.gl.Flush
|
||||
#define glGenBuffers imgl3wProcs.gl.GenBuffers
|
||||
#define glGenTextures imgl3wProcs.gl.GenTextures
|
||||
#define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
|
||||
#define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
|
||||
#define glGetError imgl3wProcs.gl.GetError
|
||||
#define glGetIntegerv imgl3wProcs.gl.GetIntegerv
|
||||
#define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog
|
||||
#define glGetProgramiv imgl3wProcs.gl.GetProgramiv
|
||||
#define glGetShaderInfoLog imgl3wProcs.gl.GetShaderInfoLog
|
||||
#define glGetShaderiv imgl3wProcs.gl.GetShaderiv
|
||||
#define glGetString imgl3wProcs.gl.GetString
|
||||
#define glGetStringi imgl3wProcs.gl.GetStringi
|
||||
#define glGetUniformLocation imgl3wProcs.gl.GetUniformLocation
|
||||
#define glGetVertexAttribPointerv imgl3wProcs.gl.GetVertexAttribPointerv
|
||||
#define glGetVertexAttribiv imgl3wProcs.gl.GetVertexAttribiv
|
||||
#define glIsEnabled imgl3wProcs.gl.IsEnabled
|
||||
#define glIsProgram imgl3wProcs.gl.IsProgram
|
||||
#define glLinkProgram imgl3wProcs.gl.LinkProgram
|
||||
#define glPixelStorei imgl3wProcs.gl.PixelStorei
|
||||
#define glPolygonMode imgl3wProcs.gl.PolygonMode
|
||||
#define glReadPixels imgl3wProcs.gl.ReadPixels
|
||||
#define glScissor imgl3wProcs.gl.Scissor
|
||||
#define glShaderSource imgl3wProcs.gl.ShaderSource
|
||||
#define glTexImage2D imgl3wProcs.gl.TexImage2D
|
||||
#define glTexParameteri imgl3wProcs.gl.TexParameteri
|
||||
#define glUniform1i imgl3wProcs.gl.Uniform1i
|
||||
#define glUniformMatrix4fv imgl3wProcs.gl.UniformMatrix4fv
|
||||
#define glUseProgram imgl3wProcs.gl.UseProgram
|
||||
#define glVertexAttribPointer imgl3wProcs.gl.VertexAttribPointer
|
||||
#define glViewport imgl3wProcs.gl.Viewport
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef IMGL3W_IMPL
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
static HMODULE libgl;
|
||||
typedef PROC(__stdcall* GL3WglGetProcAddr)(LPCSTR);
|
||||
static GL3WglGetProcAddr wgl_get_proc_address;
|
||||
|
||||
static int open_libgl(void)
|
||||
{
|
||||
libgl = LoadLibraryA("opengl32.dll");
|
||||
if (!libgl)
|
||||
return GL3W_ERROR_LIBRARY_OPEN;
|
||||
wgl_get_proc_address = (GL3WglGetProcAddr)GetProcAddress(libgl, "wglGetProcAddress");
|
||||
return GL3W_OK;
|
||||
}
|
||||
|
||||
static void close_libgl(void) { FreeLibrary(libgl); }
|
||||
static GL3WglProc get_proc(const char *proc)
|
||||
{
|
||||
GL3WglProc res;
|
||||
res = (GL3WglProc)wgl_get_proc_address(proc);
|
||||
if (!res)
|
||||
res = (GL3WglProc)GetProcAddress(libgl, proc);
|
||||
return res;
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void *libgl;
|
||||
static int open_libgl(void)
|
||||
{
|
||||
libgl = dlopen("/System/Library/Frameworks/OpenGL.framework/OpenGL", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (!libgl)
|
||||
return GL3W_ERROR_LIBRARY_OPEN;
|
||||
return GL3W_OK;
|
||||
}
|
||||
|
||||
static void close_libgl(void) { dlclose(libgl); }
|
||||
|
||||
static GL3WglProc get_proc(const char *proc)
|
||||
{
|
||||
GL3WglProc res;
|
||||
*(void **)(&res) = dlsym(libgl, proc);
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void *libgl;
|
||||
static GL3WglProc (*glx_get_proc_address)(const GLubyte *);
|
||||
|
||||
static int open_libgl(void)
|
||||
{
|
||||
libgl = dlopen("libGL.so.1", RTLD_LAZY | RTLD_LOCAL);
|
||||
if (!libgl)
|
||||
return GL3W_ERROR_LIBRARY_OPEN;
|
||||
*(void **)(&glx_get_proc_address) = dlsym(libgl, "glXGetProcAddressARB");
|
||||
return GL3W_OK;
|
||||
}
|
||||
|
||||
static void close_libgl(void) { dlclose(libgl); }
|
||||
|
||||
static GL3WglProc get_proc(const char *proc)
|
||||
{
|
||||
GL3WglProc res;
|
||||
res = glx_get_proc_address((const GLubyte *)proc);
|
||||
if (!res)
|
||||
*(void **)(&res) = dlsym(libgl, proc);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct { int major, minor; } version;
|
||||
|
||||
static int parse_version(void)
|
||||
{
|
||||
if (!glGetIntegerv)
|
||||
return GL3W_ERROR_INIT;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &version.major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &version.minor);
|
||||
if (version.major == 0 && version.minor == 0)
|
||||
{
|
||||
// Query GL_VERSION in desktop GL 2.x, the string will start with "<major>.<minor>"
|
||||
if (const char* gl_version = (const char*)glGetString(GL_VERSION))
|
||||
sscanf(gl_version, "%d.%d", &version.major, &version.minor);
|
||||
}
|
||||
if (version.major < 2)
|
||||
return GL3W_ERROR_OPENGL_VERSION;
|
||||
return GL3W_OK;
|
||||
}
|
||||
|
||||
static void load_procs(GL3WGetProcAddressProc proc);
|
||||
|
||||
int imgl3wInit(void)
|
||||
{
|
||||
int res = open_libgl();
|
||||
if (res)
|
||||
return res;
|
||||
atexit(close_libgl);
|
||||
return imgl3wInit2(get_proc);
|
||||
}
|
||||
|
||||
int imgl3wInit2(GL3WGetProcAddressProc proc)
|
||||
{
|
||||
load_procs(proc);
|
||||
return parse_version();
|
||||
}
|
||||
|
||||
int imgl3wIsSupported(int major, int minor)
|
||||
{
|
||||
if (major < 2)
|
||||
return 0;
|
||||
if (version.major == major)
|
||||
return version.minor >= minor;
|
||||
return version.major >= major;
|
||||
}
|
||||
|
||||
GL3WglProc imgl3wGetProcAddress(const char *proc) { return get_proc(proc); }
|
||||
|
||||
static const char *proc_names[] = {
|
||||
"glActiveTexture",
|
||||
"glAttachShader",
|
||||
"glBindBuffer",
|
||||
"glBindSampler",
|
||||
"glBindTexture",
|
||||
"glBindVertexArray",
|
||||
"glBlendEquation",
|
||||
"glBlendEquationSeparate",
|
||||
"glBlendFuncSeparate",
|
||||
"glBufferData",
|
||||
"glBufferSubData",
|
||||
"glClear",
|
||||
"glClearColor",
|
||||
"glCompileShader",
|
||||
"glCreateProgram",
|
||||
"glCreateShader",
|
||||
"glDeleteBuffers",
|
||||
"glDeleteProgram",
|
||||
"glDeleteShader",
|
||||
"glDeleteTextures",
|
||||
"glDeleteVertexArrays",
|
||||
"glDetachShader",
|
||||
"glDisable",
|
||||
"glDisableVertexAttribArray",
|
||||
"glDrawElements",
|
||||
"glDrawElementsBaseVertex",
|
||||
"glEnable",
|
||||
"glEnableVertexAttribArray",
|
||||
"glFlush",
|
||||
"glGenBuffers",
|
||||
"glGenTextures",
|
||||
"glGenVertexArrays",
|
||||
"glGetAttribLocation",
|
||||
"glGetError",
|
||||
"glGetIntegerv",
|
||||
"glGetProgramInfoLog",
|
||||
"glGetProgramiv",
|
||||
"glGetShaderInfoLog",
|
||||
"glGetShaderiv",
|
||||
"glGetString",
|
||||
"glGetStringi",
|
||||
"glGetUniformLocation",
|
||||
"glGetVertexAttribPointerv",
|
||||
"glGetVertexAttribiv",
|
||||
"glIsEnabled",
|
||||
"glIsProgram",
|
||||
"glLinkProgram",
|
||||
"glPixelStorei",
|
||||
"glPolygonMode",
|
||||
"glReadPixels",
|
||||
"glScissor",
|
||||
"glShaderSource",
|
||||
"glTexImage2D",
|
||||
"glTexParameteri",
|
||||
"glUniform1i",
|
||||
"glUniformMatrix4fv",
|
||||
"glUseProgram",
|
||||
"glVertexAttribPointer",
|
||||
"glViewport",
|
||||
};
|
||||
|
||||
GL3W_API union ImGL3WProcs imgl3wProcs;
|
||||
|
||||
static void load_procs(GL3WGetProcAddressProc proc)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < ARRAY_SIZE(proc_names); i++)
|
||||
imgl3wProcs.ptr[i] = proc(proc_names[i]);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
3477
Libraries/include/imgui/imgui_internal.h
Normal file
3477
Libraries/include/imgui/imgui_internal.h
Normal file
File diff suppressed because it is too large
Load Diff
4329
Libraries/include/imgui/imgui_tables.cpp
Normal file
4329
Libraries/include/imgui/imgui_tables.cpp
Normal file
File diff suppressed because it is too large
Load Diff
8926
Libraries/include/imgui/imgui_widgets.cpp
Normal file
8926
Libraries/include/imgui/imgui_widgets.cpp
Normal file
File diff suppressed because it is too large
Load Diff
627
Libraries/include/imgui/imstb_rectpack.h
Normal file
627
Libraries/include/imgui/imstb_rectpack.h
Normal file
@ -0,0 +1,627 @@
|
||||
// [DEAR IMGUI]
|
||||
// This is a slightly modified version of stb_rect_pack.h 1.01.
|
||||
// Grep for [DEAR IMGUI] to find the changes.
|
||||
//
|
||||
// stb_rect_pack.h - v1.01 - public domain - rectangle packing
|
||||
// Sean Barrett 2014
|
||||
//
|
||||
// Useful for e.g. packing rectangular textures into an atlas.
|
||||
// Does not do rotation.
|
||||
//
|
||||
// Before #including,
|
||||
//
|
||||
// #define STB_RECT_PACK_IMPLEMENTATION
|
||||
//
|
||||
// in the file that you want to have the implementation.
|
||||
//
|
||||
// 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.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section
|
||||
// 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;
|
||||
|
||||
typedef int stbrp_coord;
|
||||
|
||||
#define STBRP__MAXVAL 0x7fffffff
|
||||
// Mostly for internal use, but this is the maximum supported coordinate value.
|
||||
|
||||
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
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
context->extra[1].y = (1<<30);
|
||||
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); [DEAR IMGUI]
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
1440
Libraries/include/imgui/imstb_textedit.h
Normal file
1440
Libraries/include/imgui/imstb_textedit.h
Normal file
File diff suppressed because it is too large
Load Diff
5085
Libraries/include/imgui/imstb_truetype.h
Normal file
5085
Libraries/include/imgui/imstb_truetype.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -85,6 +85,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Libraries\include\imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -115,6 +116,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Libraries\include\imgui;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@ -139,6 +141,17 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imconfig.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\ImGuiFileDialog.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\ImGuiFileDialogConfig.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_glfw.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_opengl3.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_opengl3_loader.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_internal.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_rectpack.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_textedit.h" />
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_truetype.h" />
|
||||
<ClInclude Include="ac.h" />
|
||||
<ClInclude Include="alarm.h" />
|
||||
<ClInclude Include="alo.h" />
|
||||
@ -162,16 +175,19 @@
|
||||
<ClInclude Include="cycle.h" />
|
||||
<ClInclude Include="dart.h" />
|
||||
<ClInclude Include="dartgun.h" />
|
||||
<ClInclude Include="debug.h" />
|
||||
<ClInclude Include="dec.h" />
|
||||
<ClInclude Include="dialog.h" />
|
||||
<ClInclude Include="difficulty.h" />
|
||||
<ClInclude Include="dl.h" />
|
||||
<ClInclude Include="dsp.h" />
|
||||
<ClInclude Include="dysh.h" />
|
||||
<ClInclude Include="emitter.h" />
|
||||
<ClInclude Include="flash.h" />
|
||||
<ClInclude Include="fly.h" />
|
||||
<ClInclude Include="font.h" />
|
||||
<ClInclude Include="freeze.h" />
|
||||
<ClInclude Include="frzg.h" />
|
||||
<ClInclude Include="geom.h" />
|
||||
<ClInclude Include="gl.h" />
|
||||
<ClInclude Include="glob.h" />
|
||||
@ -191,6 +207,7 @@
|
||||
<ClInclude Include="light.h" />
|
||||
<ClInclude Include="lo.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="map2d.h" />
|
||||
<ClInclude Include="mb.h" />
|
||||
<ClInclude Include="mecha.h" />
|
||||
<ClInclude Include="mgv.h" />
|
||||
@ -223,6 +240,7 @@
|
||||
<ClInclude Include="shd.h" />
|
||||
<ClInclude Include="shdanim.h" />
|
||||
<ClInclude Include="sidebag.h" />
|
||||
<ClInclude Include="sky.h" />
|
||||
<ClInclude Include="sm.h" />
|
||||
<ClInclude Include="smartguard.h" />
|
||||
<ClInclude Include="so.h" />
|
||||
@ -230,6 +248,7 @@
|
||||
<ClInclude Include="speaker.h" />
|
||||
<ClInclude Include="spire.h" />
|
||||
<ClInclude Include="splicemap.h" />
|
||||
<ClInclude Include="sqtr.h" />
|
||||
<ClInclude Include="squish.h" />
|
||||
<ClInclude Include="step.h" />
|
||||
<ClInclude Include="stepguard.h" />
|
||||
@ -246,12 +265,21 @@
|
||||
<ClInclude Include="vis.h" />
|
||||
<ClInclude Include="water.h" />
|
||||
<ClInclude Include="waypoint.h" />
|
||||
<ClInclude Include="wipe.h" />
|
||||
<ClInclude Include="wm.h" />
|
||||
<ClInclude Include="wr.h" />
|
||||
<ClInclude Include="xform.h" />
|
||||
<ClInclude Include="zap.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\ImGuiFileDialog.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_demo.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_draw.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_impl_glfw.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_impl_opengl3.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_tables.cpp" />
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_widgets.cpp" />
|
||||
<ClCompile Include="ac.cpp" />
|
||||
<ClCompile Include="alarm.cpp" />
|
||||
<ClCompile Include="alo.cpp" />
|
||||
@ -275,15 +303,18 @@
|
||||
<ClCompile Include="cycle.cpp" />
|
||||
<ClCompile Include="dart.cpp" />
|
||||
<ClCompile Include="dartgun.cpp" />
|
||||
<ClCompile Include="debug.cpp" />
|
||||
<ClCompile Include="dialog.cpp" />
|
||||
<ClCompile Include="difficulty.cpp" />
|
||||
<ClCompile Include="dl.cpp" />
|
||||
<ClCompile Include="dsp.cpp" />
|
||||
<ClCompile Include="dysh.cpp" />
|
||||
<ClCompile Include="emitter.cpp" />
|
||||
<ClCompile Include="flash.cpp" />
|
||||
<ClCompile Include="fly.cpp" />
|
||||
<ClCompile Include="font.cpp" />
|
||||
<ClCompile Include="freeze.cpp" />
|
||||
<ClCompile Include="frzg.cpp" />
|
||||
<ClCompile Include="geom.cpp" />
|
||||
<ClCompile Include="gl.cpp" />
|
||||
<ClCompile Include="glad.c" />
|
||||
@ -304,6 +335,7 @@
|
||||
<ClCompile Include="light.cpp" />
|
||||
<ClCompile Include="lo.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="map2d.cpp" />
|
||||
<ClCompile Include="mb.cpp" />
|
||||
<ClCompile Include="mecha.cpp" />
|
||||
<ClCompile Include="mgv.cpp" />
|
||||
@ -335,6 +367,7 @@
|
||||
<ClCompile Include="shd.cpp" />
|
||||
<ClCompile Include="shdanim.cpp" />
|
||||
<ClCompile Include="sidebag.cpp" />
|
||||
<ClCompile Include="sky.cpp" />
|
||||
<ClCompile Include="sm.cpp" />
|
||||
<ClCompile Include="smartguard.cpp" />
|
||||
<ClCompile Include="so.cpp" />
|
||||
@ -342,6 +375,7 @@
|
||||
<ClCompile Include="speaker.cpp" />
|
||||
<ClCompile Include="spire.cpp" />
|
||||
<ClCompile Include="splicemap.cpp" />
|
||||
<ClCompile Include="sqtr.cpp" />
|
||||
<ClCompile Include="squish.cpp" />
|
||||
<ClCompile Include="step.cpp" />
|
||||
<ClCompile Include="stepguard.cpp" />
|
||||
@ -358,6 +392,7 @@
|
||||
<ClCompile Include="vis.cpp" />
|
||||
<ClCompile Include="water.cpp" />
|
||||
<ClCompile Include="waypoint.cpp" />
|
||||
<ClCompile Include="wipe.cpp" />
|
||||
<ClCompile Include="wm.cpp" />
|
||||
<ClCompile Include="wr.cpp" />
|
||||
<ClCompile Include="xform.cpp" />
|
||||
@ -366,6 +401,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\.gitignore" />
|
||||
<None Include="..\README.md" />
|
||||
<None Include="glob.frag" />
|
||||
<None Include="glob.vert" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Sly1.rc" />
|
||||
|
@ -13,6 +13,12 @@
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\imgui">
|
||||
<UniqueIdentifier>{a88b6376-734f-412b-839a-0b1855a6fa1b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\imgui">
|
||||
<UniqueIdentifier>{c4329843-7103-4000-8928-ee1fc64fa5b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="phasemem.h">
|
||||
@ -348,6 +354,60 @@
|
||||
<ClInclude Include="wm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imconfig.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_glfw.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_opengl3.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_impl_opengl3_loader.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imgui_internal.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_rectpack.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_textedit.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\imstb_truetype.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wipe.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\ImGuiFileDialog.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Libraries\include\imgui\ImGuiFileDialogConfig.h">
|
||||
<Filter>Header Files\imgui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="debug.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sqtr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sky.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="map2d.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="frzg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dsp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="phasemem.cpp">
|
||||
@ -680,6 +740,51 @@
|
||||
<ClCompile Include="wm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_demo.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_draw.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_impl_glfw.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_impl_opengl3.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_tables.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\imgui_widgets.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="wipe.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Libraries\include\imgui\ImGuiFileDialog.cpp">
|
||||
<Filter>Source Files\imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="debug.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sqtr.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sky.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="map2d.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="frzg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dsp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md">
|
||||
@ -688,6 +793,12 @@
|
||||
<None Include="..\.gitignore">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="glob.frag">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="glob.vert">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Sly1.rc">
|
||||
|
37
Sly1/alarm.h
37
Sly1/alarm.h
@ -1,9 +1,44 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
#include "break.h"
|
||||
|
||||
enum ALARMS
|
||||
{
|
||||
ALARMS_Nil = -1,
|
||||
ALARMS_Enabled = 0,
|
||||
ALARMS_Disabled = 1,
|
||||
ALARMS_Triggered = 2,
|
||||
ALARMS_Max = 3
|
||||
};
|
||||
|
||||
class ALARM : public SO
|
||||
{
|
||||
public:
|
||||
ALARMS alarms;
|
||||
float tAlarms;
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
float dtReset;
|
||||
int calbrks;
|
||||
OID aoidAlbrks[4];
|
||||
int coidSensors;
|
||||
OID aoidSensors[16];
|
||||
int cpsensors;
|
||||
struct SENSOR* apsensors[16];
|
||||
int coidStepguards;
|
||||
OID aoidStepguards[6];
|
||||
int calbrksDisabled;
|
||||
struct AMB* pambSiren;
|
||||
struct EXC* pexc;
|
||||
int fSilent;
|
||||
int crsmg;
|
||||
RSMG arsmg[8];
|
||||
int ichkDisabled;
|
||||
};
|
||||
|
||||
class ALBRK : public BRK
|
||||
{
|
||||
public:
|
||||
struct ALARM* palarm;
|
||||
};
|
||||
|
||||
void InitAlarm(ALARM* palarm);
|
73
Sly1/alo.cpp
73
Sly1/alo.cpp
@ -2,6 +2,7 @@
|
||||
|
||||
void InitAlo(ALO* palo)
|
||||
{
|
||||
//std::cout << palo << "\n";
|
||||
InitDl(&palo->dlChild, 0x78);
|
||||
InitDl(&palo->dlFreeze, 0xD0);
|
||||
|
||||
@ -10,7 +11,7 @@ void InitAlo(ALO* palo)
|
||||
palo->sMRD = 2139095039;
|
||||
palo->grfzon = -1;
|
||||
|
||||
InitDl(&palo->dlAct, 0x1C + 0x8);
|
||||
InitDl(&palo->dlAct, 0x230);
|
||||
}
|
||||
|
||||
void RemoveAloHierarchy(ALO *palo)
|
||||
@ -127,7 +128,6 @@ void LoadAloFromBrx(ALO* palo, CBinaryInputStream* pbis)
|
||||
{
|
||||
palo->xf.mat = pbis->ReadMatrix();
|
||||
palo->xf.pos = pbis->ReadVector();
|
||||
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
@ -139,15 +139,17 @@ void LoadAloFromBrx(ALO* palo, CBinaryInputStream* pbis)
|
||||
LoadOptionFromBrx(palo, pbis);
|
||||
LoadGlobsetFromBrx(&palo->globset, pbis);
|
||||
LoadAloAloxFromBrx(pbis);
|
||||
|
||||
|
||||
palo->cposec = pbis->U8Read();
|
||||
palo->aposec.resize(palo->cposec);
|
||||
|
||||
for (int i = 0; i < palo->cposec; i++)
|
||||
{
|
||||
pbis->S16Read();
|
||||
palo->aposec[i].oid = (OID)pbis->S16Read();
|
||||
palo->aposec[i].agPoses.resize(palo->globset.cpose);
|
||||
|
||||
for (int i = 0; i < palo->globset.cpose; i++)
|
||||
pbis->F32Read();
|
||||
for (int a = 0; a < palo->globset.cpose; a++)
|
||||
palo->aposec[i].agPoses[a] = pbis->F32Read();
|
||||
}
|
||||
|
||||
LoadSwObjectsFromBrx(palo->psw, palo, pbis);
|
||||
@ -249,4 +251,63 @@ void RenderAloLine(ALO* palo, CM* pcm, glm::vec3* ppos0, glm::vec3* ppos1, float
|
||||
void RenderAloAsBone(ALO* palo, CM* pcm, RO* pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DrawLo(ALO* palo)
|
||||
{
|
||||
|
||||
for (int i = 0; i < palo->globset.cglob; i++)
|
||||
{
|
||||
for (int a = 0; a < palo->globset.aglob[i].csubglob; a++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FreeGLBuffers(SW* psw)
|
||||
{
|
||||
DLI dlBusyDli;
|
||||
|
||||
// Loading SW object list
|
||||
dlBusyDli.m_pdl = &psw->dlBusy;
|
||||
// Loading base offset to next object
|
||||
dlBusyDli.m_ibDle = psw->dlBusy.ibDle;
|
||||
|
||||
dlBusyDli.m_pdliNext = s_pdliFirst;
|
||||
|
||||
// Loading first object in SW object list
|
||||
LO* localObject = psw->dlBusy.ploFirst;
|
||||
// Loading pointer to next object in SW list
|
||||
dlBusyDli.m_ppv = (void**)((uintptr_t)localObject + dlBusyDli.m_ibDle);
|
||||
|
||||
s_pdliFirst = &dlBusyDli;
|
||||
int loopCounter = 0;
|
||||
// Looping through all objects in a level
|
||||
while (localObject != 0)
|
||||
{
|
||||
//std::cout << loopCounter++ << "\n";
|
||||
if(localObject->pvtlo->cid != CID_PROXY)
|
||||
DeleteModel((ALO*)localObject);
|
||||
// Loading next object
|
||||
localObject = (LO*)*dlBusyDli.m_ppv;
|
||||
// Loading pointer to next object to render
|
||||
dlBusyDli.m_ppv = (void**)((uintptr_t)localObject + dlBusyDli.m_ibDle);
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteModel(ALO *palo)
|
||||
{
|
||||
for (int i = 0; i < palo->globset.cglob; i++)
|
||||
{
|
||||
for (int a = 0; a < palo->globset.aglob[i].asubglob.size(); a++)
|
||||
{
|
||||
glDeleteVertexArrays(1, &palo->globset.aglob[i].asubglob[a].VAO);
|
||||
glDeleteBuffers(1, &palo->globset.aglob[i].asubglob[a].VBO);
|
||||
glDeleteBuffers(1, &palo->globset.aglob[i].asubglob[a].VNO);
|
||||
glDeleteBuffers(1, &palo->globset.aglob[i].asubglob[a].VCB);
|
||||
glDeleteBuffers(1, &palo->globset.aglob[i].asubglob[a].TCB);
|
||||
glDeleteBuffers(1, &palo->globset.aglob[i].asubglob[a].EBO);
|
||||
}
|
||||
}
|
||||
}
|
61
Sly1/alo.h
61
Sly1/alo.h
@ -2,6 +2,7 @@
|
||||
#include "lo.h"
|
||||
#include "freeze.h"
|
||||
#include "glob.h"
|
||||
#include "sqtr.h"
|
||||
|
||||
struct XF
|
||||
{
|
||||
@ -20,6 +21,33 @@ struct RO
|
||||
float uAlpha;
|
||||
float uAlphaCelBorder;
|
||||
};
|
||||
struct POSEC
|
||||
{
|
||||
OID oid;
|
||||
std::vector <float> agPoses;
|
||||
};
|
||||
struct RSMG
|
||||
{
|
||||
OID oidRoot;
|
||||
OID oidSM;
|
||||
OID oidTriggerGoal;
|
||||
OID oidUntriggerGoal;
|
||||
};
|
||||
enum ACK
|
||||
{
|
||||
ACK_Nil = -1,
|
||||
ACK_None = 0,
|
||||
ACK_Spring = 1,
|
||||
ACK_Velocity = 2,
|
||||
ACK_Smooth = 3,
|
||||
ACK_Spline = 4,
|
||||
ACK_Drive = 5,
|
||||
ACK_SmoothForce = 6,
|
||||
ACK_SmoothLock = 7,
|
||||
ACK_SpringLock = 8,
|
||||
ACK_SmoothNoLock = 9,
|
||||
ACK_Max = 10
|
||||
};
|
||||
|
||||
class ALO : public LO
|
||||
{
|
||||
@ -37,21 +65,46 @@ public:
|
||||
float sCelBorderMRD;
|
||||
int grfzon;
|
||||
float dsMRDSnap;
|
||||
char frz[64];
|
||||
XF xf;
|
||||
glm::vec3 posOrig;
|
||||
glm::mat3 matOrig;
|
||||
glm::vec3 eulOrig;
|
||||
DL dlAct;
|
||||
struct ACT* pactPos;
|
||||
struct ACT* pactRot;
|
||||
struct ACT* pactScale;
|
||||
struct ACT** apactPose;
|
||||
struct ACT* pactRestore;
|
||||
struct ACTLA* pactla;
|
||||
struct ACTBANK* pactbank;
|
||||
struct IKH* pikh;
|
||||
struct CLQ* pclqPosSpring;
|
||||
struct CLQ* pclqPosDamping;
|
||||
struct CLQ* pclqRotSpring;
|
||||
struct CLQ* pclqRotDamping;
|
||||
struct SMPA* psmpaPos;
|
||||
struct SMPA* psmpaRot;
|
||||
struct ALOX* palox;
|
||||
int cframeStatic;
|
||||
GLOBSET globset;
|
||||
struct SHADOW *pshadow;
|
||||
struct THROB* pthrob;
|
||||
float sFastShadowRadius;
|
||||
float sFastShadowDepth;
|
||||
int fRealClock;
|
||||
struct FADER* pfader;
|
||||
float dtUpdatePause;
|
||||
struct ASEGD* pasegd;
|
||||
float sRadiusRenderSelf;
|
||||
float sRadiusRenderAll;
|
||||
struct SFX* psfx;
|
||||
char ficg[5];
|
||||
int cposec;
|
||||
std::vector <POSEC> aposec;
|
||||
struct ACTREF* pactrefCombo;
|
||||
struct DLR* pdlrFirst;
|
||||
ACK ackRot;
|
||||
};
|
||||
|
||||
// Initialize ALO object
|
||||
@ -66,10 +119,16 @@ void CloneAlo(ALO* palo);
|
||||
void ResolveAlo(ALO *palo);
|
||||
// Loads ALO object from binary file
|
||||
void LoadAloFromBrx(ALO* palo, CBinaryInputStream* pbis);
|
||||
// Loads bone data from binary file
|
||||
void LoadAloAloxFromBrx(CBinaryInputStream* pbis);
|
||||
void UpdateAlo(ALO *palo, float dt);
|
||||
void RenderAloAll(ALO* palo, CM* pcm, RO* proDup);
|
||||
void RenderAloSelf(ALO* palo, CM* pcm, RO* pro);
|
||||
void RenderAloGlobset(ALO* palo, CM* pcm, RO* pro);
|
||||
void RenderAloLine(ALO* palo, CM* pcm, glm::vec3* ppos0, glm::vec3* ppos1, float rWidth, float uAlpha);
|
||||
void RenderAloAsBone(ALO* palo, CM* pcm, RO* pro);
|
||||
void RenderAloAsBone(ALO* palo, CM* pcm, RO* pro);
|
||||
void DrawLo(ALO *palo);
|
||||
// Deletes all asset data from VRAM
|
||||
void FreeGLBuffers(SW* psw);
|
||||
// Deletes Model from VRAM
|
||||
void DeleteModel(ALO *palo);
|
@ -2,14 +2,12 @@
|
||||
|
||||
void InitAseg(ASEG* paseg)
|
||||
{
|
||||
//std::cout << "ASEG Size: " << sizeof(ASEG)<<"\n";
|
||||
InitLo(paseg);
|
||||
}
|
||||
|
||||
void LoadAsegFromBrx(ASEG* paseg, CBinaryInputStream* pbis)
|
||||
{
|
||||
/*LoadAsegaCount++;
|
||||
std::cout << "LoadAsegFromBrx: " << std::dec << LoadAsegaCount << "\n";
|
||||
std::cout << std::hex << pbis->file.tellg() << "\n";*/
|
||||
int16_t unk_0 = pbis->U16Read();
|
||||
int16_t unk_1 = pbis->U16Read();
|
||||
uint16_t unk_2 = pbis->U16Read();
|
||||
|
33
Sly1/aseg.h
33
Sly1/aseg.h
@ -1,9 +1,42 @@
|
||||
#pragma once
|
||||
#include "lo.h"
|
||||
|
||||
enum SEGRPT
|
||||
{
|
||||
SEGRPT_Nil = -1,
|
||||
SEGRPT_Once = 0,
|
||||
SEGRPT_Loop = 1,
|
||||
SEGRPT_PingPong = 2,
|
||||
SEGRPT_Manual = 3,
|
||||
SEGRPT_Max = 4
|
||||
};
|
||||
|
||||
class ASEG : public LO
|
||||
{
|
||||
public:
|
||||
float tMax;
|
||||
int cchn;
|
||||
struct CHN* achn;
|
||||
OID oidRoot;
|
||||
SEGRPT segrpt;
|
||||
int fDefault;
|
||||
int fHandsOff;
|
||||
int fRealClock;
|
||||
int ceaApply;
|
||||
struct EA* aeaApply;
|
||||
int ceaFrame;
|
||||
struct EA* aeaFrame;
|
||||
int ceaRetract;
|
||||
struct EA* aeaRetract;
|
||||
DL dlAsega;
|
||||
int nPriority;
|
||||
float svtMaster;
|
||||
CLQ clqMasterSuck;
|
||||
LM lmMasterSuck;
|
||||
float svtMasterSuck;
|
||||
struct CHN* pchnStrip;
|
||||
int coidSearchRoot;
|
||||
enum OID* aoidSearchRoot;
|
||||
};
|
||||
|
||||
static int LoadAsegaCount;
|
||||
|
@ -2,5 +2,6 @@
|
||||
|
||||
void InitBarrier(BARRIER* pbarrier)
|
||||
{
|
||||
//std::cout << "BARRIER Size: " << sizeof(BARRIER) << "\n";
|
||||
InitSo(pbarrier);
|
||||
}
|
||||
|
@ -1,9 +1,28 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
struct BARWARP
|
||||
{
|
||||
enum BWK bwk;
|
||||
union
|
||||
{
|
||||
glm::vec3 pos;
|
||||
OID oidWarp;
|
||||
struct WARP* pwarp;
|
||||
};
|
||||
};
|
||||
|
||||
class BARRIER : public SO
|
||||
{
|
||||
public:
|
||||
int fAllow;
|
||||
int coid;
|
||||
OID aoid[4];
|
||||
int ccid;
|
||||
CID acid[4];
|
||||
BARWARP barwarp;
|
||||
struct SO* psoWarp;
|
||||
struct SO* psoLastWarped;
|
||||
};
|
||||
|
||||
void InitBarrier(BARRIER* pbarrier);
|
246
Sly1/basic.h
246
Sly1/basic.h
@ -194,7 +194,7 @@ struct VTLO
|
||||
VT *pvtSuper = g_vtbasic.pvtSuper;
|
||||
CID cid = CID_LO;
|
||||
int grfcid = 0;
|
||||
int cb = 0x40;
|
||||
int cb = 120;
|
||||
|
||||
void (*pfnInitLo) (LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -234,7 +234,7 @@ struct VTALO
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_ALO;
|
||||
int grfcid = 1;
|
||||
int cb = 0x2E0;
|
||||
int cb = 1064;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -293,7 +293,7 @@ struct VTSO
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_SO;
|
||||
int grfcid = 3;
|
||||
int cb = 0x580;
|
||||
int cb = 2400;
|
||||
|
||||
void (*pfnInitSo) (SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -377,7 +377,7 @@ struct VTMS
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_MS;
|
||||
int grfcid = 3;
|
||||
int cb = 0x580;
|
||||
int cb = 2400;
|
||||
|
||||
void (*pfnInitSo) (SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -461,7 +461,7 @@ struct VTPO
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_PO;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x5D0;
|
||||
int cb = 2512;
|
||||
|
||||
void (*pfnInitPo) (PO*) = InitPo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -556,7 +556,7 @@ struct VTSTEP
|
||||
VT *pvtSuper = g_vtpo.pvtSuper;
|
||||
CID cid = CID_STEP;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x6E0;
|
||||
int cb = 2784;
|
||||
|
||||
void (*pfnInitStep)(STEP*) = InitStep;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -654,7 +654,7 @@ struct VTJT
|
||||
VT *pvtSuper = g_vtstep.pvtSuper;
|
||||
CID cid = CID_JT;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x2730;
|
||||
int cb = 11088;
|
||||
|
||||
void (*pfnInitJt)(JT*) = InitJt;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -752,7 +752,7 @@ struct VTSTEPGUARD
|
||||
VT *pvtSuper = g_vtstep.pvtSuper;
|
||||
CID cid = CID_STEPGUARD;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xB90;
|
||||
int cb = 4280;
|
||||
|
||||
void (*pfnInitStepguard)(STEPGUARD*) = InitStepGuard;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -861,7 +861,7 @@ struct VTSMARTGUARD
|
||||
VT *pvtSuper = g_vtstepguard.pvtSuper;
|
||||
CID cid = CID_SMARTGUARD;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xC50;
|
||||
int cb = 4624;
|
||||
|
||||
void (*pfnInitSmartguard)(SMARTGUARD*) = InitSmartGuard;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -970,7 +970,7 @@ struct VTGOMER
|
||||
VT *pvtSuper = g_vtstepguard.pvtSuper;
|
||||
CID cid = CID_GOMER;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xBD0;
|
||||
int cb = 4352;
|
||||
|
||||
void (*pfnInitGomer) (GOMER*) = InitGomer;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -1079,7 +1079,7 @@ struct VTUBG
|
||||
VT *pvtSuper = g_vtgomer.pvtSuper;
|
||||
CID cid = CID_UBG;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xC20;
|
||||
int cb = 4464;
|
||||
|
||||
void (*pfnInitLo) (UBG*) = InitUbg;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -1188,7 +1188,7 @@ struct VTMBG
|
||||
VT *pvtSuper = g_vtstepguard.pvtSuper;
|
||||
CID cid = CID_MBG;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xDC0;
|
||||
int cb = 0xDD0;
|
||||
|
||||
void (*pfnInitLo) (MBG*) = InitMbg;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -1406,7 +1406,7 @@ struct VTMURRAY
|
||||
VT *pvtSuper = g_vtstepguard.pvtSuper;
|
||||
CID cid = CID_MURRAY;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xBC0;
|
||||
int cb = 4352;
|
||||
|
||||
void (*pfnInitMurray) (MURRAY*) = InitMurray;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -1515,7 +1515,7 @@ struct VTPUFFC
|
||||
VT *pvtSuper = g_vtstepguard.pvtSuper;
|
||||
CID cid = CID_PUFFC;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xBC0;
|
||||
int cb = 4324;
|
||||
|
||||
void (*pfnInitStepguard)() = nullptr;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -2343,7 +2343,7 @@ struct VTROV
|
||||
VT *pvtSuper = g_vtpo.pvtSuper;
|
||||
CID cid = CID_ROV;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x650;
|
||||
int cb = 2704;
|
||||
|
||||
void (*pfnInitRov)(ROV*) = InitRov;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -2533,7 +2533,7 @@ struct VTVAULT
|
||||
VT *pvtSuper = g_vtpo.pvtSuper;
|
||||
CID cid = CID_VAULT;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x7A0;
|
||||
int cb = 2512;
|
||||
|
||||
void (*pfnInitVault)(VAULT*) = InitVault;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -2628,7 +2628,7 @@ struct VTPUFFER
|
||||
VT *pvtSuper = g_vtpo.pvtSuper;
|
||||
CID cid = CID_PUFFER;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0x660;
|
||||
int cb = 2668;
|
||||
|
||||
void (*pfnInitPuffer)(PUFFER*) = InitPuffer;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -2818,7 +2818,7 @@ struct VTSUV
|
||||
VT *pvtSuper = g_vtpo.pvtSuper;
|
||||
CID cid = CID_SUV;
|
||||
int grfcid = 0xB;
|
||||
int cb = 0xBE0;
|
||||
int cb = 4568;
|
||||
|
||||
void (*pfnInitSuv)(SUV*) = InitSuv;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3282,7 +3282,7 @@ struct VTWATER
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_WATER;
|
||||
int grfcid = 0x83;
|
||||
int cb = 0x6D0;
|
||||
int cb = 2888;
|
||||
|
||||
void (*pfnInitWater)(WATER*) = InitWater;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3366,7 +3366,7 @@ struct VTBRK
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BRK;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x6E0;
|
||||
int cb = 2808;
|
||||
|
||||
void (*pfnInitBrk)(BRK*) = InitBrk;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3451,7 +3451,7 @@ struct VTBREAK
|
||||
VT *pvtSuper = g_vtbrk.pvtSuper;
|
||||
CID cid = CID_BREAK;
|
||||
int grfcid = 0x13;
|
||||
int cb = 0x6E0;
|
||||
int cb = 2816;
|
||||
|
||||
void (*pfnInitBreak)(BREAK*) = InitBreak;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3536,7 +3536,7 @@ struct VTALBRK
|
||||
VT *pvtSuper = g_vtbreak.pvtSuper;
|
||||
CID cid = CID_ALBRK;
|
||||
int grfcid = 0x13;
|
||||
int cb = 0x6F0;
|
||||
int cb = 2816;
|
||||
|
||||
void (*pfnInitBreak)(BREAK*) = InitBreak;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3706,7 +3706,7 @@ struct VTDARTGUN
|
||||
VT *pvtSuper = g_vtbreak.pvtSuper;
|
||||
CID cid = CID_DARTGUN;
|
||||
int grfcid = 0x13;
|
||||
int cb = 0x7E0;
|
||||
int cb = 3136;
|
||||
|
||||
void (*pfnInitDartgun)(DARTGUN*) = InitDartgun;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3791,7 +3791,7 @@ struct VTSWP
|
||||
VT *pvtSuper = g_vtbreak.pvtSuper;
|
||||
CID cid = CID_SWP;
|
||||
int grfcid = 0x13;
|
||||
int cb = 0x710;
|
||||
int cb = 2876;
|
||||
|
||||
void (*pfnInitSwp)(SWP*) = InitSwp;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -3876,7 +3876,7 @@ struct VTFRAGILE
|
||||
VT *pvtSuper = g_vtbrk.pvtSuper;
|
||||
CID cid = CID_FRAGILE;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x6F0;
|
||||
int cb = 2816;
|
||||
|
||||
void (*pfnInitFragile)(FRAGILE*) = InitFragile;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4046,7 +4046,7 @@ struct VTBRKP
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BRKP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2428;
|
||||
|
||||
void (*pfnInitSo)(SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4130,7 +4130,7 @@ struct VTBUTTON
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BUTTON;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x8C0;
|
||||
int cb = 3312;
|
||||
|
||||
void (*pfnInitButton)(BUTTON*) = InitButton;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4214,7 +4214,7 @@ struct VTVOLBTN
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_VOLBTN;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x7D0;
|
||||
int cb = 3200;
|
||||
|
||||
void (*pfnInitVolbtn)(VOLBTN*) = InitVolbtn;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4298,7 +4298,7 @@ struct VTJLOVOL
|
||||
VT *pvtSuper = g_vtvolbtn.pvtSuper;
|
||||
CID cid = CID_JLOVOL;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x7F0;
|
||||
int cb = 3248;
|
||||
|
||||
void (*pfnInitJlovol)(JLOVOL*) = InitJlovol;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4466,7 +4466,7 @@ struct VTBONE
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BONE;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x580;
|
||||
int cb = 2400;
|
||||
|
||||
void (*pfnInitSo)(SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4550,7 +4550,7 @@ struct VTSPRIZE
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_SPRIZE;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5D0;
|
||||
int cb = 2504;
|
||||
|
||||
void (*pfnInitSprize)(SPRIZE*) = InitSprize;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4637,7 +4637,7 @@ struct VTSCPRIZE
|
||||
VT *pvtSuper = g_vtsprize.pvtSuper;
|
||||
CID cid = CID_SCPRIZE;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5E0;
|
||||
int cb = 2512;
|
||||
|
||||
void (*pfnInitScprize)(SCPRIZE*) = InitScprize;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4724,7 +4724,7 @@ struct VTLIFETKN
|
||||
VT *pvtSuper = g_vtscprize.pvtSuper;
|
||||
CID cid = CID_LIFETKN;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5E0;
|
||||
int cb = 2512;
|
||||
|
||||
void (*pfnInitScprize)(SCPRIZE*) = InitScprize;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4811,7 +4811,7 @@ struct VTCLUE
|
||||
VT *pvtSuper = g_vtsprize.pvtSuper;
|
||||
CID cid = CID_CLUE;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5F0;
|
||||
int cb = 2544;
|
||||
|
||||
void (*pfnInitClue)(CLUE*) = InitClue;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4898,7 +4898,7 @@ struct VTALARM
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_ALARM;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x6F0;
|
||||
int cb = 2840;
|
||||
|
||||
void (*pfnInitAlarm)(ALARM*) = InitAlarm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -4982,7 +4982,7 @@ struct VTSENSOR
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_SENSOR;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x600;
|
||||
int cb = 2544;
|
||||
|
||||
void (*pfnInitSensor)(SENSOR*) = InitSensor;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5072,7 +5072,7 @@ struct VTLASEN
|
||||
VT *pvtSuper = g_vtsensor.pvtSuper;
|
||||
CID cid = CID_LASEN;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0xB40;
|
||||
int cb = 4408;
|
||||
|
||||
void (*pfnInitLasen)(LASEN*) = InitLasen;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5162,7 +5162,7 @@ struct VTCAMSEN
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_CAMSEN;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x620;
|
||||
int cb = 2584;
|
||||
|
||||
void (*pfnInitCamsen)(CAMSEN*) = InitCamsen;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5252,7 +5252,7 @@ struct VTPRSEN
|
||||
VT *pvtSuper = g_vtsensor.pvtSuper;
|
||||
CID cid = CID_PRSEN;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x650;
|
||||
int cb = 2624;
|
||||
|
||||
void (*pfnInitPrsen)(PRSEN*) = InitPrsen;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5342,7 +5342,7 @@ struct VTBARRIER
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BARRIER;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5E0;
|
||||
int cb = 2488;
|
||||
|
||||
void (*pfnInitBarrier)(BARRIER*) = InitBarrier;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5426,7 +5426,7 @@ struct VTIKH
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_IKH;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x580;
|
||||
int cb = 2400;
|
||||
|
||||
void (*pfnInitSo)(SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5510,7 +5510,7 @@ struct VTTZP
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_TZP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x890;
|
||||
int cb = 3144;
|
||||
|
||||
void (*pfnInitTzp)(TZP*) = InitTzp;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5594,7 +5594,7 @@ struct VTVOLZP
|
||||
VT *pvtSuper = g_vttzp.pvtSuper;
|
||||
CID cid = CID_VOLZP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x890;
|
||||
int cb = 3144;
|
||||
|
||||
void (*pfnInitVolzp)(VOLZP*) = InitVolzp;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5678,7 +5678,7 @@ struct VTCNVO
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_CNVO;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x590;
|
||||
int cb = 2416;
|
||||
|
||||
void (*pfnInitCnvo)(CNVO*) = InitCnvo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5762,7 +5762,7 @@ struct VTHBSK
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_HBSK;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2432;
|
||||
|
||||
void (*pfnInitHbsk)(HBSK*) = InitHbsk;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5846,7 +5846,7 @@ struct VTBOMB
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_BOMB;
|
||||
int grfcid = 0x23;
|
||||
int cb = 0x670;
|
||||
int cb = 2680;
|
||||
|
||||
void (*pfnInitBomb)(BOMB*) = InitBomb;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -5930,7 +5930,7 @@ struct VTMISSILE
|
||||
VT *pvtSuper = g_vtbomb.pvtSuper;
|
||||
CID cid = CID_MISSILE;
|
||||
int grfcid = 0x23;
|
||||
int cb = 0x6A0;
|
||||
int cb = 2736;
|
||||
|
||||
void (*pfnInitMissile)(MISSILE*) = InitMissile;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6015,7 +6015,7 @@ struct VTACCMISS
|
||||
VT *pvtSuper = g_vtmissile.pvtSuper;
|
||||
CID cid = CID_ACCMISS;
|
||||
int grfcid = 0x23;
|
||||
int cb = 0x6C0;
|
||||
int cb = 2760;
|
||||
|
||||
void (*pfnInitAccmiss)(ACCMISS*) = InitAccmiss;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6100,7 +6100,7 @@ struct VTTARMISS
|
||||
VT *pvtSuper = g_vtaccmiss.pvtSuper;
|
||||
CID cid = CID_TARMISS;
|
||||
int grfcid = 0x23;
|
||||
int cb = 0x6E0;
|
||||
int cb = 2784;
|
||||
|
||||
void (*pfnInitTarmiss)(TARMISS*) = InitTarmiss;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6270,7 +6270,7 @@ struct VTGROUNDMISS
|
||||
VT *pvtSuper = g_vtmissile.pvtSuper;
|
||||
CID cid = CID_GROUNDMISS;
|
||||
int grfcid = 0x23;
|
||||
int cb = 0x6B0;
|
||||
int cb = 2744;
|
||||
|
||||
void (*pfnInitGroundmiss)(GROUNDMISS*) = InitGroundmiss;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6355,7 +6355,7 @@ struct VTFLY
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_FLY;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x6D0;
|
||||
int cb = 2848;
|
||||
|
||||
void (*pfnInitFly)(FLY*) = InitFly;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6439,7 +6439,7 @@ struct VTRAT
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_RAT;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x6A0;
|
||||
int cb = 2824;
|
||||
|
||||
void (*pfnInitRat)(RAT*) = InitRat;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6523,7 +6523,7 @@ struct VTROH
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_ROH;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5F0;
|
||||
int cb = 2552;
|
||||
|
||||
void (*pfnInitRoh)(ROH*) = InitRoh;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6607,7 +6607,7 @@ struct VTROC
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_ROC;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5E0;
|
||||
int cb = 2512;
|
||||
|
||||
void (*pfnInitRoc)(ROC*) = InitRoc;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6691,7 +6691,7 @@ struct VTROST
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_ROST;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2456;
|
||||
|
||||
void (*pfnInitRost)(ROST*) = InitRost;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6775,7 +6775,7 @@ struct VTROP
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_ROP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2448;
|
||||
|
||||
void (*pfnInitRop)(ROP*) = InitRop;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -6859,7 +6859,7 @@ struct VTDART
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_DART;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5C0;
|
||||
int cb = 2496;
|
||||
|
||||
void (*pfnInitDart)(DART*) = InitDart;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7027,7 +7027,7 @@ struct VTUBP
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_UBP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2432;
|
||||
|
||||
void (*pfnInitSo) (SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7111,7 +7111,7 @@ struct VTDSP
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_DSP;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2448;
|
||||
|
||||
void (*pfnInitSo) (SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7195,7 +7195,7 @@ struct VTJLO
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_JLO;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5F0;
|
||||
int cb = 2584;
|
||||
|
||||
void (*pfnInitJlo)(JLO*) = InitJlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7279,7 +7279,7 @@ struct VTPUFFT
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_PUFFT;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x590;
|
||||
int cb = 2420;
|
||||
|
||||
void (*pfnInitSo) (SO*) = InitSo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7363,7 +7363,7 @@ struct VTMRKV
|
||||
VT *pvtSuper = g_vtso.pvtSuper;
|
||||
CID cid = CID_MRKV;
|
||||
int grfcid = 0x3;
|
||||
int cb = 0x5A0;
|
||||
int cb = 2424;
|
||||
|
||||
void (*pfnInitMrkv)(MRKV*) = InitMrkv;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7590,7 +7590,7 @@ struct VTCAMERA
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_CAMERA;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x330;
|
||||
int cb = 1128;
|
||||
|
||||
void (*pfnInitCamera)(CAMERA*) = InitCamera;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7649,7 +7649,7 @@ struct VTLBONE
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_LBONE;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x2E0;
|
||||
int cb = 1064;
|
||||
|
||||
void (*pfnInitAlo)(ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7708,7 +7708,7 @@ struct VTEMITTER
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_EMITTER;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x360;
|
||||
int cb = 1232;
|
||||
|
||||
void (*pfnInitEmitter)(EMITTER*) = InitEmitter;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7767,7 +7767,7 @@ struct VTLIGHT
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_LIGHT;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x630;
|
||||
int cb = 1352;
|
||||
|
||||
void (*pfnInitLight)(LIGHT*) = InitLight;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7826,7 +7826,7 @@ struct VTSCH
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_SCH;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x2E0;
|
||||
int cb = 1064;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7885,7 +7885,7 @@ struct VTLIKH
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_LIKH;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x2E0;
|
||||
int cb = 1064;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -7944,7 +7944,7 @@ struct VTCHKPNT
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_CHKPNT;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1192;
|
||||
|
||||
void (*pfnInitChkpnt)(CHKPNT*) = InitChkpnt;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8003,7 +8003,7 @@ struct VTPROXY
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_PROXY;
|
||||
int grfcid = 0x101;
|
||||
int cb = 0x300;
|
||||
int cb = 1104;
|
||||
|
||||
void (*pfnInitProxy)(PROXY*) = InitProxy;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8062,7 +8062,7 @@ struct VTSKY
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_SKY;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x2F0;
|
||||
int cb = 1068;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8121,7 +8121,7 @@ struct VTDPRIZE
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_DPRIZE;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x3A0;
|
||||
int cb = 1280;
|
||||
|
||||
void (*pfnInitDprize)(DPRIZE*) = InitDprize;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8181,7 +8181,7 @@ struct VTCHARM
|
||||
VT *pvtSuper = g_vtdprize.pvtSuper;
|
||||
CID cid = CID_CHARM;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x3A0;
|
||||
int cb = 1280;
|
||||
|
||||
void (*pfnInitCharm)(CHARM*) = InitCharm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8241,7 +8241,7 @@ struct VTCOIN
|
||||
VT *pvtSuper = g_vtdprize.pvtSuper;
|
||||
CID cid = CID_COIN;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x3B0;
|
||||
int cb = 1296;
|
||||
|
||||
void (*pfnInitCoin)(COIN*) = InitCoin;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8301,7 +8301,7 @@ struct VTKEY
|
||||
VT *pvtSuper = g_vtdprize.pvtSuper;
|
||||
CID cid = CID_KEY;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x3A0;
|
||||
int cb = 1280;
|
||||
|
||||
void (*pfnInitKey)(KEY*) = InitKey;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8361,7 +8361,7 @@ struct VTGOLD
|
||||
VT *pvtSuper = g_vtdprize.pvtSuper;
|
||||
CID cid = CID_GOLD;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x3B0;
|
||||
int cb = 1288;
|
||||
|
||||
void (*pfnInitGold)(GOLD*) = InitGold;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8421,7 +8421,7 @@ struct VTLOCK
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_LOCK;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x2F0;
|
||||
int cb = 1088;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8480,7 +8480,7 @@ struct VTLOCKG
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_LOCKG;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1192;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8539,7 +8539,7 @@ struct VTTAIL
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_TAIL;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1144;
|
||||
|
||||
void (*pfnInitTail)(TAIL*) = InitTail;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8598,7 +8598,7 @@ struct VTROB
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_ROB;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x670;
|
||||
int cb = 1960;
|
||||
|
||||
void (*pfnInitRob)(ROB*) = InitRob;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8657,7 +8657,7 @@ struct VTFLASH
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_FLASH;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x310;
|
||||
int cb = 1120;
|
||||
|
||||
void (*pfnInitFlash)(FLASH*) = InitFlash;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8716,7 +8716,7 @@ struct VTDYSH
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_DYSH;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x300;
|
||||
int cb = 1072;
|
||||
|
||||
void (*pfnInitDysh)(DYSH*) = InitDysh;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8893,7 +8893,7 @@ struct VTTN
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_TN;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x440;
|
||||
int cb = 1440;
|
||||
|
||||
void (*pfnInitTn)(TN*) = InitTn;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -8952,7 +8952,7 @@ struct VTJLOC
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_JLOC;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x350;
|
||||
int cb = 1232;
|
||||
|
||||
void (*pfnInitJloc)(JLOC*) = InitJloc;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9011,7 +9011,7 @@ struct VTDIALOG
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_DIALOG;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1200;
|
||||
|
||||
void (*pfnInitDialog)(DIALOG*) = InitDialog;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9070,7 +9070,7 @@ struct VTSPEAKER
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_SPEAKER;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1136;
|
||||
|
||||
void (*pfnInitSpeaker)(SPEAKER*) = InitSpeaker;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9188,7 +9188,7 @@ struct VTWM
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_WM;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x4B0;
|
||||
int cb = 1216;
|
||||
|
||||
void (*pfnInitAlo)(ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9247,7 +9247,7 @@ struct VTPUFFB
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_PUFFB;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x300;
|
||||
int cb = 1112;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9601,7 +9601,7 @@ struct VTSW
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_SW;
|
||||
int grfcid = 0;
|
||||
int cb = 0x2420;
|
||||
int cb = 17296;
|
||||
|
||||
void (*pfnInitSw)(SW*) = InitSw;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9641,7 +9641,7 @@ struct VTCM
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_CM;
|
||||
int grfcid = 0;
|
||||
int cb = 0x5D0;
|
||||
int cb = 1464;
|
||||
|
||||
void (*pfnInitCm)(CM*) = InitCm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9681,7 +9681,7 @@ struct VTSHAPE
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_SHAPE;
|
||||
int grfcid = 0;
|
||||
int cb = 0x50;
|
||||
int cb = 144;
|
||||
|
||||
void (*pfnInitShape)(SHAPE*) = InitShape;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9721,7 +9721,7 @@ struct VTHSHAPE
|
||||
VT *pvtSuper = g_vtshape.pvtSuper;
|
||||
CID cid = CID_HSHAPE;
|
||||
int grfcid = 0;
|
||||
int cb = 0x70;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitHshape)(HSHAPE*) = InitHshape;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9761,7 +9761,7 @@ struct VTPIPE
|
||||
VT *pvtSuper = g_vtshape.pvtSuper;
|
||||
CID cid = CID_PIPE;
|
||||
int grfcid = 0;
|
||||
int cb = 0x90;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitPipe)(PIPE*) = InitPipe;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9801,7 +9801,7 @@ struct VTRAIL
|
||||
VT *pvtSuper = g_vtshape.pvtSuper;
|
||||
CID cid = CID_RAIL;
|
||||
int grfcid = 0;
|
||||
int cb = 0x68;
|
||||
int cb = 172;
|
||||
|
||||
void (*pfnInitShape)(SHAPE*) = InitShape;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9841,7 +9841,7 @@ struct VTLANDING
|
||||
VT *pvtSuper = g_vtshape.pvtSuper;
|
||||
CID cid = CID_LANDING;
|
||||
int grfcid = 0;
|
||||
int cb = 0x58;
|
||||
int cb = 152;
|
||||
|
||||
void (*pfnInitShape)(SHAPE*) = InitShape;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9881,7 +9881,7 @@ struct VTXFM
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_XFM;
|
||||
int grfcid = 0;
|
||||
int cb = 0x80;
|
||||
int cb = 168;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9921,7 +9921,7 @@ struct VTWARP
|
||||
VT *pvtSuper = g_vtxfm.pvtSuper;
|
||||
CID cid = CID_WARP;
|
||||
int grfcid = 0;
|
||||
int cb = 0x120;
|
||||
int cb = 344;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -9961,7 +9961,7 @@ struct VTTARGET
|
||||
VT *pvtSuper = g_vtxfm.pvtSuper;
|
||||
CID cid = CID_TARGET;
|
||||
int grfcid = 0;
|
||||
int cb = 0xA;
|
||||
int cb = 200;
|
||||
|
||||
void (*pfnInitTarget)(TARGET*) = InitTarget;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10001,7 +10001,7 @@ struct VTHND
|
||||
VT *pvtSuper = g_vttarget.pvtSuper;
|
||||
CID cid = CID_HND;
|
||||
int grfcid = 0;
|
||||
int cb = 0xC0;
|
||||
int cb = 224;
|
||||
|
||||
void (*pfnInitHnd)(HND*) = InitHnd;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10041,7 +10041,7 @@ struct VTEXPL
|
||||
VT *pvtSuper = g_vtxfm.pvtSuper;
|
||||
CID cid = CID_EXPL;
|
||||
int grfcid = 0;
|
||||
int cb = 0x90;
|
||||
int cb = 176;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10082,7 +10082,7 @@ struct VTEXPLG
|
||||
VT *pvtSuper = g_vtexpl.pvtSuper;
|
||||
CID cid = CID_EXPLG;
|
||||
int grfcid = 0;
|
||||
int cb = 0xC0;
|
||||
int cb = 188;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10123,7 +10123,7 @@ struct VTEXPLO
|
||||
VT *pvtSuper = g_vtexpl.pvtSuper;
|
||||
CID cid = CID_EXPLO;
|
||||
int grfcid = 0;
|
||||
int cb = 0xA0;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitExplo)(EXPLO*) = InitExplo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10164,7 +10164,7 @@ struct VTEXPLS
|
||||
VT *pvtSuper = g_vtexplo.pvtSuper;
|
||||
CID cid = CID_EXPLS;
|
||||
int grfcid = 0;
|
||||
int cb = 0xD0;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitExpls)(EXPLS*) = InitExpls;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10205,7 +10205,7 @@ struct VTVOL
|
||||
VT *pvtSuper = g_vtxfm.pvtSuper;
|
||||
CID cid = CID_VOL;
|
||||
int grfcid = 0;
|
||||
int cb = 0x90;
|
||||
int cb = 200;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10245,7 +10245,7 @@ struct VTRATHOLE
|
||||
VT *pvtSuper = g_vtvol.pvtSuper;
|
||||
CID cid = CID_RATHOLE;
|
||||
int grfcid = 0;
|
||||
int cb = 0xA0;
|
||||
int cb = 216;
|
||||
|
||||
void (*pfnInitXfm)(XFM*) = InitXfm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10285,7 +10285,7 @@ struct VTPUFFV
|
||||
VT *pvtSuper = g_vtvol.pvtSuper;
|
||||
CID cid = CID_PUFFV;
|
||||
int grfcid = 0;
|
||||
int cb = 0xD0;
|
||||
int cb = 260;
|
||||
|
||||
void (*pfnInitPuffv)(PUFFV*) = InitPuffv;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10325,7 +10325,7 @@ struct VTEXIT
|
||||
VT *pvtSuper = g_vtalo.pvtSuper;
|
||||
CID cid = CID_EXIT;
|
||||
int grfcid = 0x1;
|
||||
int cb = 0x340;
|
||||
int cb = 1168;
|
||||
|
||||
void (*pfnInitAlo) (ALO*) = InitAlo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10384,7 +10384,7 @@ struct VTPNT
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_PNT;
|
||||
int grfcid = 0;
|
||||
int cb = 0x50;
|
||||
int cb = 136;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10424,7 +10424,7 @@ struct VTPNTSV
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_PNTSV;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 136;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10464,7 +10464,7 @@ struct VTPNTS
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_PNTS;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 136;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10504,7 +10504,7 @@ struct VTPNTVEC
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_PNTVEC;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 136;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10544,7 +10544,7 @@ struct VTHPNT
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_HPNT;
|
||||
int grfcid = 0;
|
||||
int cb = 0x80;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitHpnt)(HPNT*) = InitHpnt;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10584,7 +10584,7 @@ struct VTJMT
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_JMT;
|
||||
int grfcid = 0;
|
||||
int cb = 0x70;
|
||||
int cb = 168;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10624,7 +10624,7 @@ struct VTSPIRE
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_SPIRE;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 152;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10664,7 +10664,7 @@ struct VTSCAN
|
||||
VT *pvtSuper = g_vtpnt.pvtSuper;
|
||||
CID cid = CID_SCAN;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 140;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10704,7 +10704,7 @@ struct VTASEG
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_ASEG;
|
||||
int grfcid = 0x40;
|
||||
int cb = 0xC0;
|
||||
int cb = 288;
|
||||
|
||||
void (*pfnInitAseg)(ASEG*) = InitAseg;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10744,7 +10744,7 @@ struct VTMAP
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_MAP;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 168;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10784,7 +10784,7 @@ struct VT_VISZONE
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID__VISZONE;
|
||||
int grfcid = 0;
|
||||
int cb = 0x40;
|
||||
int cb = 120;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10824,7 +10824,7 @@ struct VTVISMAP
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_VISMAP;
|
||||
int grfcid = 0;
|
||||
int cb = 0x50;
|
||||
int cb = 192;
|
||||
|
||||
void (*pfnInitVismap)(VISMAP*) = InitVismap;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10864,7 +10864,7 @@ struct VTFRZG
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_FRZG;
|
||||
int grfcid = 0;
|
||||
int cb = 0x78;
|
||||
int cb = 184;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -10904,7 +10904,7 @@ struct VTSM
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_SM;
|
||||
int grfcid = 0;
|
||||
int cb = 0x60;
|
||||
int cb = 172;
|
||||
|
||||
void (*pfnInitLo)(LO*) = InitLo;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -11064,7 +11064,7 @@ struct VTRWM
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_RWM;
|
||||
int grfcid = 0;
|
||||
int cb = 0x1D0;
|
||||
int cb = 528;
|
||||
|
||||
void (*pfnInitRwm)(RWM*) = InitRwm;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
@ -11144,7 +11144,7 @@ struct VTKEYHOLE
|
||||
VT *pvtSuper = g_vtlo.pvtSuper;
|
||||
CID cid = CID_KEYHOLE;
|
||||
int grfcid = 0;
|
||||
int cb = 0xB0;
|
||||
int cb = 256;
|
||||
|
||||
void (*pfnInitKeyhole)(KEYHOLE*) = InitKeyhole;
|
||||
void (*pfnSetLoDefaults) (LO*) = SetLoDefaults;
|
||||
|
39
Sly1/bis.cpp
39
Sly1/bis.cpp
@ -1,13 +1,8 @@
|
||||
#include "bis.h"
|
||||
|
||||
CBinaryInputStream::CBinaryInputStream(std::string fileName)
|
||||
CBinaryInputStream::CBinaryInputStream(std::string filePath)
|
||||
{
|
||||
file.open(fileName, std::ios::binary);
|
||||
}
|
||||
|
||||
void CBinaryInputStream::Read(int numBytes, void *pv)
|
||||
{
|
||||
|
||||
file.open(filePath, std::ios::binary);
|
||||
}
|
||||
|
||||
void CBinaryInputStream::Align(int n)
|
||||
@ -99,37 +94,41 @@ glm::mat4 CBinaryInputStream::ReadMatrix4()
|
||||
return glm::mat4(ReadVector4(), ReadVector4(), ReadVector4(), ReadVector4());
|
||||
}
|
||||
|
||||
uint16_t CBinaryInputStream::ReadGeom()
|
||||
void CBinaryInputStream::ReadGeom(GEOM *pgeom)
|
||||
{
|
||||
F32Read();
|
||||
pgeom->sRadius = F32Read();
|
||||
|
||||
uint16_t vertexCount = U16Read();
|
||||
pgeom->cpos = U16Read();
|
||||
pgeom->apos.resize(pgeom->cpos);
|
||||
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
ReadVector();
|
||||
for (int i = 0; i < pgeom->cpos; i++)
|
||||
pgeom->apos[i] = ReadVector();
|
||||
|
||||
uint16_t indexCount = U16Read();
|
||||
pgeom->csurf = U16Read();
|
||||
|
||||
U16Read();
|
||||
pgeom->asurf.resize(pgeom->csurf);
|
||||
pgeom->mpisurfposCenter.resize(pgeom->csurf);
|
||||
pgeom->mpisurfsRadius.resize(pgeom->csurf);
|
||||
|
||||
for (int i = 0; i < indexCount; i++)
|
||||
pgeom->cedge = U16Read();
|
||||
pgeom->aedge.resize(pgeom->cedge);
|
||||
|
||||
for (int i = 0; i < pgeom->csurf; i++)
|
||||
{
|
||||
U16Read();
|
||||
U16Read();
|
||||
U16Read();
|
||||
F32Read();
|
||||
ReadVector();
|
||||
pgeom->mpisurfsRadius[i] = F32Read();
|
||||
pgeom->mpisurfposCenter[i] = ReadVector();
|
||||
byte unk_0 = U8Read();
|
||||
|
||||
for (int i = 0; i < unk_0; i++)
|
||||
for (int a = 0; a < unk_0; a++)
|
||||
{
|
||||
U16Read();
|
||||
U16Read();
|
||||
U16Read();
|
||||
}
|
||||
}
|
||||
|
||||
return vertexCount;
|
||||
}
|
||||
|
||||
void CBinaryInputStream::ReadBspc()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <fstream>
|
||||
#include <glm/glm.hpp>
|
||||
#include "geom.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
@ -11,9 +12,8 @@ class CBinaryInputStream
|
||||
// File Object
|
||||
std::ifstream file;
|
||||
|
||||
CBinaryInputStream(std::string fileName);
|
||||
CBinaryInputStream(std::string filePath);
|
||||
|
||||
void Read(int numBytes, void *pv);
|
||||
// Align bytes to n
|
||||
void Align(int n);
|
||||
// Reads 8 unsigned bytes from file
|
||||
@ -42,7 +42,7 @@ class CBinaryInputStream
|
||||
glm::mat4x2 ReadMatrix4x2();
|
||||
// Reads matrix 4 from file
|
||||
glm::mat4 ReadMatrix4();
|
||||
uint16_t ReadGeom();
|
||||
void ReadGeom(GEOM *pgeom);
|
||||
void ReadBspc();
|
||||
void ReadVbsp(); // GOTTA COME BACK TO THIS
|
||||
// Reads a string from file
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
void InitBlipg(BLIPG* pblipg)
|
||||
{
|
||||
//std::cout << "BLIPG Size: " << sizeof(BLIPG) << "\n";
|
||||
InitAlo(pblipg);
|
||||
}
|
||||
|
||||
void OnBlipgAdd(BLIPG* pblipg)
|
||||
{
|
||||
AppendDlEntry(&pblipg->psw->dlBlipg, pblipg);
|
||||
OnAloAdd(pblipg);
|
||||
}
|
||||
|
||||
|
41
Sly1/blip.h
41
Sly1/blip.h
@ -1,9 +1,48 @@
|
||||
#pragma once
|
||||
#include "alo.h"
|
||||
#include "emitter.h"
|
||||
|
||||
enum BLIPMK
|
||||
{
|
||||
BLIPMK_Nil = -1,
|
||||
BLIPMK_Accel = 0,
|
||||
BLIPMK_Constant = 1,
|
||||
BLIPMK_Spline = 2,
|
||||
BLIPMK_Max = 3
|
||||
};
|
||||
enum BLIPOK
|
||||
{
|
||||
BLIPOK_Nil = -1,
|
||||
BLIPOK_Fixed = 0,
|
||||
BLIPOK_Flying = 1,
|
||||
BLIPOK_Rolling = 2,
|
||||
BLIPOK_Max = 3
|
||||
};
|
||||
|
||||
struct BLIPGM
|
||||
{
|
||||
EMITDV emitdv;
|
||||
};
|
||||
|
||||
class BLIPG : public ALO
|
||||
{
|
||||
public:
|
||||
struct EMITTER* pemitter;
|
||||
CLQ clqScale;
|
||||
CLQ clqAlpha;
|
||||
CLQ clqTexture;
|
||||
CLQ clqColor;
|
||||
BLIPMK blipmk;
|
||||
BLIPGM blipgm;
|
||||
struct SHD* pshd;
|
||||
int cqwTexture;
|
||||
int crgba;
|
||||
RGBA argba[32];
|
||||
int fColorRanges;
|
||||
BLIPOK blipok;
|
||||
float rSFlying;
|
||||
int cblipe;
|
||||
DL dlBlip;
|
||||
DLE dle;
|
||||
};
|
||||
|
||||
void InitBlipg(BLIPG* pblipg);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitBomb(BOMB* pbomb)
|
||||
{
|
||||
//std::cout << "BOMB Size: " << sizeof(BOMB) << "\n";
|
||||
InitSo(pbomb);
|
||||
}
|
||||
|
||||
|
35
Sly1/bomb.h
35
Sly1/bomb.h
@ -1,9 +1,44 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
enum BDT
|
||||
{
|
||||
BDT_Nil = -1,
|
||||
BDT_Impact = 0,
|
||||
BDT_Timed = 1,
|
||||
BDT_PropImpact = 2,
|
||||
BDT_Manual = 3,
|
||||
BDT_Player = 4,
|
||||
BDT_Max = 5
|
||||
};
|
||||
|
||||
class BOMB : public SO
|
||||
{
|
||||
public:
|
||||
BDT bdt;
|
||||
float tDetonate;
|
||||
float sDetonateRadius;
|
||||
float sDetonateRadiusJt;
|
||||
int fTouchDamage;
|
||||
float tDelay;
|
||||
int iDetonationProp;
|
||||
float sdvMax;
|
||||
LM lmMass;
|
||||
float mMax;
|
||||
int cpbrkp;
|
||||
struct BRKP* apbrkp[16];
|
||||
struct EXPL* pexpl;
|
||||
float rExplodeScale;
|
||||
CLQ clqRadiusToSv;
|
||||
LM lmSv;
|
||||
CLQ clqRadiusToSw;
|
||||
LM lmSw;
|
||||
glm::vec3 posDetonate;
|
||||
glm::vec3 normalDetonate;
|
||||
int fExplodeEffects;
|
||||
int fReclaim;
|
||||
ZPK zpk;
|
||||
struct SFX* psfxDet;
|
||||
};
|
||||
|
||||
void InitBomb(BOMB* pbomb);
|
||||
|
70
Sly1/break.h
70
Sly1/break.h
@ -1,9 +1,67 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
enum BRPT
|
||||
{
|
||||
BRPT_Nil = -1,
|
||||
BRPT_Disappear = 0,
|
||||
BRPT_Remain = 1,
|
||||
BRPT_Fixed = 2,
|
||||
BRPT_RemainFixed = 3,
|
||||
BRPT_Appear = 4,
|
||||
BRPT_Max = 5
|
||||
};
|
||||
struct BRP
|
||||
{
|
||||
BRPT brpt;
|
||||
OID oid;
|
||||
struct LO* plo;
|
||||
};
|
||||
enum EXRK
|
||||
{
|
||||
EXRK_Nil = -1,
|
||||
EXRK_Self = 0,
|
||||
EXRK_All = 1,
|
||||
EXRK_Max = 2
|
||||
};
|
||||
enum BRKPS
|
||||
{
|
||||
BRKPS_Nil = -1,
|
||||
BRKPS_Idle = 0,
|
||||
BRKPS_Pending = 1,
|
||||
BRKPS_Fading = 2,
|
||||
BRKPS_Max = 3
|
||||
};
|
||||
|
||||
class BRK : public SO
|
||||
{
|
||||
public:
|
||||
int cbrp;
|
||||
BRP abrp[16];
|
||||
OID oidExplBreak;
|
||||
struct EXPL* pexplBreak;
|
||||
EXRK exrk;
|
||||
float rExplodeScale;
|
||||
float rvAbsorbWhack;
|
||||
LM lmBreakPosToV;
|
||||
float svBreak;
|
||||
float swBreak;
|
||||
OID oidHiPri;
|
||||
int grfbrk;
|
||||
int coidTouch;
|
||||
OID aoidTouch[4];
|
||||
int ccidTouch;
|
||||
CID acidTouch[4];
|
||||
int fBreakOnUpdate;
|
||||
int fRemain;
|
||||
int fBroken;
|
||||
int ichkBroken;
|
||||
int cHitsToBreak;
|
||||
int cHits;
|
||||
int fIgnoreBrkp;
|
||||
int ccoin;
|
||||
glm::vec3 dposCoin;
|
||||
struct SFX* psfxBreak;
|
||||
};
|
||||
|
||||
class BREAK : public BRK
|
||||
@ -14,6 +72,18 @@ class BREAK : public BRK
|
||||
class FRAGILE : public BRK
|
||||
{
|
||||
public:
|
||||
struct SO* psoImpacting;
|
||||
};
|
||||
|
||||
class BRKP : public SO
|
||||
{
|
||||
public:
|
||||
BRKPS brkps;
|
||||
float tBrkps;
|
||||
float dtMaxLifetime;
|
||||
float dtFade;
|
||||
struct BRK* pbrk;
|
||||
int fIgnoreBrkp;
|
||||
};
|
||||
|
||||
void InitBrk(BRK* pbrk);
|
||||
|
@ -8,7 +8,7 @@ void StartupBrx()
|
||||
LO* PloNew(CID cid, SW* psw, ALO* paloParent, OID oid, int isplice)
|
||||
{
|
||||
VTLO *pvtlo = (VTLO*)g_mpcidpvt[cid];
|
||||
|
||||
|
||||
SW *localObject = (SW*)new int[pvtlo->cb]();
|
||||
|
||||
localObject->pvtlo = pvtlo;
|
||||
@ -28,15 +28,11 @@ LO* PloNew(CID cid, SW* psw, ALO* paloParent, OID oid, int isplice)
|
||||
localObject->psw = psw;
|
||||
|
||||
|
||||
// Returning a first parent list
|
||||
DL *adlHashList = PdlFromSwOid(localObject->psw, localObject->oid);
|
||||
|
||||
// Appending object to fist parent list
|
||||
AppendDlEntry(adlHashList, localObject);
|
||||
AppendDlEntry(PdlFromSwOid(localObject->psw, localObject->oid) ,localObject);
|
||||
|
||||
// Initializing local object
|
||||
localObject->pvtlo->pfnInitLo(localObject);
|
||||
|
||||
return (LO*)localObject;
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
void InitButton(BUTTON* pbutton)
|
||||
{
|
||||
//std::cout << "BUTTON Size: " << sizeof(BUTTON) << "\n";
|
||||
InitSo(pbutton);
|
||||
}
|
||||
|
||||
void InitVolbtn(VOLBTN* pvolbtn)
|
||||
{
|
||||
//std::cout << "VOLBTN Size: " << sizeof(VOLBTN) << "\n";
|
||||
InitSo(pvolbtn);
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,91 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
enum BTNT
|
||||
{
|
||||
BTNT_Nil = -1,
|
||||
BTNT_Push = 0,
|
||||
BTNT_Lever = 1,
|
||||
BTNT_Contact = 2,
|
||||
BTNT_Whack = 3,
|
||||
BTNT_Hang = 4,
|
||||
BTNT_Max = 5
|
||||
};
|
||||
struct ASH
|
||||
{
|
||||
int coid;
|
||||
OID aoid[16];
|
||||
int cpaseg;
|
||||
struct ASEG* apaseg[16];
|
||||
};
|
||||
enum BUTTONS
|
||||
{
|
||||
BUTTONS_Nil = -1,
|
||||
BUTTONS_NoContact = 0,
|
||||
BUTTONS_Contact = 1,
|
||||
BUTTONS_Pushed = 2,
|
||||
BUTTONS_Disabled = 3,
|
||||
BUTTONS_Reset = 4,
|
||||
BUTTONS_Max = 5
|
||||
};
|
||||
|
||||
struct BTN
|
||||
{
|
||||
struct VTBTN* pvtbtn;
|
||||
struct ALO* paloOwner;
|
||||
ASH aash[2];
|
||||
float svtAnimation;
|
||||
int fCheckpointed;
|
||||
int ichkPushed;
|
||||
float tButtons;
|
||||
float dtRepush;
|
||||
BUTTONS buttons;
|
||||
int fEnabled;
|
||||
int fSilent;
|
||||
int fReapplyAseg;
|
||||
int fManualReset;
|
||||
OID oidDialog;
|
||||
struct DIALOG* pdialog;
|
||||
int crsmg;
|
||||
RSMG arsmg[8];
|
||||
};
|
||||
|
||||
class BUTTON : public SO
|
||||
{
|
||||
public:
|
||||
BTNT btnt;
|
||||
BTN btn;
|
||||
int coidPush;
|
||||
OID aoidPush[8];
|
||||
int coidNoPush;
|
||||
OID aoidNoPush[8];
|
||||
int ccidPush;
|
||||
CID acidPush[8];
|
||||
int ccidNoPush;
|
||||
CID acidNoPush[8];
|
||||
int istopClosestCur;
|
||||
int cposStop;
|
||||
glm::vec3 aposStop[2];
|
||||
int cmatStop;
|
||||
glm::mat3 amatStop[2];
|
||||
glm::vec3 posLever;
|
||||
glm::vec3 anormLimits[2];
|
||||
struct HND* phndSwitchHook;
|
||||
};
|
||||
|
||||
class VOLBTN : public SO
|
||||
{
|
||||
public:
|
||||
int coidPush;
|
||||
OID aoidPush[8];
|
||||
int cploPush;
|
||||
struct LO* aploPush[8];
|
||||
int cploPushWithin;
|
||||
struct LO* aploPushWithin[8];
|
||||
int fPpoPush;
|
||||
BTN btn;
|
||||
int fMustExit;
|
||||
int fSendChangeEvents;
|
||||
};
|
||||
|
||||
void InitButton(BUTTON* pbutton);
|
||||
|
@ -2,5 +2,6 @@
|
||||
|
||||
void InitCan(CAN* pcan)
|
||||
{
|
||||
std::cout << "CAN Size: " << sizeof(CAN) << "\n";
|
||||
InitBreak(pcan);
|
||||
}
|
||||
|
31
Sly1/can.h
31
Sly1/can.h
@ -1,9 +1,40 @@
|
||||
#pragma once
|
||||
#include "break.h"
|
||||
|
||||
enum CANS
|
||||
{
|
||||
CANS_Nil = -1,
|
||||
CANS_Auto = 0,
|
||||
CANS_Manual = 1,
|
||||
CANS_Passive = 2,
|
||||
CANS_Max = 3
|
||||
};
|
||||
|
||||
class CAN : public BREAK
|
||||
{
|
||||
public:
|
||||
CANS cans;
|
||||
struct RWM* prwm;
|
||||
struct SO* psoTurret;
|
||||
int fLeadTarget;
|
||||
LM lmRange;
|
||||
LM lmActivate;
|
||||
LM lmDeactivate;
|
||||
float radPanMax;
|
||||
float dradFireThreshold;
|
||||
float dtFireInterval;
|
||||
float tLastFire;
|
||||
float dzAim;
|
||||
float swTumble;
|
||||
SMP smpTracking;
|
||||
int fFireEnabled;
|
||||
int cuFireAccuracy;
|
||||
float auFireAccuracy[5];
|
||||
glm::vec3 posTarget;
|
||||
struct PNT* ppntMuzzle;
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
int cFired;
|
||||
};
|
||||
|
||||
void InitCan(CAN *pcan);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitChkpnt(CHKPNT* pchkpnt)
|
||||
{
|
||||
//std::cout << "VOL Size: " << sizeof(VOL) << "\n";
|
||||
InitAlo(pchkpnt);
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,26 @@ void LoadTbspFromBrx(CBinaryInputStream* pbis);
|
||||
class CHKPNT : public ALO
|
||||
{
|
||||
public:
|
||||
int coidAseg;
|
||||
OID aoidAseg[4];
|
||||
int cpaseg;
|
||||
struct ASEG* apaseg[4];
|
||||
int coidVol;
|
||||
OID aoidVol[4];
|
||||
int cpvol;
|
||||
struct VOL* apvol[4];
|
||||
OID oidWarp;
|
||||
int ichkTriggered;
|
||||
int ibitChkpnt;
|
||||
};
|
||||
|
||||
class VOL : public XFM
|
||||
{
|
||||
public:
|
||||
int ctsurf;
|
||||
struct TSURF* atsurf;
|
||||
int ctbsp;
|
||||
struct TBSP* atbsp;
|
||||
};
|
||||
|
||||
void InitChkpnt(CHKPNT* pchkpnt);
|
||||
|
@ -2,9 +2,10 @@
|
||||
|
||||
void InitCm(CM* pcm)
|
||||
{
|
||||
InitLo((LO*)pcm);
|
||||
//std::cout << "CM Size: " << sizeof(CM) << "\n";
|
||||
InitLo(pcm);
|
||||
|
||||
pcm->radFOV = 1.0;
|
||||
pcm->radFOV = 45.0;
|
||||
pcm->rAspect = 1.298701;
|
||||
pcm->sNearClip = 100.0;
|
||||
pcm->sFarClip = 20000.0;
|
||||
@ -12,4 +13,4 @@ void InitCm(CM* pcm)
|
||||
pcm->sFarFog = 20000.0;
|
||||
pcm->uFogMax = 0.5;
|
||||
pcm->rMRD = 1.0;
|
||||
}
|
||||
}
|
||||
|
213
Sly1/cm.h
213
Sly1/cm.h
@ -1,29 +1,204 @@
|
||||
#pragma once
|
||||
#include "lo.h"
|
||||
|
||||
enum CPMT
|
||||
{
|
||||
CPMT_Truck = 0,
|
||||
CPMT_Pan = 1,
|
||||
CPMT_Slide = 2,
|
||||
CPMT_Orbit = 3,
|
||||
CPMT_Align = 4,
|
||||
CPMT_Walkthrough = 5,
|
||||
CPMT_Max = 6
|
||||
};
|
||||
enum CPP
|
||||
{
|
||||
CPP_Nil = -1,
|
||||
CPP_Base = 0,
|
||||
CPP_Default = 1,
|
||||
CPP_Tunnel_Pri0 = 2,
|
||||
CPP_Tunnel_Pri1 = 3,
|
||||
CPP_Tunnel_Pri2 = 4,
|
||||
CPP_Tunnel_Pri3 = 5,
|
||||
CPP_LookAround = 6,
|
||||
CPP_Animated = 7,
|
||||
CPP_ManualOverride = 8,
|
||||
CPP_UserTestWalkthrough = 9,
|
||||
CPP_Max = 10
|
||||
};
|
||||
enum LOOKK
|
||||
{
|
||||
LOOKK_Nil = -1,
|
||||
LOOKK_User = 0,
|
||||
LOOKK_Sniper = 1,
|
||||
LOOKK_Dialog = 2,
|
||||
LOOKK_Confront = 3,
|
||||
LOOKK_Max = 4
|
||||
};
|
||||
enum FTND
|
||||
{
|
||||
FTND_Nil = -1,
|
||||
FTND_Forward = 1,
|
||||
FTND_Reverse = 2,
|
||||
FTND_Manual = 4,
|
||||
FTND_Max = 5
|
||||
};
|
||||
struct FGFN
|
||||
{
|
||||
float duFogBias;
|
||||
float ruFog;
|
||||
float sNearFog;
|
||||
float duFogPlusClipBias;
|
||||
};
|
||||
struct CPDEFI
|
||||
{
|
||||
int grfcpd;
|
||||
glm::vec3 posBase;
|
||||
glm::vec3 vBase;
|
||||
float radHome;
|
||||
float sAdjust;
|
||||
float tMoveLast;
|
||||
CFK cfk;
|
||||
glm::vec3 posAdjust;
|
||||
};
|
||||
struct CPR
|
||||
{
|
||||
CPP cpp;
|
||||
struct CPLCY* pcplcy;
|
||||
struct SO* psoFocus;
|
||||
void* pv;
|
||||
};
|
||||
struct CPLCY
|
||||
{
|
||||
union
|
||||
{
|
||||
struct VTCPLCY* pvtcplcy;
|
||||
struct VTCPMAN* pvtcpman;
|
||||
struct VTCPLOOK* pvtcplook;
|
||||
struct VTCPALIGN* pvtcpalign;
|
||||
struct VTCPASEG* pvtcpaseg;
|
||||
struct VTCPTN* pvtcptn;
|
||||
};
|
||||
struct CM* pcm;
|
||||
};
|
||||
struct CPMAN : public CPLCY
|
||||
{
|
||||
CPMT cpmt;
|
||||
struct ALO* paloOrbit;
|
||||
int cframeStatus;
|
||||
};
|
||||
struct CPLOOK : public CPLCY
|
||||
{
|
||||
float radPan;
|
||||
float swPan;
|
||||
float radTilt;
|
||||
float swTilt;
|
||||
float uZoom;
|
||||
float svuZoom;
|
||||
float rZoomMax;
|
||||
LM lmFOV;
|
||||
LOOKK alookk[4];
|
||||
int clookk;
|
||||
int fSoundPaused;
|
||||
struct AMB* pambBinoc;
|
||||
struct AMB* pambAmbient;
|
||||
struct ALO* paloFocusSniper;
|
||||
float rScreenSniper;
|
||||
float sRadiusSniper;
|
||||
struct PNT* ppntAnchor;
|
||||
};
|
||||
struct CPALIGN : public CPLCY
|
||||
{
|
||||
glm::vec3 posLocal;
|
||||
glm::mat3 matLocal;
|
||||
};
|
||||
struct CPASEG : public CPLCY
|
||||
{
|
||||
struct CAMERA* pcamera;
|
||||
};
|
||||
struct CPTN : public CPLCY
|
||||
{
|
||||
struct TN* ptn;
|
||||
float radManual;
|
||||
float xyManual;
|
||||
float zManual;
|
||||
int fHome;
|
||||
float radHome;
|
||||
FTND ftnd;
|
||||
int fActivate;
|
||||
int fPanOnEntryDone;
|
||||
float swOrbit;
|
||||
float tLastOrbit;
|
||||
float radCur;
|
||||
float radFwdPrev;
|
||||
float radRevPrev;
|
||||
float tMoveLast;
|
||||
float uFollowCur;
|
||||
float vxy;
|
||||
float vz;
|
||||
glm::vec3 posEyePrev;
|
||||
};
|
||||
// Camera Object
|
||||
class CM : public LO
|
||||
{
|
||||
public:
|
||||
glm::vec3 pos;
|
||||
glm::vec4 anormalFrustrumTranspose;
|
||||
glm::mat3 mat;
|
||||
float rMRDAdjust;
|
||||
glm::mat4 matProj;
|
||||
glm::mat4 matWorldToClip;
|
||||
glm::mat4 matClipToWorld;
|
||||
glm::vec4 anormalFrustrum;
|
||||
float rMRD;
|
||||
float radFOV;
|
||||
float rAspect;
|
||||
float sNearClip;
|
||||
float sFarClip;
|
||||
float sRadiusNearClip;
|
||||
float xScreenRange;
|
||||
float yScreenRange;
|
||||
float sNearFog;
|
||||
float sFarFog;
|
||||
float uFogMax;
|
||||
glm::mat4 matProj;
|
||||
glm::mat4 matWorldToClip;
|
||||
glm::mat4 matClipToWorld;
|
||||
glm::vec3 anormalFrustrum[4];
|
||||
float rMRD;
|
||||
float radFOV;
|
||||
float rAspect;
|
||||
float sNearClip;
|
||||
float sFarClip;
|
||||
float sRadiusNearClip;
|
||||
float xScreenRange;
|
||||
float yScreenRange;
|
||||
float sNearFog;
|
||||
float sFarFog;
|
||||
float uFogMax;
|
||||
RGBA rgbaFog;
|
||||
FGFN fgfn;
|
||||
float tJolt;
|
||||
int grfzon;
|
||||
int fCutNext;
|
||||
int fCut;
|
||||
int fRadCut;
|
||||
float radCut;
|
||||
int fDisplaced;
|
||||
float uPanProgress;
|
||||
float uTiltProgress;
|
||||
float uSProgress;
|
||||
glm::vec3 dposCenter;
|
||||
glm::vec3 vCenter;
|
||||
glm::vec3 dposAdjust;
|
||||
glm::vec3 vAdjust;
|
||||
glm::vec3 dposFocus;
|
||||
glm::vec3 vFocus;
|
||||
glm::vec3 posScreen;
|
||||
glm::vec3 vScreen;
|
||||
float swPanPos;
|
||||
float swTiltPos;
|
||||
float sv;
|
||||
float swPanMat;
|
||||
float swTiltMat;
|
||||
glm::vec3 posCenterPrev;
|
||||
glm::vec3 posClear;
|
||||
glm::mat3 matClear;
|
||||
struct SO* psoFocusPrev;
|
||||
CPDEFI cpdefiPrev;
|
||||
int cpaloFade;
|
||||
struct ALO* apaloFade[8];
|
||||
float tActivateCplcy;
|
||||
glm::mat3 matRotateToCam;
|
||||
glm::mat3 matRotateTiltToCam;
|
||||
int ccpr;
|
||||
CPR acpr[8];
|
||||
CPMAN cpman;
|
||||
CPLOOK cplook;
|
||||
CPALIGN cpalign;
|
||||
CPASEG cpaseg;
|
||||
CPTN cptn;
|
||||
};
|
||||
|
||||
// Initialize camera object
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitCnvo(CNVO* pcnvo)
|
||||
{
|
||||
//std::cout << "CNVO Size: " << sizeof(CNVO) << "\n";
|
||||
InitSo(pcnvo);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,9 @@
|
||||
class CNVO : public SO
|
||||
{
|
||||
public:
|
||||
float svBelt;
|
||||
float svuAvg;
|
||||
float svvAvg;
|
||||
};
|
||||
|
||||
void InitCnvo(CNVO* pcnvo);
|
||||
|
@ -6,6 +6,7 @@ void InitDprize(DPRIZE *pdprize)
|
||||
pdprize->dprizes = DPRIZES_Nil;
|
||||
pdprize->svcAttract = 30.0;
|
||||
pdprize->oidInitialState = OID_Nil;
|
||||
//std::cout << "DPRIZE SIZE: " << sizeof(DPRIZE) << "\n";
|
||||
InitAlo(pdprize);
|
||||
AppendDlEntry(&pdprize->psw->dlDprize, pdprize);
|
||||
|
||||
@ -13,22 +14,27 @@ void InitDprize(DPRIZE *pdprize)
|
||||
|
||||
void InitCharm(CHARM* pcharm)
|
||||
{
|
||||
//std::cout << "CHARM Size: " << sizeof(CHARM) << "\n";
|
||||
InitDprize(pcharm);
|
||||
}
|
||||
|
||||
void InitCoin(COIN* pcoin)
|
||||
{
|
||||
//std::cout << "COIN Size: " << sizeof(COIN) << "\n";
|
||||
InitDprize(pcoin);
|
||||
}
|
||||
|
||||
void InitKey(KEY* pkey)
|
||||
{
|
||||
//std::cout << "KEY Size: " << sizeof(KEY) << "\n";
|
||||
InitDprize(pkey);
|
||||
}
|
||||
|
||||
void InitGold(GOLD* pgold)
|
||||
{
|
||||
//std::cout << "GOLD Size: " << sizeof(GOLD) << "\n";
|
||||
InitDprize(pgold);
|
||||
pgold->psw->cgoldAll++;
|
||||
}
|
||||
|
||||
void LoadDprizeFromBrx(DPRIZE *pdprize, CBinaryInputStream *pbis)
|
||||
|
10
Sly1/coin.h
10
Sly1/coin.h
@ -22,10 +22,15 @@ class DPRIZE : public ALO
|
||||
DPRIZES dprizesInit;
|
||||
OID oidInitialState;
|
||||
float dtInitialSkip;
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
struct TARGET* ptarget;
|
||||
glm::vec3 posCenter;
|
||||
glm::vec3 vCenter;
|
||||
glm::vec3 dvCenter;
|
||||
float uGlintChance;
|
||||
struct PNT* ppntFrontGlint;
|
||||
struct PNT* ppntBackGlint;
|
||||
int fLeft;
|
||||
float tGlint;
|
||||
int fNeverReuse;
|
||||
@ -42,6 +47,8 @@ class DPRIZE : public ALO
|
||||
int fSwirlDone;
|
||||
DLE dle;
|
||||
int ichkCollected;
|
||||
struct EXPL* pexplCollect;
|
||||
struct EXPL* pexplAttract;
|
||||
float svcAttract;
|
||||
float cAttract;
|
||||
};
|
||||
@ -54,6 +61,8 @@ class CHARM : public DPRIZE
|
||||
class COIN : public DPRIZE
|
||||
{
|
||||
public:
|
||||
LM lmDtMaxLifetime;
|
||||
float tLose;
|
||||
};
|
||||
|
||||
class KEY : public DPRIZE
|
||||
@ -64,6 +73,7 @@ class KEY : public DPRIZE
|
||||
class GOLD : public DPRIZE
|
||||
{
|
||||
public:
|
||||
int fStartTimedChallenge;
|
||||
};
|
||||
|
||||
void InitDprize(DPRIZE *pdprize);//NOT FINISHED
|
||||
|
@ -2,12 +2,15 @@
|
||||
|
||||
void InitCrfodb(CRFODB* pcrfodb)
|
||||
{
|
||||
std::cout << "CRFODB Size: " << sizeof(CRFODB) << "\n";
|
||||
std::cout << "CRBRAIN Size: " << sizeof(CRBRAIN) << "\n";
|
||||
InitStepGuard(pcrfodb);
|
||||
}
|
||||
|
||||
void OnCrfodAdd(CRFOD* pcrfod)
|
||||
{
|
||||
OnStepguardAdd(pcrfod);
|
||||
AppendDlEntry(&pcrfod->psw->dlCrfod, pcrfod);
|
||||
}
|
||||
|
||||
void InitCrbrain(CRBRAIN* pcrbrain)
|
||||
|
@ -3,17 +3,22 @@
|
||||
|
||||
class CRFOD : public STEPGUARD
|
||||
{
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
class CRFODB :public CRFOD
|
||||
{
|
||||
|
||||
public:
|
||||
int fDetectLatch;
|
||||
int cpoint;
|
||||
};
|
||||
|
||||
class CRBRAIN : public ALO
|
||||
{
|
||||
|
||||
public:
|
||||
int cpoint;
|
||||
int cpointMax;
|
||||
float tContest;
|
||||
};
|
||||
|
||||
void InitCrfodb(CRFODB *pcrfodb);
|
||||
|
20
Sly1/crv.h
20
Sly1/crv.h
@ -11,13 +11,19 @@ enum CRVK {
|
||||
|
||||
struct CRV
|
||||
{
|
||||
public:
|
||||
CRVK crvk;
|
||||
int fClosed;
|
||||
int ccv;
|
||||
float *mpicvu;
|
||||
float *mpicvs;
|
||||
glm::vec3 mpicvpos;
|
||||
union
|
||||
{
|
||||
struct VTCRV* pvtcrv;
|
||||
struct VTCRVL* pvtcrvl;
|
||||
struct VTCRVC* pvtcrvc;
|
||||
};
|
||||
|
||||
CRVK crvk;
|
||||
int fClosed;
|
||||
int ccv;
|
||||
float *mpicvu;
|
||||
float *mpicvs;
|
||||
glm::vec3 mpicvpos;
|
||||
};
|
||||
|
||||
struct CRVL : public CRV
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitCycle(CYCLE* pcycle)
|
||||
{
|
||||
std::cout << "CYCLE Size: " << sizeof(CYCLE) << "\n";
|
||||
InitPo(pcycle);
|
||||
}
|
||||
|
||||
|
44
Sly1/cycle.h
44
Sly1/cycle.h
@ -1,9 +1,53 @@
|
||||
#pragma once
|
||||
#include "po.h"
|
||||
|
||||
struct SXP
|
||||
{
|
||||
struct ALO* paloWheel;
|
||||
struct ALO* paloHub;
|
||||
struct PNT* ppntTop;
|
||||
int xsxp;
|
||||
glm::vec3 posCur;
|
||||
glm::vec3 posGround;
|
||||
glm::vec3 normalGround;
|
||||
glm::vec3 vGround;
|
||||
float swSpin;
|
||||
float radSpin;
|
||||
float cParticleDirt;
|
||||
float cParticleDust;
|
||||
};
|
||||
enum CYCLES
|
||||
{
|
||||
CYCLES_Nil = -1,
|
||||
CYCLES_Brake = 0,
|
||||
CYCLES_Accelerate = 1,
|
||||
CYCLES_Coast = 2,
|
||||
CYCLES_Max = 3
|
||||
};
|
||||
|
||||
class CYCLE : public PO
|
||||
{
|
||||
public:
|
||||
float sRadiusFrontWheel;
|
||||
float sRadiusRearWheel;
|
||||
float svMax;
|
||||
float radTarget;
|
||||
float svTarget;
|
||||
float radFront;
|
||||
float radBankTarget;
|
||||
int xsxp;
|
||||
SXP asxp[2];
|
||||
struct EXPL* pexplBoost;
|
||||
struct EXPL* pexplDirt;
|
||||
struct EXPL* pexplDust;
|
||||
float cParticleBoost;
|
||||
float cParticleDirt;
|
||||
float cParticleDust;
|
||||
float tBoost;
|
||||
int cBoost;
|
||||
float tGround;
|
||||
CYCLES cycles;
|
||||
float tCycles;
|
||||
};
|
||||
|
||||
void InitCycle(CYCLE *pcycle);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitDart(DART* pdart)
|
||||
{
|
||||
//std::cout << "DART Size: " << sizeof(DART) << "\n";
|
||||
InitSo(pdart);
|
||||
}
|
||||
|
||||
@ -13,4 +14,4 @@ void OnDartAdd(DART* pdart)
|
||||
void LoadDartFromBrx(DART* pdart, CBinaryInputStream* pbis)
|
||||
{
|
||||
LoadSoFromBrx(pdart, pbis);
|
||||
}
|
||||
}
|
27
Sly1/dart.h
27
Sly1/dart.h
@ -1,9 +1,36 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
enum DARTS
|
||||
{
|
||||
DARTS_Nil = -1,
|
||||
DARTS_AvailToFire = 0,
|
||||
DARTS_ReadyToFire = 1,
|
||||
DARTS_Airborne = 2,
|
||||
DARTS_Sticking = 3,
|
||||
DARTS_Stuck = 4,
|
||||
DARTS_Fading = 5,
|
||||
DARTS_Max = 6
|
||||
};
|
||||
|
||||
class DART : public SO
|
||||
{
|
||||
public:
|
||||
DARTS darts;
|
||||
float tDarts;
|
||||
float svDart;
|
||||
float sRadiusFireCloud;
|
||||
float sRadiusStrikeCloud;
|
||||
float dtFade;
|
||||
float dtMaxStuck;
|
||||
DLE dleDartFree;
|
||||
struct ASEG* pasegSticking;
|
||||
struct ASEGA* pasegaSticking;
|
||||
struct ALO* paloTarget;
|
||||
float dtLaunchToTarget;
|
||||
float dzTarget;
|
||||
struct DARTGUN* pdartgunFiredFrom;
|
||||
struct EXPL* pexpl;
|
||||
};
|
||||
|
||||
void InitDart(DART* pdart);
|
||||
|
@ -2,5 +2,6 @@
|
||||
|
||||
void InitDartgun(DARTGUN* pdartgun)
|
||||
{
|
||||
//std::cout << "DARTGUN Size: " << sizeof(DARTGUN) << "\n";
|
||||
InitBreak(pdartgun);
|
||||
}
|
||||
|
@ -4,6 +4,29 @@
|
||||
class DARTGUN : public BREAK
|
||||
{
|
||||
public:
|
||||
OID oidDart;
|
||||
int cDarts;
|
||||
struct DART* pdartReadyToFire;
|
||||
struct DART* pdartFading;
|
||||
float dtFireInterval;
|
||||
float dzTarget;
|
||||
float tLastFire;
|
||||
struct ALO* paloTarget;
|
||||
struct RAT* pratTarget;
|
||||
glm::vec3 posOrigDart;
|
||||
glm::mat3 matOrigDart;
|
||||
struct ALO* paloOrigDartParent;
|
||||
struct ALO* paloLookAt;
|
||||
struct ALO* paloLid;
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
int coidRatTarget;
|
||||
OID aoidRatTarget[8];
|
||||
int cpratTarget;
|
||||
struct RAT* apratTarget[8];
|
||||
int cpratInTargetArea;
|
||||
struct RAT* apratInTargetArea[8];
|
||||
int fJtInTargetArea;
|
||||
};
|
||||
|
||||
void InitDartgun(DARTGUN* pdartgun);
|
30
Sly1/debug.cpp
Normal file
30
Sly1/debug.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "debug.h"
|
||||
|
||||
void RenderOpenFileGui()
|
||||
{
|
||||
ImGui::Begin("ProjectCane");
|
||||
|
||||
// open Dialog Simple
|
||||
ImGuiFileDialog instance_a;
|
||||
|
||||
if (ImGui::Button("Open File"))
|
||||
instance_a.Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".brx", ".");
|
||||
|
||||
// display
|
||||
if (instance_a.Instance()->Display("ChooseFileDlgKey"))
|
||||
{
|
||||
// action if OK
|
||||
if (instance_a.Instance()->IsOk())
|
||||
{
|
||||
file = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||
/*std::cout << file << "\n";
|
||||
std::cout << filePath << "\n";*/
|
||||
g_transition.m_fPending = 1;
|
||||
// action
|
||||
}
|
||||
|
||||
// close
|
||||
instance_a.Instance()->Close();
|
||||
}
|
||||
}
|
10
Sly1/debug.h
Normal file
10
Sly1/debug.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_glfw.h"
|
||||
#include "imgui_impl_opengl3.h"
|
||||
#include "ImGuiFileDialog.h"
|
||||
#include "transition.h"
|
||||
|
||||
extern std::string file;
|
||||
|
||||
void RenderOpenFileGui();
|
@ -6,7 +6,6 @@ class CM;
|
||||
struct RO;
|
||||
extern bool loadEmitMesh;
|
||||
|
||||
|
||||
// Local Obeject
|
||||
class LO;
|
||||
enum MSGID;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitDialog(DIALOG* pdialog)
|
||||
{
|
||||
//std::cout << "DIALOG Size: " << sizeof(DIALOG) << "\n";
|
||||
InitAlo(pdialog);
|
||||
}
|
||||
|
||||
@ -9,7 +10,6 @@ void LoadDialogFromBrx(DIALOG* pdialog, CBinaryInputStream* pbis)
|
||||
{
|
||||
LoadAloFromBrx(pdialog, pbis);
|
||||
LoadDialogEventsFromBrx(pbis);
|
||||
//std::cout << std::hex << pbis->file.tellg();
|
||||
}
|
||||
|
||||
void LoadDialogEventsFromBrx(CBinaryInputStream* pbis)
|
||||
|
@ -1,9 +1,73 @@
|
||||
#pragma once
|
||||
#include "alo.h"
|
||||
|
||||
enum DIALOGK
|
||||
{
|
||||
DIALOGK_Nil = -1,
|
||||
DIALOGK_Binoc = 0,
|
||||
DIALOGK_Instruct = 1,
|
||||
DIALOGK_Confront = 2,
|
||||
DIALOGK_Max = 3
|
||||
};
|
||||
enum DIALOGS
|
||||
{
|
||||
DIALOGS_Nil = -1,
|
||||
DIALOGS_Enabled = 0,
|
||||
DIALOGS_Triggered = 1,
|
||||
DIALOGS_Disabled = 2,
|
||||
DIALOGS_Playing = 3,
|
||||
DIALOGS_Calling = 4,
|
||||
DIALOGS_UnableToCall = 5,
|
||||
DIALOGS_Max = 6
|
||||
};
|
||||
enum DPK
|
||||
{
|
||||
DPK_Nil = -1,
|
||||
DPK_None = 0,
|
||||
DPK_X = 1,
|
||||
DPK_Square = 2,
|
||||
DPK_Circle = 3,
|
||||
DPK_Triangle = 4,
|
||||
DPK_L1 = 5,
|
||||
DPK_L2 = 6,
|
||||
DPK_R1 = 7,
|
||||
DPK_R2 = 8,
|
||||
DPK_JoyLeft = 9,
|
||||
DPK_JoyRight = 10,
|
||||
DPK_JoyLeftX = 11,
|
||||
DPK_JoyLeftY = 12,
|
||||
DPK_DoubleJump = 13,
|
||||
DPK_VaultOpen = 14,
|
||||
DPK_Max = 15
|
||||
};
|
||||
|
||||
struct DP
|
||||
{
|
||||
uint32_t grfdp;
|
||||
DPK dpk;
|
||||
struct SPEAKER* pspeakerLeft;
|
||||
struct SPEAKER* pspeakerRight;
|
||||
struct ASEGA* pasegaLipsync;
|
||||
float tPauseMin;
|
||||
};
|
||||
|
||||
class DIALOG : public ALO
|
||||
{
|
||||
public:
|
||||
DIALOGK dialogk;
|
||||
DIALOGS dialogs;
|
||||
float tDialogs;
|
||||
int cde;
|
||||
struct DE* ade;
|
||||
int ideCur;
|
||||
DP dp;
|
||||
OID oidPntAnchor;
|
||||
int* pfPlayed;
|
||||
int fPlayed;
|
||||
int cpfEquivalence;
|
||||
int* apfEquivalence[4];
|
||||
int fDefault;
|
||||
int fCrucial;
|
||||
};
|
||||
|
||||
void InitDialog(DIALOG* pdialog);
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
|
||||
// Data List
|
||||
// Stores ptr to first entry in list and ptr to last entry in list
|
||||
struct DL
|
||||
{
|
||||
@ -25,6 +27,7 @@ struct DL
|
||||
uint64_t ibDle;
|
||||
};
|
||||
|
||||
// Data List Element
|
||||
// DLE stores the next and previous ptr to data
|
||||
// Linked list data structure
|
||||
// Entry is just another word for linked list
|
||||
|
1
Sly1/dsp.cpp
Normal file
1
Sly1/dsp.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "dsp.h"
|
15
Sly1/dsp.h
Normal file
15
Sly1/dsp.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
class DSP : public SO
|
||||
{
|
||||
public:
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
OID oidDispense;
|
||||
int cpso;
|
||||
struct SO** apso;
|
||||
struct SO* psoCur;
|
||||
struct TARGET* ptargetCur;
|
||||
};
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitDysh(DYSH* pdysh)
|
||||
{
|
||||
//std::cout << "DYSH Size: " << sizeof(DYSH) << "\n";
|
||||
InitAlo(pdysh);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
class DYSH : public ALO
|
||||
{
|
||||
public:
|
||||
struct SHADOW* pshadowGen;
|
||||
};
|
||||
|
||||
void InitDysh(DYSH* pdysh);
|
||||
|
@ -2,16 +2,19 @@
|
||||
|
||||
void InitExplo(EXPLO* pexplo)
|
||||
{
|
||||
//std::cout << "EXPLO Size: " << sizeof(EXPLO) << "\n";
|
||||
InitXfm(pexplo);
|
||||
}
|
||||
|
||||
void InitEmitter(EMITTER* pemitter)
|
||||
{
|
||||
//std::cout << "EMITTER Size: " << sizeof(EMITTER) << "\n";
|
||||
InitAlo(pemitter);
|
||||
}
|
||||
|
||||
void InitExpls(EXPLS* pexpls)
|
||||
{
|
||||
//std::cout << "EXPLS Size: " << sizeof(EXPLS) << "\n";
|
||||
InitExplo(pexpls);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,62 @@
|
||||
#pragma once
|
||||
#include "xform.h"
|
||||
|
||||
enum EMITCNK
|
||||
{
|
||||
EMITCNK_Nil = -1,
|
||||
EMITCNK_World = 0,
|
||||
EMITCNK_Local = 1,
|
||||
EMITCNK_Max = 2
|
||||
};
|
||||
struct EMITDV
|
||||
{
|
||||
float rvDamping;
|
||||
glm::vec3 dv;
|
||||
float swCurl;
|
||||
glm::vec3 normalCurl;
|
||||
EMITCNK emitcnk;
|
||||
struct ALO* paloCurlRef;
|
||||
};
|
||||
enum EMITRK
|
||||
{
|
||||
EMITRK_Nil = -1,
|
||||
EMITRK_Continuous = 0,
|
||||
EMITRK_ConstantCount = 1,
|
||||
EMITRK_Burst = 2,
|
||||
EMITRK_BurstOld = 3,
|
||||
EMITRK_Max = 4
|
||||
};
|
||||
|
||||
class EMITTER : public ALO
|
||||
{
|
||||
public:
|
||||
struct EMITB* pemitb;
|
||||
EMITRK emitrk;
|
||||
int cParticle;
|
||||
LM lmSvcParticle;
|
||||
int fCountIsDensity;
|
||||
float uPauseProb;
|
||||
LM lmDtPause;
|
||||
float cParticleConstant;
|
||||
OID oidReference;
|
||||
OID oidRender;
|
||||
OID oidTouch;
|
||||
OID oidNextRender;
|
||||
int fAutoPause;
|
||||
OID oidShape;
|
||||
OID oidGroup;
|
||||
DL dlGroup;
|
||||
DLE dleGroup;
|
||||
float svcParticle;
|
||||
float dtRecalcSvc;
|
||||
float tRecalcSvc;
|
||||
float rDensity;
|
||||
float sBoxRadius;
|
||||
float uParticle;
|
||||
float tUnpause;
|
||||
struct RIPG* pripg;
|
||||
struct BLIPG* pblipg;
|
||||
int fValuesChanged;
|
||||
};
|
||||
|
||||
class EXPL : public XFM
|
||||
@ -22,7 +75,7 @@ class EXPLG : public EXPL
|
||||
class EXPLO : public EXPL
|
||||
{
|
||||
public:
|
||||
//EMITB *pemitb;
|
||||
struct EMITB* pemitb;
|
||||
OID oidreference;
|
||||
OID oidShape;
|
||||
};
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitFlash(FLASH* pflash)
|
||||
{
|
||||
//std::cout << "FLASH Size: " << sizeof(FLASH) << "\n";
|
||||
InitAlo(pflash);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,13 @@ void LoadTbspFromBrx(CBinaryInputStream *pbis);
|
||||
class FLASH : public ALO
|
||||
{
|
||||
public:
|
||||
int ctsurf;
|
||||
struct TSURF* atsurf;
|
||||
int ctbsp;
|
||||
struct TBSP* atbsp;
|
||||
struct SMP smpScale;
|
||||
float gScaleCur;
|
||||
float gScaleTarget;
|
||||
};
|
||||
|
||||
void InitFlash(FLASH* pflash);
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
void InitFly(FLY* pfly)
|
||||
{
|
||||
//std::cout << "FLY Size: " << sizeof(FLY) << "\n";
|
||||
InitSo(pfly);
|
||||
AppendDlEntry(&pfly->psw->dlFly, pfly);
|
||||
}
|
||||
|
||||
void LoadFlyFromBrx(FLY* pfly, CBinaryInputStream* pbis)
|
||||
|
61
Sly1/fly.h
61
Sly1/fly.h
@ -1,9 +1,70 @@
|
||||
#pragma once
|
||||
#include "so.h"
|
||||
|
||||
enum FLYK
|
||||
{
|
||||
FLYK_Nil = -1,
|
||||
FLYK_Insect = 0,
|
||||
FLYK_Pigeon = 1,
|
||||
FLYK_Max = 2
|
||||
};
|
||||
enum FLYS
|
||||
{
|
||||
FLYS_Nil = -1,
|
||||
FLYS_Wander = 0,
|
||||
FLYS_Dying = 1,
|
||||
FLYS_Dead = 2,
|
||||
FLYS_Attract = 3,
|
||||
FLYS_Stuck = 4,
|
||||
FLYS_Land = 5,
|
||||
FLYS_Ground = 6,
|
||||
FLYS_Max = 7
|
||||
};
|
||||
|
||||
class FLY : public SO
|
||||
{
|
||||
public:
|
||||
FLYK flyk;
|
||||
FLYS flys;
|
||||
float tFlys;
|
||||
float tFlysNext;
|
||||
FLYS flysInit;
|
||||
int cpaloRender;
|
||||
int ipaloRender;
|
||||
struct ALO* apaloRender[16];
|
||||
int cpaloRenderGround;
|
||||
struct ALO* apaloRenderGround[8];
|
||||
struct ALO* paloRenderDead;
|
||||
struct EXPL* pexpl;
|
||||
struct TARGET* ptarget;
|
||||
DLE dleFly;
|
||||
struct AMB* pambBuzz;
|
||||
glm::vec3 posWanderNext;
|
||||
glm::vec3 vWanderNext;
|
||||
LM lmSCylinderRadius;
|
||||
LM lmSCylinderHeight;
|
||||
LM lmSvxyFlight;
|
||||
LM lmSvzFlight;
|
||||
OID oidSoar;
|
||||
int ipaloRenderSoar;
|
||||
float uSoar;
|
||||
LM lmDtFlying;
|
||||
float dtFlyingFrame;
|
||||
float tFlyingFrameNext;
|
||||
float sGroundMax;
|
||||
LM lmDtGround;
|
||||
LM lmDtGroundFrame;
|
||||
LM lmDtGroundFramePause;
|
||||
float tGroundFrameNext;
|
||||
float tGroundTestLast;
|
||||
LM lmDtDroppings;
|
||||
struct EXPLS* pexplsDroppings;
|
||||
struct PNT* ppntDroppings;
|
||||
float tDroppingsNext;
|
||||
float sFlee;
|
||||
float tLandNext;
|
||||
int diRender;
|
||||
int ccoin;
|
||||
};
|
||||
|
||||
void InitFly(FLY* pfly);
|
||||
|
1
Sly1/frzg.cpp
Normal file
1
Sly1/frzg.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "frzg.h"
|
10
Sly1/frzg.h
Normal file
10
Sly1/frzg.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include "alo.h"
|
||||
|
||||
class FRZG : public LO
|
||||
{
|
||||
public:
|
||||
int coid;
|
||||
OID aoid[8];
|
||||
MRG mrg;
|
||||
};
|
@ -2,10 +2,10 @@
|
||||
|
||||
void InitGeom(GEOM* pgeom)
|
||||
{
|
||||
pgeom->aedge = (EDGE*)0x0;
|
||||
pgeom->aedge.clear();
|
||||
pgeom->cpos = 0;
|
||||
pgeom->apos = (glm::vec3*)0x0;
|
||||
pgeom->apos.clear();
|
||||
pgeom->csurf = 0;
|
||||
pgeom->asurf = (SURF*)0x0;
|
||||
pgeom->asurf.clear();
|
||||
pgeom->cedge = 0;
|
||||
}
|
||||
}
|
38
Sly1/geom.h
38
Sly1/geom.h
@ -1,35 +1,37 @@
|
||||
#pragma once
|
||||
#include "vec.h"
|
||||
|
||||
struct GEOM
|
||||
struct EDGE
|
||||
{
|
||||
float sRadius;
|
||||
int cpos;
|
||||
glm::vec3 *apos;
|
||||
int csurf;
|
||||
struct SURF *asurf;
|
||||
int cedge;
|
||||
struct EDGE *aedge;
|
||||
int *mpiposiiedgeMac;
|
||||
int *aiedge;
|
||||
glm::vec3 *mpisurfposCenter;
|
||||
float *mpisurfsRadius;
|
||||
};
|
||||
|
||||
struct EDGE {
|
||||
uint16_t aipos[2];
|
||||
uint16_t aisurf[2];
|
||||
EDGE *pedgeNext;
|
||||
EDGE *pedgeOtherNext;
|
||||
};
|
||||
|
||||
struct SURF {
|
||||
struct SURF
|
||||
{
|
||||
glm::vec3 normal;
|
||||
float gDot;
|
||||
EDGE *pedge;
|
||||
EDGE *pedgeOther;
|
||||
EDGE* pedge;
|
||||
EDGE* pedgeOther;
|
||||
short grfsurf;
|
||||
short ipos;
|
||||
};
|
||||
|
||||
struct GEOM
|
||||
{
|
||||
float sRadius;
|
||||
int cpos;
|
||||
std::vector <glm::vec3> apos;
|
||||
int csurf;
|
||||
std::vector <SURF> asurf;
|
||||
int cedge;
|
||||
std::vector <EDGE> aedge;
|
||||
int* mpiposiiedgeMac;
|
||||
int* aiedge;
|
||||
std::vector <glm::vec3> mpisurfposCenter;
|
||||
std::vector <float> mpisurfsRadius;
|
||||
};
|
||||
|
||||
void InitGeom(GEOM *pgeom);
|
26
Sly1/gl.cpp
26
Sly1/gl.cpp
@ -1,6 +1,6 @@
|
||||
#include "gl.h"
|
||||
|
||||
void InitGL()
|
||||
void GL::InitGL()
|
||||
{
|
||||
glfwInit();
|
||||
|
||||
@ -17,8 +17,32 @@ void InitGL()
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||
gladLoadGL();
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
// Setup Platform/Renderer bindings
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL3_Init("#version 330");
|
||||
// Setup Dear ImGui style
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
glViewport(0, 0, windowHeight, windowWidth);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void GL::GLFWTerminate()
|
||||
{
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
27
Sly1/gl.h
27
Sly1/gl.h
@ -1,11 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <glad/glad.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtx/rotate_vector.hpp>
|
||||
#include <glm/gtx/vector_angle.hpp>
|
||||
#include <glm/gtx/string_cast.hpp>
|
||||
|
||||
static GLFWwindow* window;
|
||||
static int windowHeight = 800;
|
||||
static int windowWidth = 800;
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_glfw.h"
|
||||
#include "imgui_impl_opengl3.h"
|
||||
#include "ImGuiFileDialog.h"
|
||||
|
||||
void InitGL();
|
||||
class GL
|
||||
{
|
||||
public:
|
||||
GLFWwindow* window;
|
||||
int windowHeight = 800;
|
||||
int windowWidth = 800;
|
||||
|
||||
void InitGL();
|
||||
void GLFWTerminate();
|
||||
};
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
extern GL g_gl;
|
184
Sly1/glob.cpp
184
Sly1/glob.cpp
@ -1,55 +1,56 @@
|
||||
#include "glob.h"
|
||||
#include "shd.h"
|
||||
|
||||
void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis)
|
||||
std::vector <SHD> g_ashd;
|
||||
|
||||
void LoadGlobsetFromBrx(GLOBSET* pglobset, CBinaryInputStream* pbis)
|
||||
{
|
||||
pglobset->cpsaa = 0;
|
||||
|
||||
pbis->U8Read();
|
||||
pglobset->cbnd = pbis->U8Read();
|
||||
|
||||
pglobset->mpibndoid = (OID*) new OID[pglobset->cbnd << 2]();
|
||||
pbis->U8Read();
|
||||
|
||||
pglobset->cbnd = pbis->U8Read();
|
||||
pglobset->mpibndoid.resize(pglobset->cbnd);
|
||||
|
||||
for (int i = 0; i < pglobset->cbnd; i++)
|
||||
pglobset->mpibndoid[i] = (OID)pbis->S16Read();
|
||||
|
||||
|
||||
pglobset->cpose = pbis->U8Read();
|
||||
pbis->file.seekg(pglobset->cpose << 2, SEEK_CUR);
|
||||
pglobset->agPoses.resize(pglobset->cpose);
|
||||
|
||||
for (int i = 0; i < pglobset->cpose; i++)
|
||||
pglobset->agPoses[i] = pbis->F32Read();
|
||||
|
||||
// Loading number of submodels for model
|
||||
pglobset->cglob = pbis->U16Read();
|
||||
|
||||
// Allocating memory for submodel data for model
|
||||
GLOB *glob = (GLOB*)new GLOB[pglobset->cglob << 7]();
|
||||
pglobset->aglob = glob;
|
||||
GLOBI* globi = (GLOBI*)new GLOBI[pglobset->cglob * 0x28]();
|
||||
pglobset->aglobi = globi;
|
||||
if (pglobset->cglob != 0)
|
||||
{
|
||||
pglobset->aglob.resize(pglobset->cglob);
|
||||
pglobset->aglobi.resize(pglobset->cglob);
|
||||
}
|
||||
|
||||
// Loading each submodel for a model
|
||||
for (int i = 0; i < pglobset->cglob; i++)
|
||||
{
|
||||
pglobset->aglob = pglobset->aglob;
|
||||
pglobset->aglobi = pglobset->aglobi;
|
||||
|
||||
uint16_t unk_5 = pbis->U16Read();
|
||||
|
||||
if ((unk_5 & 1) != 0)
|
||||
{
|
||||
pbis->S16Read();
|
||||
pglobset->aglob->pdmat = pbis->ReadMatrix4x2();
|
||||
pglobset->aglob[i].pdmat = pbis->ReadMatrix4x2();
|
||||
}
|
||||
|
||||
if ((unk_5 & 2) != 0)
|
||||
pglobset->aglobi->grfzon = pbis->U32Read();
|
||||
pglobset->aglobi[i].grfzon = pbis->U32Read();
|
||||
|
||||
if ((unk_5 & 0x200) != 0)
|
||||
pglobset->aglob->rSubglobRadius = pbis->F32Read();
|
||||
pglobset->aglob[i].rSubglobRadius = pbis->F32Read();
|
||||
|
||||
if ((unk_5 & 4) != 0)
|
||||
pbis->F32Read();
|
||||
|
||||
if ((unk_5 & 8) != 0)
|
||||
pglobset->aglob->uFog = pbis->F32Read();
|
||||
pglobset->aglob[i].uFog = pbis->F32Read();
|
||||
|
||||
if ((unk_5 & 0x10) != 0)
|
||||
pbis->F32Read();
|
||||
@ -86,26 +87,26 @@ void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis)
|
||||
pbis->U8Read();
|
||||
}
|
||||
|
||||
pglobset->aglob->posCenter = pbis->ReadVector();
|
||||
pglobset->aglob->sRadius = pbis->F32Read();
|
||||
pglobset->aglob[i].posCenter = pbis->ReadVector();
|
||||
pglobset->aglob[i].sRadius = pbis->F32Read();
|
||||
pbis->S16Read();
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
pglobset->aglob->oid = (OID)pbis->U8Read();
|
||||
pglobset->aglob[i].oid = (OID)pbis->U8Read();
|
||||
|
||||
if ((unk_5 & 1) == 0)
|
||||
{
|
||||
// std::cout << "Model Start: " << std::hex << file.tellg()<<"\n";
|
||||
// Number of submodels
|
||||
pglobset->aglob->csubglob = pbis->U16Read();
|
||||
pglobset->aglob[i].csubglob = pbis->U16Read();
|
||||
|
||||
pglobset->aglob->asubglob = (SUBGLOB*)new SUBGLOB[pglobset->aglob->csubglob * 0x50]();
|
||||
pglobset->aglob[i].asubglob.resize(pglobset->aglob[i].csubglob);
|
||||
|
||||
for (int i = 0; i < pglobset->aglob->csubglob; i++)
|
||||
for (int a = 0; a < pglobset->aglob[i].csubglob; a++)
|
||||
{
|
||||
// Loading submodel origin
|
||||
pglobset->aglob->asubglob->posCenter = pbis->ReadVector();
|
||||
pglobset->aglob->asubglob->sRadius = pbis->F32Read();
|
||||
pglobset->aglob[i].asubglob[a].posCenter = pbis->ReadVector();
|
||||
pglobset->aglob[i].asubglob[a].sRadius = pbis->F32Read();
|
||||
|
||||
byte vertexCount = pbis->U8Read();
|
||||
//std::cout << std::dec << "Vertex Count: " << (uint32_t)vertexCount << "\n";
|
||||
@ -113,48 +114,49 @@ void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis)
|
||||
//std::cout << std::dec << "Rotations Count: " << (uint32_t)rotationsCount << "\n";
|
||||
byte vertexColorCount = pbis->U8Read();
|
||||
//std::cout << std::dec << "Vertex Color Count: " << (uint32_t)vertexColorCount << "\n";
|
||||
byte texCoordCount = pbis->U8Read();
|
||||
byte texcoordCount = pbis->U8Read();
|
||||
//std::cout << std::dec << "Texcoords Count: " << (uint32_t)texCoordCount << "\n";
|
||||
byte indexCount = pbis->U8Read();
|
||||
//std::cout << std::dec << "Index Count: " << (uint32_t)indexCount << "\n";
|
||||
|
||||
pglobset->aglob[i].asubglob[a].vertexes.resize(vertexCount);
|
||||
pglobset->aglob[i].asubglob[a].normals.resize(normalCount);
|
||||
pglobset->aglob[i].asubglob[a].vertexColors.resize(vertexColorCount);
|
||||
pglobset->aglob[i].asubglob[a].texcoords.resize(texcoordCount);
|
||||
pglobset->aglob[i].asubglob[a].indexes.resize(indexCount);
|
||||
|
||||
pbis->Align(4);
|
||||
|
||||
//std::cout << "Vertices: " << std::hex << pbis->file.tellg() << "\n";
|
||||
glm::vec3 *pos = (glm::vec3*)new glm::vec3[vertexCount * 0xC]();
|
||||
pbis->file.read((char*)pos, vertexCount * 0xC);
|
||||
|
||||
|
||||
for (int b = 0; b < vertexCount; b++)
|
||||
pglobset->aglob[i].asubglob[a].vertexes[b] = pbis->ReadVector();
|
||||
|
||||
//std::cout << "Normals: " << std::hex << file.tellg() << "\n";
|
||||
glm::vec3 *normal = (glm::vec3*)new glm::vec3[normalCount * 0xC]();
|
||||
pbis->file.read((char*)normal, normalCount * 0xC);
|
||||
for (int c = 0; c < normalCount; c++)
|
||||
pglobset->aglob[i].asubglob[a].normals[c] = pbis->ReadVector();
|
||||
|
||||
//std::cout << "Vertex Colors: " << std::hex << file.tellg() << "\n";
|
||||
for (int i = 0; i < vertexColorCount; i++)
|
||||
pbis->U32Read();
|
||||
for (int d = 0; d < vertexColorCount; d++)
|
||||
pglobset->aglob[i].asubglob[a].vertexColors[d] = (RGBA)pbis->U32Read();
|
||||
|
||||
//std::cout << "Texcoords: " << std::hex << file.tellg() << "\n";
|
||||
glm::vec2 *uv = (glm::vec2*)new glm::vec2[texCoordCount << 3]();
|
||||
pbis->file.read((char*)uv, texCoordCount << 3);
|
||||
//std::cout << "Texcoords: " << std::hex << pbis->file.tellg() << "\n";
|
||||
for (int e = 0; e < texcoordCount; e++)
|
||||
pglobset->aglob[i].asubglob[a].texcoords[e] = pbis->ReadVector2();
|
||||
|
||||
//std::cout << "Indexes: " << std::hex << file.tellg() << "\n\n";
|
||||
for (int f = 0; f < indexCount; f++)
|
||||
pglobset->aglob[i].asubglob[a].indexes[f] = (VTXFLG)pbis->U32Read();
|
||||
|
||||
for (int i = 0; i < indexCount; i++)
|
||||
{
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
pbis->U8Read();
|
||||
}
|
||||
pglobset->aglob[i].asubglob[a].indices = ConvertStripsToTriLists(pglobset->aglob[i].asubglob[a].indexes);
|
||||
|
||||
uint16_t shaderID = pbis->U16Read();
|
||||
pglobset->aglob[i].asubglob[a].pshd = &g_ashd[pbis->U16Read()];
|
||||
|
||||
pglobset->aglob[i].asubglob[a].unSelfIllum = pbis->U8Read();
|
||||
pglobset->aglob[i].asubglob[a].cibnd = pbis->U8Read();
|
||||
|
||||
pglobset->aglob->asubglob->unSelfIllum = pbis->U8Read();
|
||||
pglobset->aglob->asubglob->cibnd = pbis->U8Read();
|
||||
|
||||
for (int i = 0; i < pglobset->aglob->asubglob->cibnd; i++)
|
||||
pbis->U8Read();
|
||||
|
||||
pbis->file.seekg(vertexCount * pglobset->aglob->asubglob->cibnd * 4, SEEK_CUR);
|
||||
pbis->file.seekg(pglobset->aglob[i].asubglob[a].cibnd, SEEK_CUR);
|
||||
pbis->file.seekg(vertexCount * pglobset->aglob[i].asubglob[a].cibnd * 4, SEEK_CUR);
|
||||
|
||||
if (pglobset->cpose != 0)
|
||||
{
|
||||
@ -183,9 +185,11 @@ void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis)
|
||||
}
|
||||
}
|
||||
}
|
||||
//pglob->asubglob++;
|
||||
}
|
||||
|
||||
/*if (pglobset->aglob[i].csubglob != 0)
|
||||
pglobset->aglob[i].asubglob = MakeGLBuffers(pglobset->aglob[i].asubglob);*/
|
||||
|
||||
uint16_t numSubMesh1 = pbis->U16Read();
|
||||
|
||||
for (int i = 0; i < numSubMesh1; i++)
|
||||
@ -230,4 +234,74 @@ void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector <byte> ConvertStripsToTriLists(std::vector <VTXFLG> indexes)
|
||||
{
|
||||
std::vector <byte> indices;
|
||||
|
||||
uint32_t idx = 0;
|
||||
|
||||
for (int i = 2; i < indexes.size(); i++)
|
||||
{
|
||||
byte indice0 = indexes[idx + 0].ipos;
|
||||
byte indice1 = indexes[idx + 1].ipos;
|
||||
byte indice2 = indexes[idx + 2].ipos;
|
||||
byte stripFlag = indexes[idx + 2].bMisc;
|
||||
|
||||
if (stripFlag != 0x80 && stripFlag != 0x81 && stripFlag != 0x82 && stripFlag != 0x83 && stripFlag != 0x84 && stripFlag != 0x85 && stripFlag != 0x86 && stripFlag != 0x87 && stripFlag != 0x88 && stripFlag != 0x89 && stripFlag != 0x8A && stripFlag != 0x8B && stripFlag != 0x8C && stripFlag != 0x8D && stripFlag != 0x8E && stripFlag != 0x8F && stripFlag != 0xFF)
|
||||
{
|
||||
indices.push_back(indice0);
|
||||
indices.push_back(indice1);
|
||||
indices.push_back(indice2);
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
std::vector <SUBGLOB> MakeGLBuffers(std::vector<SUBGLOB> asubglob)
|
||||
{
|
||||
for (int i = 0; i < asubglob.size(); i++)
|
||||
{
|
||||
glGenVertexArrays(1, &asubglob[i].VAO);
|
||||
glBindVertexArray(asubglob[i].VAO);
|
||||
|
||||
glGenBuffers(1, &asubglob[i].VBO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, asubglob[i].VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, asubglob[i].vertexes.size() * sizeof(glm::vec3), asubglob[i].vertexes.data(), GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(glm::vec3), (void*)0);
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
glGenBuffers(1, &asubglob[i].VNO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, asubglob[i].VNO);
|
||||
glBufferData(GL_ARRAY_BUFFER, asubglob[i].normals.size() * sizeof(glm::vec3), asubglob[i].normals.data(), GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(glm::vec3), (void*)0);
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
glGenBuffers(1, &asubglob[i].VCB);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, asubglob[i].VCB);
|
||||
glBufferData(GL_ARRAY_BUFFER, asubglob[i].vertexColors.size() * sizeof(uint32_t), asubglob[i].vertexColors.data(), GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(2, 1, GL_UNSIGNED_INT, GL_TRUE, sizeof(uint32_t), (void*)0);
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
glGenBuffers(1, &asubglob[i].TCB);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, asubglob[i].TCB);
|
||||
glBufferData(GL_ARRAY_BUFFER, asubglob[i].texcoords.size() * sizeof(glm::vec2), asubglob[i].texcoords.data(), GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), (void*)0);
|
||||
glEnableVertexAttribArray(3);
|
||||
|
||||
glGenBuffers(1, &asubglob[i].EBO);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, asubglob[i].EBO);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, asubglob[i].indices.size() * sizeof(uint8_t), asubglob[i].indices.data(), GL_STATIC_DRAW);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
return asubglob;
|
||||
}
|
10
Sly1/glob.frag
Normal file
10
Sly1/glob.frag
Normal file
@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 vertexColor; // the input variable from the vertex shader (same name and same type)
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vertexColor;
|
||||
}
|
49
Sly1/glob.h
49
Sly1/glob.h
@ -1,17 +1,45 @@
|
||||
#pragma once
|
||||
#include "bis.h"
|
||||
#include "shd.h"
|
||||
#include "bis.h"
|
||||
|
||||
// Glob is just another word for model.
|
||||
|
||||
// Vertex Flag
|
||||
struct VTXFLG
|
||||
{
|
||||
// Vertex Index
|
||||
byte ipos;
|
||||
// Normal Index
|
||||
byte inormal;
|
||||
// UV Index
|
||||
byte iuv;
|
||||
// Strip Flag
|
||||
byte bMisc;
|
||||
};
|
||||
|
||||
struct SUBGLOB // NOT DONE
|
||||
{
|
||||
glm::vec3 posCenter;
|
||||
GLuint VAO;
|
||||
GLuint VBO;
|
||||
GLuint VNO;
|
||||
GLuint VCB;
|
||||
GLuint TCB;
|
||||
GLuint EBO;
|
||||
GLuint gl_texture;
|
||||
|
||||
glm::vec3 posCenter; // Submodel orgin
|
||||
float sRadius;
|
||||
std::vector <glm::vec3> vertexes;
|
||||
std::vector <glm::vec3> normals;
|
||||
std::vector <RGBA> vertexColors;
|
||||
std::vector <glm::vec2> texcoords;
|
||||
std::vector <VTXFLG> indexes;
|
||||
std::vector <byte> indices;
|
||||
uint32_t unSelfIllum;
|
||||
struct SHD *pshd;
|
||||
int cibnd;
|
||||
int aibnd[4];
|
||||
|
||||
}; // NOT DONE
|
||||
|
||||
// Model data
|
||||
@ -36,7 +64,7 @@ struct GLOB // NOT DONE
|
||||
//WRBG *pwrbg;
|
||||
// Number of submodels for model
|
||||
int csubglob;
|
||||
SUBGLOB *asubglob;
|
||||
std::vector<SUBGLOB> asubglob;
|
||||
int csubcel;
|
||||
//SUBCEL *asubcel;
|
||||
glm::mat4 pdmat;
|
||||
@ -59,20 +87,25 @@ struct GLOBSET // NOT DONE
|
||||
{
|
||||
int cbnd;
|
||||
//BND *abnd;
|
||||
OID *mpibndoid;
|
||||
std::vector <OID> mpibndoid;
|
||||
// Number of submodeles for a model
|
||||
int cglob;
|
||||
struct GLOB *aglob;
|
||||
struct GLOBI *aglobi;
|
||||
std::vector <GLOB> aglob;
|
||||
std::vector <GLOBI> aglobi;
|
||||
//LTFN ltfn;
|
||||
uint32_t grfglobset;
|
||||
struct RGBA rgbaCel;
|
||||
int cpose;
|
||||
float* agPoses;
|
||||
float* agPosesOrig;
|
||||
std::vector <float> agPoses;
|
||||
std::vector <float> agPosesOrig;
|
||||
//WRBG *pwrbgFirst;
|
||||
int cpsaa;
|
||||
struct SAA** apsaa;
|
||||
}; // NOT DONE
|
||||
|
||||
// Loads 3D models from binary file
|
||||
void LoadGlobsetFromBrx(GLOBSET *pglobset, CBinaryInputStream *pbis); // NOT FINISHED
|
||||
// Converts tri strips to tri list
|
||||
std::vector <byte> ConvertStripsToTriLists(std::vector <VTXFLG> indexes);
|
||||
// Storing 3D models in VRAM
|
||||
std::vector <SUBGLOB> MakeGLBuffers(std::vector<SUBGLOB> asubglob);
|
18
Sly1/glob.vert
Normal file
18
Sly1/glob.vert
Normal file
@ -0,0 +1,18 @@
|
||||
#version 330 core
|
||||
|
||||
layout (location = 0) in vec3 pos;
|
||||
layout (location = 1) in vec3 normal;
|
||||
layout (location = 2) in int color;
|
||||
layout (location = 3) in vec2 texCoord;
|
||||
|
||||
out vec4 vertexColor;
|
||||
|
||||
uniform mat4 proj;
|
||||
uniform mat4 view;
|
||||
uniform mat4 model;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = proj * view * model * vec4(pos.z, pos.y, pos.x, 1.0);
|
||||
vertexColor = vec4(0.5, 0.0, 0.0, 1.0);
|
||||
}
|
@ -3,4 +3,4 @@
|
||||
void InitGomer(GOMER* pgomer)
|
||||
{
|
||||
InitStepGuard(pgomer);
|
||||
}
|
||||
}
|
13
Sly1/gomer.h
13
Sly1/gomer.h
@ -3,7 +3,18 @@
|
||||
|
||||
class GOMER:public STEPGUARD
|
||||
{
|
||||
|
||||
public:
|
||||
float sAbandon;
|
||||
float dzAbandon;
|
||||
OID oidAbandon;
|
||||
struct VOL* pvolAbandon;
|
||||
LM lmSDetect;
|
||||
LM lmRadDetect;
|
||||
OID oidDetect;
|
||||
struct VOL* pvolDetect;
|
||||
int fDetectLatch;
|
||||
int fDetectLatchExternal;
|
||||
int fAbandonExternal;
|
||||
};
|
||||
|
||||
void InitGomer(GOMER* pgomer);
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitHbsk(HBSK* phbsk)
|
||||
{
|
||||
//std::cout << "HBSK Size: " << sizeof(HBSK) << "\n";
|
||||
InitSo(phbsk);
|
||||
}
|
||||
|
||||
@ -12,6 +13,7 @@ void OnHbskAdd(HBSK* phbsk)
|
||||
|
||||
void InitHshape(HSHAPE* phshape)
|
||||
{
|
||||
//std::cout << "HSHAPE Size: " << sizeof(HSHAPE) << "\n";
|
||||
InitShape(phshape);
|
||||
}
|
||||
|
||||
@ -22,6 +24,7 @@ void OnHshapeAdd(HSHAPE* phshape)
|
||||
|
||||
void InitHpnt(HPNT* phpnt)
|
||||
{
|
||||
//std::cout << "HPNT Size: " << sizeof(HPNT) << "\n";
|
||||
InitLo(phpnt);
|
||||
}
|
||||
|
||||
|
41
Sly1/hide.h
41
Sly1/hide.h
@ -3,19 +3,60 @@
|
||||
#include "shape.h"
|
||||
#include "pnt.h"
|
||||
|
||||
enum JTHK
|
||||
{
|
||||
JTHK_Nil = -1,
|
||||
JTHK_Flatten = 0,
|
||||
JTHK_Duck = 1,
|
||||
JTHK_Basket = 2,
|
||||
JTHK_Nonchalant = 3,
|
||||
JTHK_Rail = 4,
|
||||
JTHK_Spire = 5,
|
||||
JTHK_Reach = 6,
|
||||
JTHK_Vault = 7,
|
||||
JTHK_Max = 8
|
||||
};
|
||||
enum HBSKS
|
||||
{
|
||||
HBSKS_Nil = -1,
|
||||
HBSKS_Available = 0,
|
||||
HBSKS_InUse = 1,
|
||||
HBSKS_Max = 2
|
||||
};
|
||||
|
||||
class HBSK : public SO
|
||||
{
|
||||
public:
|
||||
HBSKS hbsks;
|
||||
float tHbsks;
|
||||
DLE dleHbsk;
|
||||
float sFlattenRadius;
|
||||
int cMaxDartsStuck;
|
||||
};
|
||||
|
||||
class HSHAPE : public SHAPE
|
||||
{
|
||||
public:
|
||||
DLE dleHshape;
|
||||
JTHK jthk;
|
||||
OID oidTnHide;
|
||||
struct TN* ptnHide;
|
||||
int fTunnel;
|
||||
int grfhp;
|
||||
int fDetect;
|
||||
};
|
||||
|
||||
class HPNT : public PNT
|
||||
{
|
||||
public:
|
||||
DLE dleHpnt;
|
||||
JTHK jthk;
|
||||
float sFlattenRadius;
|
||||
OID oidTnHide;
|
||||
struct TN* ptnHide;
|
||||
int fTunnel;
|
||||
int fDetect;
|
||||
float dzIgnore;
|
||||
};
|
||||
|
||||
void InitHbsk(HBSK* phbsk);
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
void InitHnd(HND* phnd)
|
||||
{
|
||||
//std::cout << "HND Size: " << sizeof(HND) << "\n";
|
||||
InitTarget(phnd);
|
||||
}
|
||||
|
||||
|
14
Sly1/hnd.h
14
Sly1/hnd.h
@ -1,9 +1,23 @@
|
||||
#pragma once
|
||||
#include "target.h"
|
||||
|
||||
enum HNDK
|
||||
{
|
||||
HNDK_Nil = -1,
|
||||
HNDK_Both = 0,
|
||||
HNDK_Forward = 1,
|
||||
HNDK_Backward = 2,
|
||||
HNDK_Max = 3
|
||||
};
|
||||
|
||||
class HND : public TARGET
|
||||
{
|
||||
public:
|
||||
HNDK hndk;
|
||||
float svzJumpBoost;
|
||||
SFXID sfxidGrab;
|
||||
SFXID sfxidRelease;
|
||||
float sRadiusHook;
|
||||
};
|
||||
|
||||
void InitHnd(HND* phnd);
|
||||
|
341
Sly1/imgui.ini
Normal file
341
Sly1/imgui.ini
Normal file
@ -0,0 +1,341 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Test]
|
||||
Pos=0,2
|
||||
Size=1928,48
|
||||
|
||||
[Window][Project Cane]
|
||||
Pos=-3,0
|
||||
Size=1925,53
|
||||
Collapsed=1
|
||||
|
||||
[Window][Demo window]
|
||||
Pos=1,2
|
||||
Size=232,54
|
||||
|
||||
[Window][ProjectCane]
|
||||
Pos=-6,1
|
||||
Size=1929,56
|
||||
|
||||
[Window][Choose File##ChooseFileDlgKey]
|
||||
Pos=60,76
|
||||
Size=652,398
|
||||
|
||||
[Table][0xA0160ED0,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x7CAC4566,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xA506B278,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xF3426B7F,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xA6E7FE97,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB753CAF5,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x832ED7F9,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB9954B3F,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD934FC4D,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD66F2DCC,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xA59C2980,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x23F21811,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x92555949,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xE18F1B12,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xC64377F9,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xA1FBAD00,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x57803DDE,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x90AA1D6A,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD1F518C0,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xCC73FF55,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xF1F3DF76,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x74D4C5B3,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x1F584F77,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xC3C29A26,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB6459ADC,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB2E24871,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x6F8EF6EE,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x699B6974,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x344CF35C,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x201700C4,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x55F3080A,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB62598FB,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x82443C7C,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xC073156E,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x95FB13CC,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xE4849C89,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x83EDC6F9,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x43F25D16,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x418A3A34,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x76DF9740,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xE4DB7F88,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x96FE8EED,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xE3293FFA,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x6B6A8E67,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xC826BB61,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xC3187D78,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x2873840A,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x21952358,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x6C542CB7,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xCD25DC4F,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x79BCCAAC,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x9F7E33A8,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x9CBED670,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB169C884,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD5AB2E2B,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x57A9A298,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x7D927856,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x188FC16A,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xBF7B49C8,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x28A29AB9,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x819997B0,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xCBD0F955,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x6A4A2454,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x2D8950C1,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x3B6F0291,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x2BD46C3C,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x58509834,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x09AF373B,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD6B97D9E,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xD19CEBE8,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x6CB6F581,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xB3830BF9,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x57991D44,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x872F286F,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0xAC088346,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x2E0DA2F1,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x5F0A93C2,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x0486D794,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
||||
[Table][0x9B010164,4]
|
||||
RefScale=13
|
||||
Column 0 Sort=0v
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
void InitJack(JACK* pjack)
|
||||
{
|
||||
std::cout << "JACK Size: " << sizeof(JACK) << "\n";
|
||||
std::cout << "JACKB Size: " << sizeof(JACKB) << "\n";
|
||||
std::cout << "JACKN Size: " << sizeof(JACKN) << "\n";
|
||||
std::cout << "JACKF Size: " << sizeof(JACKF) << "\n";
|
||||
InitPo(pjack);
|
||||
}
|
||||
|
||||
|
102
Sly1/jack.h
102
Sly1/jack.h
@ -1,23 +1,123 @@
|
||||
#pragma once
|
||||
#include "po.h"
|
||||
#include "step.h"
|
||||
|
||||
enum JBS
|
||||
{
|
||||
JBS_Nil = -1,
|
||||
JBS_Chase = 0,
|
||||
JBS_Spike = 1,
|
||||
JBS_Fly = 2,
|
||||
JBS_Taunt = 3,
|
||||
JBS_Max = 4
|
||||
};
|
||||
enum JBWS
|
||||
{
|
||||
JBWS_Nil = -1,
|
||||
JBWS_PlantLeft = 0,
|
||||
JBWS_PlantRight = 1,
|
||||
JBWS_PlantNone = 2,
|
||||
JBWS_Max = 3
|
||||
};
|
||||
enum JACKS
|
||||
{
|
||||
JACKS_Nil = -1,
|
||||
JACKS_Rim = 0,
|
||||
JACKS_Gap = 1,
|
||||
JACKS_Zap = 2,
|
||||
JACKS_Dead = 3,
|
||||
JACKS_Celebrate = 4,
|
||||
JACKS_Max = 5
|
||||
};
|
||||
struct JE
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
};
|
||||
struct JPR
|
||||
{
|
||||
JE je;
|
||||
struct SO* pso;
|
||||
};
|
||||
|
||||
class JACK : public PO
|
||||
{
|
||||
public:
|
||||
JACKS jacks;
|
||||
float tJacks;
|
||||
struct ASEGA* pasegaCur;
|
||||
struct ASEG* pasegStop;
|
||||
struct ASEG* pasegRim;
|
||||
struct ASEG* pasegGap;
|
||||
struct ASEG* pasegZap;
|
||||
struct ASEG* pasegDead;
|
||||
struct ASEG* pasegCelebrate;
|
||||
struct JACKF* pjackf;
|
||||
struct JACKB* pjackb;
|
||||
struct JACKN* apjackn[32];
|
||||
struct JACKF* apjackfDrop[4];
|
||||
int cjpr;
|
||||
JPR ajpr[6];
|
||||
int iCur;
|
||||
int jCur;
|
||||
int iNext;
|
||||
int jNext;
|
||||
float uCur;
|
||||
float radTarget;
|
||||
int cpjacknActive;
|
||||
int cpjacknTarget;
|
||||
float tNextJackn;
|
||||
struct SHD* pshdTop;
|
||||
struct SHD* pshdSides;
|
||||
struct SHD* pshdGap;
|
||||
glm::mat4 matPosToUv;
|
||||
};
|
||||
class JACKN : public ALO
|
||||
{
|
||||
public:
|
||||
struct JACK* pjack;
|
||||
struct JACKF* pjackf;
|
||||
int cpaloRender;
|
||||
struct ALO* apaloRender[16];
|
||||
float svu;
|
||||
float u;
|
||||
int fGap;
|
||||
};
|
||||
|
||||
class JACKB : public ALO
|
||||
{
|
||||
public:
|
||||
struct JACK* pjack;
|
||||
JBS jbs;
|
||||
float tJbs;
|
||||
struct ASEGA* pasegaCur;
|
||||
JBS jbsNext;
|
||||
float radTarget;
|
||||
BL ablWalk[2];
|
||||
struct ASEGBL* pasegblWalk;
|
||||
struct ASEG* pasegSpike;
|
||||
struct ASEG* pasegFly;
|
||||
struct ASEG* pasegTaunt;
|
||||
struct PNT* ppntLeftWingTip;
|
||||
struct PNT* ppntRightWingTip;
|
||||
JBWS jbws;
|
||||
JBWS jbwsNext;
|
||||
glm::vec3 posPlant;
|
||||
glm::vec3 posNextPlant;
|
||||
};
|
||||
|
||||
class JACKF : public ALO
|
||||
{
|
||||
public:
|
||||
struct JACK* pjack;
|
||||
int cjeRim;
|
||||
struct JE* ajeRim;
|
||||
struct JEP* ajepRim;
|
||||
int cjeGap;
|
||||
struct JE* ajeGap;
|
||||
enum JK* aaajk;
|
||||
float tDrop;
|
||||
glm::vec3 dvDrop;
|
||||
int c;
|
||||
};
|
||||
|
||||
void InitJack(JACK *pjack);
|
||||
|
@ -2,16 +2,19 @@
|
||||
|
||||
void InitJlovol(JLOVOL* pjlovol)
|
||||
{
|
||||
//std::cout << "JLOVOL Size: " << sizeof(JLOVOL) << "\n";
|
||||
InitVolbtn(pjlovol);
|
||||
}
|
||||
|
||||
void InitJlo(JLO* pjlo)
|
||||
{
|
||||
//std::cout << "JLO Size: " << sizeof(JLO) << "\n";
|
||||
InitSo(pjlo);
|
||||
}
|
||||
|
||||
void InitJloc(JLOC* pjloc)
|
||||
{
|
||||
//std::cout << "JLOC Size: " << sizeof(JLOC) << "\n";
|
||||
InitAlo(pjloc);
|
||||
}
|
||||
|
||||
|
66
Sly1/jlo.h
66
Sly1/jlo.h
@ -1,19 +1,85 @@
|
||||
#pragma once
|
||||
#include "button.h"
|
||||
|
||||
enum JLOS
|
||||
{
|
||||
JLOS_Nil = -1,
|
||||
JLOS_Jump = 0,
|
||||
JLOS_Land = 1,
|
||||
JLOS_Idle = 2,
|
||||
JLOS_Fire = 3,
|
||||
JLOS_Taunt = 4,
|
||||
JLOS_Max = 5
|
||||
};
|
||||
enum JLOCK
|
||||
{
|
||||
JLOCK_Nil = -1,
|
||||
JLOCK_Closest = 0,
|
||||
JLOCK_Random = 1,
|
||||
JLOCK_Max = 2
|
||||
};
|
||||
enum JLOMK
|
||||
{
|
||||
JLOMK_Nil = -1,
|
||||
JLOMK_Straight = 0,
|
||||
JLOMK_Lobbed = 1,
|
||||
JLOMK_Spline = 2,
|
||||
JLOMK_Max = 3
|
||||
};
|
||||
|
||||
class JLO : public SO
|
||||
{
|
||||
public:
|
||||
struct SM* psm;
|
||||
struct SMA* psma;
|
||||
struct JLOVOL* pjlovolCur;
|
||||
DL dlJlovol;
|
||||
struct PNT* ppntFeet;
|
||||
float dzFeet;
|
||||
struct RWM* prwm;
|
||||
float tFireNext;
|
||||
OID oidJlovolStart;
|
||||
struct ALO* paloReticle;
|
||||
struct ALO* paloTracer;
|
||||
struct PNT* ppntTracerStart;
|
||||
struct ASEG* pasegReticlePop;
|
||||
struct ASEG* pasegReticleConverge;
|
||||
struct XFM* pxfmTarget;
|
||||
struct XFM* pxfmStatic;
|
||||
JLOS jlos;
|
||||
float tJlos;
|
||||
float radTarget;
|
||||
float dtLand;
|
||||
float tLand;
|
||||
float tStick;
|
||||
SMP smpSpin;
|
||||
struct EXC* pexc;
|
||||
};
|
||||
|
||||
class JLOC : public ALO
|
||||
{
|
||||
public:
|
||||
struct XFM* apxfm[16];
|
||||
int cpxfm;
|
||||
JLOCK jlock;
|
||||
JLOMK jlomk;
|
||||
float dtFire;
|
||||
float dtMissile;
|
||||
float rAccelTime;
|
||||
float rMissileSpeed;
|
||||
float radTilt;
|
||||
float svLaunch;
|
||||
float svTarget;
|
||||
};
|
||||
|
||||
class JLOVOL : public VOLBTN
|
||||
{
|
||||
public:
|
||||
OID oidLand;
|
||||
struct PNT* ppntLand;
|
||||
OID oidJloc;
|
||||
struct JLOC* pjloc;
|
||||
DLE dleJlo;
|
||||
};
|
||||
|
||||
void InitJlovol(JLOVOL* pjlovol);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user