├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── dllmain.cpp ├── examples ├── Simple2D │ ├── Rust2D.sprj │ └── shaders │ │ ├── fragment.rs │ │ └── vertex.rs └── SkyShader │ ├── SkyShader.sprj │ └── shaders │ └── shader.rs ├── imgs ├── screen1.png ├── screen2.png └── screen3.png ├── inc └── PluginAPI │ ├── Plugin.h │ └── PluginData.h ├── libs ├── imgui │ ├── .editorconfig │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE.txt │ ├── docs │ │ ├── CHANGELOG.txt │ │ ├── FAQ.md │ │ ├── FONTS.md │ │ ├── README.md │ │ └── TODO.txt │ ├── examples │ │ ├── README.txt │ │ ├── example_allegro5 │ │ │ ├── README.md │ │ │ ├── example_allegro5.vcxproj │ │ │ ├── example_allegro5.vcxproj.filters │ │ │ ├── imconfig_allegro5.h │ │ │ └── main.cpp │ │ ├── example_apple_metal │ │ │ ├── README.md │ │ │ ├── Shared │ │ │ │ ├── AppDelegate.h │ │ │ │ ├── AppDelegate.m │ │ │ │ ├── Renderer.h │ │ │ │ ├── Renderer.mm │ │ │ │ ├── ViewController.h │ │ │ │ ├── ViewController.mm │ │ │ │ └── main.m │ │ │ ├── example_apple_metal.xcodeproj │ │ │ │ └── project.pbxproj │ │ │ ├── iOS │ │ │ │ ├── Base.lproj │ │ │ │ │ └── Main.storyboard │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Info-iOS.plist │ │ │ │ └── Launch Screen.storyboard │ │ │ └── macOS │ │ │ │ ├── Base.lproj │ │ │ │ └── Main.storyboard │ │ │ │ └── Info-macOS.plist │ │ ├── example_apple_opengl2 │ │ │ ├── example_apple_opengl2.xcodeproj │ │ │ │ └── project.pbxproj │ │ │ └── main.mm │ │ ├── example_emscripten │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── main.cpp │ │ │ └── shell_minimal.html │ │ ├── example_glfw_metal │ │ │ ├── Makefile │ │ │ └── main.mm │ │ ├── example_glfw_opengl2 │ │ │ ├── Makefile │ │ │ ├── build_win32.bat │ │ │ ├── example_glfw_opengl2.vcxproj │ │ │ ├── example_glfw_opengl2.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_glfw_opengl3 │ │ │ ├── Makefile │ │ │ ├── build_win32.bat │ │ │ ├── example_glfw_opengl3.vcxproj │ │ │ ├── example_glfw_opengl3.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_glfw_vulkan │ │ │ ├── CMakeLists.txt │ │ │ ├── build_win32.bat │ │ │ ├── build_win64.bat │ │ │ ├── example_glfw_vulkan.vcxproj │ │ │ ├── example_glfw_vulkan.vcxproj.filters │ │ │ ├── gen_spv.sh │ │ │ ├── glsl_shader.frag │ │ │ ├── glsl_shader.vert │ │ │ └── main.cpp │ │ ├── example_glut_opengl2 │ │ │ ├── Makefile │ │ │ ├── example_glut_opengl2.vcxproj │ │ │ ├── example_glut_opengl2.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_marmalade │ │ │ ├── data │ │ │ │ └── app.icf │ │ │ ├── main.cpp │ │ │ └── marmalade_example.mkb │ │ ├── example_null │ │ │ ├── Makefile │ │ │ ├── build_win32.bat │ │ │ └── main.cpp │ │ ├── example_sdl_directx11 │ │ │ ├── build_win32.bat │ │ │ ├── example_sdl_directx11.vcxproj │ │ │ ├── example_sdl_directx11.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_sdl_metal │ │ │ ├── Makefile │ │ │ └── main.mm │ │ ├── example_sdl_opengl2 │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── build_win32.bat │ │ │ ├── example_sdl_opengl2.vcxproj │ │ │ ├── example_sdl_opengl2.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_sdl_opengl3 │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── build_win32.bat │ │ │ ├── example_sdl_opengl3.vcxproj │ │ │ ├── example_sdl_opengl3.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_sdl_vulkan │ │ │ ├── example_sdl_vulkan.vcxproj │ │ │ ├── example_sdl_vulkan.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_win32_directx10 │ │ │ ├── build_win32.bat │ │ │ ├── example_win32_directx10.vcxproj │ │ │ ├── example_win32_directx10.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_win32_directx11 │ │ │ ├── build_win32.bat │ │ │ ├── example_win32_directx11.vcxproj │ │ │ ├── example_win32_directx11.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_win32_directx12 │ │ │ ├── build_win32.bat │ │ │ ├── example_win32_directx12.vcxproj │ │ │ ├── example_win32_directx12.vcxproj.filters │ │ │ └── main.cpp │ │ ├── example_win32_directx9 │ │ │ ├── build_win32.bat │ │ │ ├── example_win32_directx9.vcxproj │ │ │ ├── example_win32_directx9.vcxproj.filters │ │ │ └── main.cpp │ │ ├── imgui_examples.sln │ │ ├── imgui_impl_allegro5.cpp │ │ ├── imgui_impl_allegro5.h │ │ ├── imgui_impl_dx10.cpp │ │ ├── imgui_impl_dx10.h │ │ ├── imgui_impl_dx11.cpp │ │ ├── imgui_impl_dx11.h │ │ ├── imgui_impl_dx12.cpp │ │ ├── imgui_impl_dx12.h │ │ ├── imgui_impl_dx9.cpp │ │ ├── imgui_impl_dx9.h │ │ ├── imgui_impl_glfw.cpp │ │ ├── imgui_impl_glfw.h │ │ ├── imgui_impl_glut.cpp │ │ ├── imgui_impl_glut.h │ │ ├── imgui_impl_marmalade.cpp │ │ ├── imgui_impl_marmalade.h │ │ ├── imgui_impl_metal.h │ │ ├── imgui_impl_metal.mm │ │ ├── imgui_impl_opengl2.cpp │ │ ├── imgui_impl_opengl2.h │ │ ├── imgui_impl_opengl3.cpp │ │ ├── imgui_impl_opengl3.h │ │ ├── imgui_impl_osx.h │ │ ├── imgui_impl_osx.mm │ │ ├── imgui_impl_sdl.cpp │ │ ├── imgui_impl_sdl.h │ │ ├── imgui_impl_vulkan.cpp │ │ ├── imgui_impl_vulkan.h │ │ ├── imgui_impl_win32.cpp │ │ ├── imgui_impl_win32.h │ │ └── libs │ │ │ ├── gl3w │ │ │ └── GL │ │ │ │ ├── gl3w.c │ │ │ │ ├── gl3w.h │ │ │ │ └── glcorearb.h │ │ │ ├── glfw │ │ │ ├── COPYING.txt │ │ │ ├── include │ │ │ │ └── GLFW │ │ │ │ │ ├── glfw3.h │ │ │ │ │ └── glfw3native.h │ │ │ ├── lib-vc2010-32 │ │ │ │ └── glfw3.lib │ │ │ └── lib-vc2010-64 │ │ │ │ └── glfw3.lib │ │ │ └── usynergy │ │ │ ├── README.txt │ │ │ ├── uSynergy.c │ │ │ └── uSynergy.h │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_internal.h │ ├── imgui_widgets.cpp │ ├── imstb_rectpack.h │ ├── imstb_textedit.h │ ├── imstb_truetype.h │ └── misc │ │ ├── README.txt │ │ ├── cpp │ │ ├── README.txt │ │ ├── imgui_stdlib.cpp │ │ └── imgui_stdlib.h │ │ ├── fonts │ │ ├── Cousine-Regular.ttf │ │ ├── DroidSans.ttf │ │ ├── Karla-Regular.ttf │ │ ├── ProggyClean.ttf │ │ ├── ProggyTiny.ttf │ │ ├── Roboto-Medium.ttf │ │ └── binary_to_compressed_c.cpp │ │ ├── freetype │ │ ├── README.md │ │ ├── imgui_freetype.cpp │ │ └── imgui_freetype.h │ │ ├── natvis │ │ ├── README.txt │ │ └── imgui.natvis │ │ └── single_file │ │ └── imgui_single_file.h └── picojson │ └── picojson.h └── rust_crates ├── shader └── Cargo.toml └── spirv-std ├── Cargo.toml └── src ├── lib.rs └── math_ext.rs /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | copy.bat 3 | vsproject64 4 | CMakeCache.txt 5 | CMakeFiles/ 6 | Makefile 7 | bin/ 8 | cmake_install.cmake 9 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | set(CMAKE_CXX_STANDARD 17) 3 | project(PluginRust) 4 | 5 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./bin) 6 | 7 | # source code 8 | set(SOURCES 9 | dllmain.cpp 10 | 11 | # libraries 12 | libs/imgui/imgui_draw.cpp 13 | libs/imgui/imgui_widgets.cpp 14 | libs/imgui/imgui.cpp 15 | ) 16 | 17 | # cmake toolchain 18 | if(CMAKE_TOOLCHAIN_FILE) 19 | include(${CMAKE_TOOLCHAIN_FILE}) 20 | endif(CMAKE_TOOLCHAIN_FILE) 21 | 22 | # create executable 23 | add_library(PluginRust SHARED ${SOURCES}) 24 | 25 | set_target_properties(PluginRust PROPERTIES OUTPUT_NAME "plugin") 26 | set_target_properties(PluginRust PROPERTIES PREFIX "") 27 | 28 | target_include_directories(PluginRust PRIVATE libs inc) 29 | 30 | if (NOT MSVC) 31 | target_compile_options(PluginRust PRIVATE -Wno-narrowing) 32 | endif() 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 dfranx 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PluginRust 2 | SHADERed plugin that lets you write your shaders in Rust. This is possible thanks to the [rust-gpu](https://github.com/EmbarkStudios/rust-gpu) project. 3 | 4 | ![Screenshot](./imgs/screen1.png) 5 | 6 | You can change path to your `rustc_codegen_spriv.dll` in the options: 7 | 8 | ![Options](./imgs/screen2.png) 9 | 10 | ## How to build 11 | Run the following commands: 12 | ```bash 13 | git clone https://github.com/dfranx/PluginRust.git 14 | cmake . 15 | make 16 | ``` 17 | 18 | ## Known bugs & problems 19 | **NOTE:** You have to turn off the "Recompile shader on content change" option since build times are relatively long. 20 | 21 | Currently errors don't point to shader stage/source: 22 | ![Bug](./imgs/screen3.png) 23 | 24 | ## How to use 25 | This plugin requires at least SHADERed v1.4. 26 | 27 | Copy the .dll/.so file to `plugins/Rust` folder in your SHADERed's installation directory 28 | 29 | After you start SHADERed, you can open one of the provided projects to quickly get started. 30 | 31 | Also, make sure you have `cargo` installed on your PC. 32 | -------------------------------------------------------------------------------- /examples/Simple2D/Rust2D.sprj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ScreenQuadNDC 16 | 1 17 | 1 18 | 1 19 | TriangleList 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 26 38 | 89 39 | 333 40 | 360 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /examples/Simple2D/shaders/fragment.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(target_arch = "spirv", no_std)] 2 | #![feature(lang_items)] 3 | #![feature(register_attr)] 4 | #![register_attr(spirv)] 5 | 6 | use spirv_std::glam::{Vec2, Vec3, Vec4}; 7 | use spirv_std::{Input, MathExt, Output, UniformConstant }; 8 | 9 | #[allow(unused_attributes)] 10 | #[spirv(fragment)] 11 | pub fn main_fs( 12 | #[spirv(frag_coord)] frag_coord : Input, 13 | u_time : UniformConstant, 14 | u_resolution : UniformConstant, 15 | mut output : Output 16 | ) { 17 | let coord = frag_coord.load(); 18 | let res = u_resolution.load(); 19 | 20 | let uv = Vec2::new(coord.x() / res.x(), coord.y() / res.y()); 21 | let uv_swizzle = Vec3::new(uv.y(), uv.x(), uv.y()); // does rust-gpu support swizzling? 22 | 23 | let color = Vec3::splat(0.5) + 0.5 * (u_time.load().cos() * uv_swizzle); 24 | 25 | output.store(color.extend(1.0)) 26 | } 27 | 28 | 29 | #[cfg(all(not(test), target_arch = "spirv"))] 30 | #[panic_handler] 31 | fn panic(_: &core::panic::PanicInfo) -> ! { 32 | loop {} 33 | } 34 | 35 | #[cfg(all(not(test), target_arch = "spirv"))] 36 | #[lang = "eh_personality"] 37 | extern "C" fn rust_eh_personality() {} -------------------------------------------------------------------------------- /examples/Simple2D/shaders/vertex.rs: -------------------------------------------------------------------------------- 1 | //! Ported to Rust from https://github.com/Tw1ddle/Sky-Shader/blob/master/src/shaders/glsl/sky.fragment 2 | 3 | #![cfg_attr(target_arch = "spirv", no_std)] 4 | #![feature(lang_items)] 5 | #![feature(register_attr)] 6 | #![register_attr(spirv)] 7 | 8 | use spirv_std::glam::{Vec2, Vec4}; 9 | use spirv_std::{Input, Output}; 10 | 11 | #[allow(unused_attributes)] 12 | #[spirv(vertex)] 13 | pub fn main_vs( 14 | in_pos: Input, 15 | #[spirv(position)] mut out_pos : Output 16 | ) { 17 | out_pos.store(in_pos.load().extend(0.0).extend(1.0)); 18 | } 19 | 20 | #[cfg(all(not(test), target_arch = "spirv"))] 21 | #[panic_handler] 22 | fn panic(_: &core::panic::PanicInfo) -> ! { 23 | loop {} 24 | } 25 | 26 | #[cfg(all(not(test), target_arch = "spirv"))] 27 | #[lang = "eh_personality"] 28 | extern "C" fn rust_eh_personality() {} -------------------------------------------------------------------------------- /examples/SkyShader/SkyShader.sprj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | ScreenQuadNDC 16 | 1 17 | 1 18 | 1 19 | TriangleList 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 26 33 | 77 34 | 105 35 | 360 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /examples/SkyShader/shaders/shader.rs: -------------------------------------------------------------------------------- 1 | //! Ported to Rust from https://github.com/Tw1ddle/Sky-Shader/blob/master/src/shaders/glsl/sky.fragment 2 | 3 | #![cfg_attr(target_arch = "spirv", no_std)] 4 | #![feature(lang_items)] 5 | #![feature(register_attr)] 6 | #![register_attr(spirv)] 7 | 8 | use core::f32::consts::PI; 9 | use spirv_std::glam::{const_vec3, Mat4, Vec2, Vec3, Vec4}; 10 | use spirv_std::{Input, MathExt, Output, Uniform}; 11 | 12 | const DEPOLARIZATION_FACTOR: f32 = 0.035; 13 | const MIE_COEFFICIENT: f32 = 0.005; 14 | const MIE_DIRECTIONAL_G: f32 = 0.8; 15 | const MIE_K_COEFFICIENT: Vec3 = const_vec3!([0.686, 0.678, 0.666]); 16 | const MIE_V: f32 = 4.0; 17 | const MIE_ZENITH_LENGTH: f32 = 1.25e3; 18 | const NUM_MOLECULES: f32 = 2.542e25f32; 19 | const PRIMARIES: Vec3 = const_vec3!([6.8e-7f32, 5.5e-7f32, 4.5e-7f32]); 20 | const RAYLEIGH: f32 = 1.0; 21 | const RAYLEIGH_ZENITH_LENGTH: f32 = 8.4e3; 22 | const REFRACTIVE_INDEX: f32 = 1.0003; 23 | const SUN_ANGULAR_DIAMETER_DEGREES: f32 = 0.0093333; 24 | const SUN_INTENSITY_FACTOR: f32 = 1000.0; 25 | const SUN_INTENSITY_FALLOFF_STEEPNESS: f32 = 1.5; 26 | const TURBIDITY: f32 = 2.0; 27 | 28 | // TODO: add this to glam? Rust std has it on f32/f64 29 | fn pow(v: Vec3, power: f32) -> Vec3 { 30 | Vec3::new(v.x().pow(power), v.y().pow(power), v.z().pow(power)) 31 | } 32 | 33 | // TODO: add this to glam? Rust std has it on f32/f64 34 | fn exp(v: Vec3) -> Vec3 { 35 | Vec3::new(v.x().exp(), v.y().exp(), v.z().exp()) 36 | } 37 | 38 | /// Based on: https://seblagarde.wordpress.com/2014/12/01/inverse-trigonometric-functions-gpu-optimization-for-amd-gcn-architecture/ 39 | fn acos_approx(v: f32) -> f32 { 40 | let x = v.abs(); 41 | let mut res = -0.155972 * x + 1.56467; // p(x) 42 | res *= (1.0f32 - x).sqrt(); 43 | 44 | if v >= 0.0 { 45 | res 46 | } else { 47 | PI - res 48 | } 49 | } 50 | 51 | /// renamed because of cross-compilation issues with spirv-cross/ moltenvk 52 | fn my_smoothstep(edge0: f32, edge1: f32, x: f32) -> f32 { 53 | // Scale, bias and saturate x to 0..1 range 54 | let x = ((x - edge0) / (edge1 - edge0)).saturate(); 55 | // Evaluate polynomial 56 | x * x * (3.0 - 2.0 * x) 57 | } 58 | 59 | fn total_rayleigh(lambda: Vec3) -> Vec3 { 60 | (8.0 * PI.pow(3.0) 61 | * (REFRACTIVE_INDEX.pow(2.0) - 1.0).pow(2.0) 62 | * (6.0 + 3.0 * DEPOLARIZATION_FACTOR)) 63 | / (3.0 * NUM_MOLECULES * pow(lambda, 4.0) * (6.0 - 7.0 * DEPOLARIZATION_FACTOR)) 64 | } 65 | 66 | fn total_mie(lambda: Vec3, k: Vec3, t: f32) -> Vec3 { 67 | let c = 0.2 * t * 10e-18; 68 | 0.434 * c * PI * pow((2.0 * PI) / lambda, MIE_V - 2.0) * k 69 | } 70 | 71 | fn rayleigh_phase(cos_theta: f32) -> f32 { 72 | (3.0 / (16.0 * PI)) * (1.0 + cos_theta.pow(2.0)) 73 | } 74 | 75 | fn henyey_greenstein_phase(cos_theta: f32, g: f32) -> f32 { 76 | (1.0 / (4.0 * PI)) * ((1.0 - g.pow(2.0)) / (1.0 - 2.0 * g * cos_theta + g.pow(2.0)).pow(1.5)) 77 | } 78 | 79 | fn sun_intensity(zenith_angle_cos: f32) -> f32 { 80 | let cutoff_angle = PI / 1.95; // Earth shadow hack 81 | SUN_INTENSITY_FACTOR 82 | * 0.0f32.max( 83 | 1.0 - (-((cutoff_angle - acos_approx(zenith_angle_cos)) 84 | / SUN_INTENSITY_FALLOFF_STEEPNESS)) 85 | .exp(), 86 | ) 87 | } 88 | 89 | fn tonemap(col: Vec3) -> Vec3 { 90 | // see https://www.desmos.com/calculator/0eo9pzo1at 91 | const A: f32 = 2.35; 92 | const B: f32 = 2.8826666; 93 | const C: f32 = 789.7459; 94 | const D: f32 = 0.935; 95 | 96 | let z = pow(col, A); 97 | z / (pow(z, D) * B + Vec3::splat(C)) 98 | } 99 | 100 | fn sky(dir: Vec3, sun_position: Vec3) -> Vec3 { 101 | let up = Vec3::new(0.0, 1.0, 0.0); 102 | let sunfade = 1.0 - (1.0 - (sun_position.y() / 450000.0).exp()).saturate(); 103 | let rayleigh_coefficient = RAYLEIGH - (1.0 * (1.0 - sunfade)); 104 | let beta_r = total_rayleigh(PRIMARIES) * rayleigh_coefficient; 105 | 106 | // Mie coefficient 107 | let beta_m = total_mie(PRIMARIES, MIE_K_COEFFICIENT, TURBIDITY) * MIE_COEFFICIENT; 108 | 109 | // Optical length, cutoff angle at 90 to avoid singularity 110 | let zenith_angle = acos_approx(up.dot(dir).max(0.0)); 111 | let denom = (zenith_angle).cos() + 0.15 * (93.885 - ((zenith_angle * 180.0) / PI)).pow(-1.253); 112 | 113 | let s_r = RAYLEIGH_ZENITH_LENGTH / denom; 114 | let s_m = MIE_ZENITH_LENGTH / denom; 115 | 116 | // Combined extinction factor 117 | let fex = exp(-(beta_r * s_r + beta_m * s_m)); 118 | 119 | // In-scattering 120 | let sun_direction = sun_position.normalize(); 121 | let cos_theta = dir.dot(sun_direction); 122 | let beta_r_theta = beta_r * rayleigh_phase(cos_theta * 0.5 + 0.5); 123 | 124 | let beta_m_theta = beta_m * henyey_greenstein_phase(cos_theta, MIE_DIRECTIONAL_G); 125 | let sun_e = sun_intensity(sun_direction.dot(up)); 126 | let mut lin = pow( 127 | sun_e * ((beta_r_theta + beta_m_theta) / (beta_r + beta_m)) * (Vec3::splat(1.0) - fex), 128 | 1.5, 129 | ); 130 | 131 | lin *= Vec3::splat(1.0).lerp( 132 | pow( 133 | sun_e * ((beta_r_theta + beta_m_theta) / (beta_r + beta_m)) * fex, 134 | 0.5, 135 | ), 136 | ((1.0 - up.dot(sun_direction)).pow(5.0)).saturate(), 137 | ); 138 | 139 | // Composition + solar disc 140 | let sun_angular_diameter_cos = SUN_ANGULAR_DIAMETER_DEGREES.cos(); 141 | let sundisk = my_smoothstep( 142 | sun_angular_diameter_cos, 143 | sun_angular_diameter_cos + 0.00002, 144 | cos_theta, 145 | ); 146 | let mut l0 = 0.1 * fex; 147 | l0 += sun_e * 19000.0 * fex * sundisk; 148 | 149 | lin + l0 150 | } 151 | 152 | pub fn fs(screen_pos: Vec2) -> Vec4 { 153 | // hard-code information because we can't bind buffers at the moment 154 | let eye_pos = Vec3::new(0.0, 0.0997, 0.2); 155 | let sun_pos = Vec3::new(0.0, 75.0, -1000.0); 156 | let clip_to_world = Mat4::from_cols( 157 | Vec4::new(-0.5522849, 0.0, 0.0, 0.0), 158 | Vec4::new(0.0, 0.4096309, -0.061444636, 0.0), 159 | Vec4::new(0.0, 99.99999, 199.99998, 999.99994), 160 | Vec4::new(0.0, -0.14834046, -0.98893654, 0.0), 161 | ); 162 | 163 | let world_pos = clip_to_world.transform_point3(screen_pos.extend(1.0)); 164 | let dir = (world_pos - eye_pos).normalize(); 165 | 166 | // evaluate Preetham sky model 167 | let color = sky(dir, sun_pos); 168 | 169 | // Tonemapping 170 | let color = color.max(Vec3::splat(0.0)).min(Vec3::splat(1024.0)); 171 | 172 | tonemap(color).extend(1.0) 173 | } 174 | 175 | #[allow(unused_attributes)] 176 | #[spirv(fragment)] 177 | pub fn main_fs( 178 | in_pos: Input, 179 | mut output: Output 180 | ) { 181 | let color = fs(in_pos.load()); 182 | output.store(color); 183 | } 184 | 185 | #[allow(unused_attributes)] 186 | #[spirv(vertex)] 187 | pub fn main_vs( 188 | #[spirv(vertex_index)] vert_idx: Input, 189 | #[spirv(position)] mut builtin_pos: Output, 190 | mut out_pos: Output, 191 | ) { 192 | let vert_idx = vert_idx.load(); 193 | 194 | // Create a "full screen triangle" by mapping the vertex index. 195 | // ported from https://www.saschawillems.de/blog/2016/08/13/vulkan-tutorial-on-rendering-a-fullscreen-quad-without-buffers/ 196 | let uv = Vec2::new(((vert_idx << 1) & 2) as f32, (vert_idx & 2) as f32); 197 | let pos = 2.0 * uv - Vec2::one(); 198 | 199 | builtin_pos.store(pos.extend(0.0).extend(1.0)); 200 | out_pos.store(pos); 201 | } 202 | 203 | #[cfg(all(not(test), target_arch = "spirv"))] 204 | #[panic_handler] 205 | fn panic(_: &core::panic::PanicInfo) -> ! { 206 | loop {} 207 | } 208 | 209 | #[cfg(all(not(test), target_arch = "spirv"))] 210 | #[lang = "eh_personality"] 211 | extern "C" fn rust_eh_personality() {} -------------------------------------------------------------------------------- /imgs/screen1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/imgs/screen1.png -------------------------------------------------------------------------------- /imgs/screen2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/imgs/screen2.png -------------------------------------------------------------------------------- /imgs/screen3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/imgs/screen3.png -------------------------------------------------------------------------------- /inc/PluginAPI/PluginData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ed { 4 | namespace plugin { 5 | enum class PipelineItemType { 6 | ShaderPass, 7 | Geometry, 8 | RenderState, 9 | Model, 10 | VertexBuffer, 11 | ComputePass, 12 | AudioPass, 13 | PluginItem, 14 | Count 15 | }; 16 | 17 | enum class VariableType { 18 | Boolean1, 19 | Boolean2, 20 | Boolean3, 21 | Boolean4, 22 | Integer1, 23 | Integer2, 24 | Integer3, 25 | Integer4, 26 | Float1, 27 | Float2, 28 | Float3, 29 | Float4, 30 | Float2x2, 31 | Float3x3, 32 | Float4x4, 33 | Count 34 | }; 35 | 36 | enum class InputLayoutValue { 37 | Position, 38 | Normal, 39 | Texcoord, 40 | Tangent, 41 | Binormal, 42 | Color, 43 | MaxCount 44 | }; 45 | 46 | enum class MessageType { 47 | Error, 48 | Warning, 49 | Message 50 | }; 51 | 52 | class InputLayoutItem { 53 | public: 54 | ed::plugin::InputLayoutValue Value; 55 | char Semantic[64]; 56 | }; 57 | 58 | enum class TextEditorPaletteIndex { 59 | Default, 60 | Keyword, 61 | Number, 62 | String, 63 | CharLiteral, 64 | Punctuation, 65 | Preprocessor, 66 | Identifier, 67 | KnownIdentifier, 68 | PreprocIdentifier, 69 | Comment, 70 | MultiLineComment, 71 | Background, 72 | Cursor, 73 | Selection, 74 | ErrorMarker, 75 | Breakpoint, 76 | BreakpointOutline, 77 | CurrentLineIndicator, 78 | CurrentLineIndicatorOutline, 79 | LineNumber, 80 | CurrentLineFill, 81 | CurrentLineFillInactive, 82 | CurrentLineEdge, 83 | ErrorMessage, 84 | BreakpointDisabled, 85 | UserFunction, 86 | UserType, 87 | UniformVariable, 88 | GlobalVariable, 89 | LocalVariable, 90 | FunctionArgument, 91 | Max 92 | }; 93 | 94 | enum class ShaderStage { 95 | Vertex, 96 | Pixel, 97 | Geometry, 98 | Compute, 99 | Audio, 100 | Plugin, 101 | Count 102 | }; 103 | 104 | struct ShaderMacro { 105 | bool Active; 106 | char Name[32]; 107 | char Value[512]; 108 | }; 109 | 110 | enum class ApplicationEvent 111 | { 112 | PipelineItemCompiled, /* char* itemName, nullptr */ 113 | PipelineItemAdded, /* char* itemName, nullptr */ 114 | PipelineItemDeleted, /* char* itemName, nullptr */ 115 | PipelineItemRenamed, 116 | DebuggerStarted, /* char* itemName, void* editor */ 117 | DebuggerStepped, /* int line, nullptr */ 118 | DebuggerStopped /* nullptr, nullptr */ 119 | /* ETC... */ 120 | }; 121 | } 122 | } -------------------------------------------------------------------------------- /libs/imgui/.editorconfig: -------------------------------------------------------------------------------- 1 | # See http://editorconfig.org to read about the EditorConfig format. 2 | # - Automatically supported by VS2017+ and most common IDE or text editors. 3 | # - For older VS2010 to VS2015, install https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig 4 | 5 | # top-most EditorConfig file 6 | root = true 7 | 8 | # Default settings: 9 | # Use 4 spaces as indentation 10 | [*] 11 | indent_style = space 12 | indent_size = 4 13 | insert_final_newline = true 14 | trim_trailing_whitespace = true 15 | 16 | [imstb_*] 17 | indent_size = 3 18 | trim_trailing_whitespace = false 19 | 20 | [Makefile] 21 | indent_style = tab 22 | indent_size = 4 23 | -------------------------------------------------------------------------------- /libs/imgui/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.c text 4 | *.cpp text 5 | *.h text 6 | *.m text 7 | *.mm text 8 | *.md text 9 | *.txt text 10 | *.html text 11 | *.bat text 12 | *.frag text 13 | *.vert text 14 | *.mkb text 15 | *.icf text 16 | 17 | *.sln text eol=crlf 18 | *.vcxproj text eol=crlf 19 | *.vcxproj.filters text eol=crlf 20 | *.natvis text eol=crlf 21 | 22 | Makefile text eol=lf 23 | *.sh text eol=lf 24 | *.pbxproj text eol=lf 25 | *.storyboard text eol=lf 26 | *.plist text eol=lf 27 | 28 | *.png binary 29 | *.ttf binary 30 | *.lib binary 31 | -------------------------------------------------------------------------------- /libs/imgui/.gitignore: -------------------------------------------------------------------------------- 1 | ## OSX artifacts 2 | .DS_Store 3 | 4 | ## Dear ImGui artifacts 5 | imgui.ini 6 | 7 | ## General build artifacts 8 | *.o 9 | *.obj 10 | *.exe 11 | examples/build/* 12 | examples/*/Debug/* 13 | examples/*/Release/* 14 | examples/*/x64/* 15 | 16 | ## Visual Studio artifacts 17 | .vs 18 | ipch 19 | *.opensdf 20 | *.log 21 | *.pdb 22 | *.ilk 23 | *.user 24 | *.sdf 25 | *.suo 26 | *.VC.db 27 | *.VC.VC.opendb 28 | 29 | ## Xcode artifacts 30 | project.xcworkspace 31 | xcuserdata 32 | 33 | ## Emscripten artifacts 34 | examples/*.o.tmp 35 | examples/*.out.js 36 | examples/*.out.wasm 37 | examples/example_emscripten/example_emscripten.* 38 | 39 | ## JetBrains IDE artifacts 40 | .idea 41 | cmake-build-* 42 | 43 | ## Unix executables from our example Makefiles 44 | examples/example_glfw_opengl2/example_glfw_opengl2 45 | examples/example_glfw_opengl3/example_glfw_opengl3 46 | examples/example_glut_opengl2/example_glut_opengl2 47 | examples/example_null/example_null 48 | examples/example_sdl_opengl2/example_sdl_opengl2 49 | examples/example_sdl_opengl3/example_sdl_opengl3 50 | -------------------------------------------------------------------------------- /libs/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2020 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_allegro5/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Configuration 3 | 4 | Dear ImGui outputs 16-bit vertex indices by default. 5 | Allegro doesn't support them natively, so we have two solutions: convert the indices manually in imgui_impl_allegro5.cpp, or compile dear imgui with 32-bit indices. 6 | You can either modify imconfig.h that comes with Dear ImGui (easier), or set a C++ preprocessor option IMGUI_USER_CONFIG to find to a filename. 7 | We are providing `imconfig_allegro5.h` that enables 32-bit indices. 8 | Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit indices will be slightly faster as they won't require a manual conversion. 9 | 10 | # How to Build 11 | 12 | ### On Ubuntu 14.04+ and macOS 13 | 14 | ```bash 15 | g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp ../imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_main -lallegro_primitives -o allegro5_example 16 | ``` 17 | 18 | On macOS, install Allegro with homebrew: `brew install allegro`. 19 | 20 | ### On Windows with Visual Studio's CLI 21 | 22 | You may install Allegro using vcpkg: 23 | ``` 24 | git clone https://github.com/Microsoft/vcpkg 25 | cd vcpkg 26 | .\bootstrap-vcpkg.bat 27 | .\vcpkg install allegro5 28 | .\vcpkg integrate install ; optional, automatically register include/libs in Visual Studio 29 | ``` 30 | 31 | Build: 32 | ``` 33 | set ALLEGRODIR=path_to_your_allegro5_folder 34 | cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. main.cpp ..\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib 35 | ``` 36 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_allegro5/example_allegro5.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | 50 | 51 | 52 | sources 53 | 54 | 55 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_allegro5/imconfig_allegro5.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI ALLEGRO 5 EXAMPLE 3 | // See imconfig.h for the full template 4 | // Because Allegro doesn't support 16-bit vertex indices, we enable the compile-time option of imgui to use 32-bit indices 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | // Use 32-bit vertex indices because Allegro doesn't support 16-bit ones 10 | // This allows us to avoid converting vertices format at runtime 11 | #define ImDrawIdx int 12 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_allegro5/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for Allegro 5 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | #include 5 | #include 6 | #include 7 | #include "imgui.h" 8 | #include "imgui_impl_allegro5.h" 9 | 10 | int main(int, char**) 11 | { 12 | // Setup Allegro 13 | al_init(); 14 | al_install_keyboard(); 15 | al_install_mouse(); 16 | al_init_primitives_addon(); 17 | al_set_new_display_flags(ALLEGRO_RESIZABLE); 18 | ALLEGRO_DISPLAY* display = al_create_display(1280, 720); 19 | al_set_window_title(display, "Dear ImGui Allegro 5 example"); 20 | ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); 21 | al_register_event_source(queue, al_get_display_event_source(display)); 22 | al_register_event_source(queue, al_get_keyboard_event_source()); 23 | al_register_event_source(queue, al_get_mouse_event_source()); 24 | 25 | // Setup Dear ImGui context 26 | IMGUI_CHECKVERSION(); 27 | ImGui::CreateContext(); 28 | ImGuiIO& io = ImGui::GetIO(); (void)io; 29 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 30 | io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking 31 | 32 | // Setup Dear ImGui style 33 | ImGui::StyleColorsDark(); 34 | //ImGui::StyleColorsClassic(); 35 | 36 | // Setup Platform/Renderer bindings 37 | ImGui_ImplAllegro5_Init(display); 38 | 39 | // Load Fonts 40 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 41 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 42 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 43 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 44 | // - Read 'docs/FONTS.md' for more instructions and details. 45 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 46 | //io.Fonts->AddFontDefault(); 47 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 48 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 49 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 50 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 51 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 52 | //IM_ASSERT(font != NULL); 53 | 54 | bool show_demo_window = true; 55 | bool show_another_window = false; 56 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 57 | 58 | // Main loop 59 | bool running = true; 60 | while (running) 61 | { 62 | // Poll and handle events (inputs, window resize, etc.) 63 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 64 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 65 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 66 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 67 | ALLEGRO_EVENT ev; 68 | while (al_get_next_event(queue, &ev)) 69 | { 70 | ImGui_ImplAllegro5_ProcessEvent(&ev); 71 | if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) 72 | running = false; 73 | if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE) 74 | { 75 | ImGui_ImplAllegro5_InvalidateDeviceObjects(); 76 | al_acknowledge_resize(display); 77 | ImGui_ImplAllegro5_CreateDeviceObjects(); 78 | } 79 | } 80 | 81 | // Start the Dear ImGui frame 82 | ImGui_ImplAllegro5_NewFrame(); 83 | ImGui::NewFrame(); 84 | 85 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 86 | if (show_demo_window) 87 | ImGui::ShowDemoWindow(&show_demo_window); 88 | 89 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 90 | { 91 | static float f = 0.0f; 92 | static int counter = 0; 93 | 94 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 95 | 96 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 97 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 98 | ImGui::Checkbox("Another Window", &show_another_window); 99 | 100 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 101 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 102 | 103 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 104 | counter++; 105 | ImGui::SameLine(); 106 | ImGui::Text("counter = %d", counter); 107 | 108 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 109 | ImGui::End(); 110 | } 111 | 112 | // 3. Show another simple window. 113 | if (show_another_window) 114 | { 115 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 116 | ImGui::Text("Hello from another window!"); 117 | if (ImGui::Button("Close Me")) 118 | show_another_window = false; 119 | ImGui::End(); 120 | } 121 | 122 | // Rendering 123 | ImGui::Render(); 124 | al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w)); 125 | ImGui_ImplAllegro5_RenderDrawData(ImGui::GetDrawData()); 126 | al_flip_display(); 127 | } 128 | 129 | // Cleanup 130 | ImGui_ImplAllegro5_Shutdown(); 131 | ImGui::DestroyContext(); 132 | al_destroy_event_queue(queue); 133 | al_destroy_display(display); 134 | 135 | return 0; 136 | } 137 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/README.md: -------------------------------------------------------------------------------- 1 | # iOS / OSX Metal example 2 | 3 | ## Introduction 4 | 5 | This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9. 6 | 7 | (NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.) 8 | 9 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | 5 | #import 6 | 7 | @interface AppDelegate : UIResponder 8 | @property (strong, nonatomic) UIWindow *window; 9 | @end 10 | 11 | #else 12 | 13 | #import 14 | 15 | @interface AppDelegate : NSObject 16 | @end 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | @implementation AppDelegate 4 | 5 | #if TARGET_OS_OSX 6 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 7 | return YES; 8 | } 9 | #endif 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/Renderer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface Renderer : NSObject 4 | 5 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 6 | 7 | @end 8 | 9 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/Renderer.mm: -------------------------------------------------------------------------------- 1 | #import "Renderer.h" 2 | #import 3 | 4 | #include "imgui.h" 5 | #include "imgui_impl_metal.h" 6 | 7 | #if TARGET_OS_OSX 8 | #include "imgui_impl_osx.h" 9 | #endif 10 | 11 | @interface Renderer () 12 | @property (nonatomic, strong) id device; 13 | @property (nonatomic, strong) id commandQueue; 14 | @end 15 | 16 | @implementation Renderer 17 | 18 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 19 | { 20 | self = [super init]; 21 | if(self) 22 | { 23 | _device = view.device; 24 | _commandQueue = [_device newCommandQueue]; 25 | 26 | IMGUI_CHECKVERSION(); 27 | ImGui::CreateContext(); 28 | ImGui::StyleColorsDark(); 29 | 30 | ImGui_ImplMetal_Init(_device); 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)drawInMTKView:(MTKView *)view 37 | { 38 | ImGuiIO &io = ImGui::GetIO(); 39 | io.DisplaySize.x = view.bounds.size.width; 40 | io.DisplaySize.y = view.bounds.size.height; 41 | 42 | #if TARGET_OS_OSX 43 | CGFloat framebufferScale = view.window.screen.backingScaleFactor ?: NSScreen.mainScreen.backingScaleFactor; 44 | #else 45 | CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale; 46 | #endif 47 | io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale); 48 | 49 | io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60); 50 | 51 | id commandBuffer = [self.commandQueue commandBuffer]; 52 | 53 | static bool show_demo_window = true; 54 | static bool show_another_window = false; 55 | static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f }; 56 | 57 | MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor; 58 | if (renderPassDescriptor != nil) 59 | { 60 | renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]); 61 | 62 | // Here, you could do additional rendering work, including other passes as necessary. 63 | 64 | id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; 65 | [renderEncoder pushDebugGroup:@"ImGui demo"]; 66 | 67 | // Start the Dear ImGui frame 68 | ImGui_ImplMetal_NewFrame(renderPassDescriptor); 69 | #if TARGET_OS_OSX 70 | ImGui_ImplOSX_NewFrame(view); 71 | #endif 72 | ImGui::NewFrame(); 73 | 74 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 75 | if (show_demo_window) 76 | ImGui::ShowDemoWindow(&show_demo_window); 77 | 78 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 79 | { 80 | static float f = 0.0f; 81 | static int counter = 0; 82 | 83 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 84 | 85 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 86 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 87 | ImGui::Checkbox("Another Window", &show_another_window); 88 | 89 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 90 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 91 | 92 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 93 | counter++; 94 | ImGui::SameLine(); 95 | ImGui::Text("counter = %d", counter); 96 | 97 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 98 | ImGui::End(); 99 | } 100 | 101 | // 3. Show another simple window. 102 | if (show_another_window) 103 | { 104 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 105 | ImGui::Text("Hello from another window!"); 106 | if (ImGui::Button("Close Me")) 107 | show_another_window = false; 108 | ImGui::End(); 109 | } 110 | 111 | // Rendering 112 | ImGui::Render(); 113 | ImDrawData *drawData = ImGui::GetDrawData(); 114 | ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder); 115 | 116 | [renderEncoder popDebugGroup]; 117 | [renderEncoder endEncoding]; 118 | 119 | [commandBuffer presentDrawable:view.currentDrawable]; 120 | } 121 | 122 | [commandBuffer commit]; 123 | } 124 | 125 | - (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size 126 | { 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "Renderer.h" 4 | 5 | #if TARGET_OS_IPHONE 6 | 7 | #import 8 | 9 | @interface ViewController : UIViewController 10 | @end 11 | 12 | #else 13 | 14 | #import 15 | 16 | @interface ViewController : NSViewController 17 | @end 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/ViewController.mm: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | #import "Renderer.h" 3 | #include "imgui.h" 4 | 5 | #if TARGET_OS_OSX 6 | #include "imgui_impl_osx.h" 7 | #endif 8 | 9 | @interface ViewController () 10 | @property (nonatomic, readonly) MTKView *mtkView; 11 | @property (nonatomic, strong) Renderer *renderer; 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (MTKView *)mtkView { 17 | return (MTKView *)self.view; 18 | } 19 | 20 | - (void)viewDidLoad 21 | { 22 | [super viewDidLoad]; 23 | 24 | self.mtkView.device = MTLCreateSystemDefaultDevice(); 25 | 26 | if (!self.mtkView.device) { 27 | NSLog(@"Metal is not supported"); 28 | abort(); 29 | } 30 | 31 | self.renderer = [[Renderer alloc] initWithView:self.mtkView]; 32 | 33 | [self.renderer mtkView:self.mtkView drawableSizeWillChange:self.mtkView.bounds.size]; 34 | 35 | self.mtkView.delegate = self.renderer; 36 | 37 | #if TARGET_OS_OSX 38 | // Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view 39 | NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect 40 | options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways 41 | owner:self 42 | userInfo:nil]; 43 | [self.view addTrackingArea:trackingArea]; 44 | 45 | // If we want to receive key events, we either need to be in the responder chain of the key view, 46 | // or else we can install a local monitor. The consequence of this heavy-handed approach is that 47 | // we receive events for all controls, not just Dear ImGui widgets. If we had native controls in our 48 | // window, we'd want to be much more careful than just ingesting the complete event stream, though we 49 | // do make an effort to be good citizens by passing along events when Dear ImGui doesn't want to capture. 50 | NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel; 51 | [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) { 52 | BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view); 53 | if (event.type == NSEventTypeKeyDown && wantsCapture) { 54 | return nil; 55 | } else { 56 | return event; 57 | } 58 | 59 | }]; 60 | 61 | ImGui_ImplOSX_Init(); 62 | #endif 63 | } 64 | 65 | #if TARGET_OS_OSX 66 | 67 | - (void)mouseMoved:(NSEvent *)event { 68 | ImGui_ImplOSX_HandleEvent(event, self.view); 69 | } 70 | 71 | - (void)mouseDown:(NSEvent *)event { 72 | ImGui_ImplOSX_HandleEvent(event, self.view); 73 | } 74 | 75 | - (void)rightMouseDown:(NSEvent *)event { 76 | ImGui_ImplOSX_HandleEvent(event, self.view); 77 | } 78 | 79 | - (void)otherMouseDown:(NSEvent *)event { 80 | ImGui_ImplOSX_HandleEvent(event, self.view); 81 | } 82 | 83 | - (void)mouseUp:(NSEvent *)event { 84 | ImGui_ImplOSX_HandleEvent(event, self.view); 85 | } 86 | 87 | - (void)rightMouseUp:(NSEvent *)event { 88 | ImGui_ImplOSX_HandleEvent(event, self.view); 89 | } 90 | 91 | - (void)otherMouseUp:(NSEvent *)event { 92 | ImGui_ImplOSX_HandleEvent(event, self.view); 93 | } 94 | 95 | - (void)mouseDragged:(NSEvent *)event { 96 | ImGui_ImplOSX_HandleEvent(event, self.view); 97 | } 98 | 99 | - (void)rightMouseDragged:(NSEvent *)event { 100 | ImGui_ImplOSX_HandleEvent(event, self.view); 101 | } 102 | 103 | - (void)otherMouseDragged:(NSEvent *)event { 104 | ImGui_ImplOSX_HandleEvent(event, self.view); 105 | } 106 | 107 | - (void)scrollWheel:(NSEvent *)event { 108 | ImGui_ImplOSX_HandleEvent(event, self.view); 109 | } 110 | 111 | #elif TARGET_OS_IOS 112 | 113 | // This touch mapping is super cheesy/hacky. We treat any touch on the screen 114 | // as if it were a depressed left mouse button, and we don't bother handling 115 | // multitouch correctly at all. This causes the "cursor" to behave very erratically 116 | // when there are multiple active touches. But for demo purposes, single-touch 117 | // interaction actually works surprisingly well. 118 | - (void)updateIOWithTouchEvent:(UIEvent *)event { 119 | UITouch *anyTouch = event.allTouches.anyObject; 120 | CGPoint touchLocation = [anyTouch locationInView:self.view]; 121 | ImGuiIO &io = ImGui::GetIO(); 122 | io.MousePos = ImVec2(touchLocation.x, touchLocation.y); 123 | 124 | BOOL hasActiveTouch = NO; 125 | for (UITouch *touch in event.allTouches) { 126 | if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) { 127 | hasActiveTouch = YES; 128 | break; 129 | } 130 | } 131 | io.MouseDown[0] = hasActiveTouch; 132 | } 133 | 134 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 135 | [self updateIOWithTouchEvent:event]; 136 | } 137 | 138 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 139 | [self updateIOWithTouchEvent:event]; 140 | } 141 | 142 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 143 | [self updateIOWithTouchEvent:event]; 144 | } 145 | 146 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 147 | [self updateIOWithTouchEvent:event]; 148 | } 149 | 150 | #endif 151 | 152 | @end 153 | 154 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/Shared/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #if TARGET_OS_IPHONE 4 | 5 | #import 6 | #import "AppDelegate.h" 7 | 8 | int main(int argc, char * argv[]) { 9 | @autoreleasepool { 10 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 11 | } 12 | } 13 | 14 | #else 15 | 16 | #import 17 | 18 | int main(int argc, const char * argv[]) { 19 | return NSApplicationMain(argc, argv); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/examples/example_apple_metal/iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/iOS/Info-iOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | imgui 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | Launch Screen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | metal 31 | 32 | UIRequiresFullScreen 33 | 34 | UIStatusBarHidden 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | UIInterfaceOrientationPortraitUpsideDown 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/iOS/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_apple_metal/macOS/Info-macOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | imgui 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2018 Warren Moore. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_emscripten/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile to use with emscripten 3 | # See https://emscripten.org/docs/getting_started/downloads.html 4 | # for installation instructions. 5 | # 6 | # This Makefile assumes you have loaded emscripten's environment. 7 | # (On Windows, you may need to execute emsdk_env.bat or encmdprompt.bat ahead) 8 | # 9 | # Running `make` will produce three files: 10 | # - example_emscripten.html 11 | # - example_emscripten.js 12 | # - example_emscripten.wasm 13 | # 14 | # All three are needed to run the demo. 15 | 16 | CC = emcc 17 | CXX = em++ 18 | EXE = example_emscripten.html 19 | SOURCES = main.cpp 20 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp 21 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 22 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 23 | UNAME_S := $(shell uname -s) 24 | 25 | ##--------------------------------------------------------------------- 26 | ## EMSCRIPTEN OPTIONS 27 | ##--------------------------------------------------------------------- 28 | 29 | EMS += -s USE_SDL=2 -s WASM=1 30 | EMS += -s ALLOW_MEMORY_GROWTH=1 31 | EMS += -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=0 32 | EMS += -s ASSERTIONS=1 33 | 34 | # Uncomment next line to fix possible rendering bugs with Emscripten version older then 1.39.0 (https://github.com/ocornut/imgui/issues/2877) 35 | #EMS += -s BINARYEN_TRAP_MODE=clamp 36 | #EMS += -s SAFE_HEAP=1 ## Adds overhead 37 | 38 | # Emscripten allows preloading a file or folder to be accessible at runtime. 39 | # The Makefile for this example project suggests embedding the misc/fonts/ folder into our application, it will then be accessible as "/fonts" 40 | # See documentation for more details: https://emscripten.org/docs/porting/files/packaging_files.html 41 | # (Default value is 0. Set to 1 to enable file-system and include the misc/fonts/ folder as part of the build.) 42 | USE_FILE_SYSTEM ?= 0 43 | ifeq ($(USE_FILE_SYSTEM), 0) 44 | EMS += -s NO_FILESYSTEM=1 -DIMGUI_DISABLE_FILE_FUNCTIONS 45 | endif 46 | ifeq ($(USE_FILE_SYSTEM), 1) 47 | LDFLAGS += --no-heap-copy --preload-file ../../misc/fonts@/fonts 48 | endif 49 | 50 | ##--------------------------------------------------------------------- 51 | ## FINAL BUILD FLAGS 52 | ##--------------------------------------------------------------------- 53 | 54 | CPPFLAGS += -I../ -I../../ 55 | #CPPFLAGS += -g 56 | CPPFLAGS += -Wall -Wformat -Os 57 | CPPFLAGS += $(EMS) 58 | LIBS += $(EMS) 59 | LDFLAGS += --shell-file shell_minimal.html 60 | 61 | ##--------------------------------------------------------------------- 62 | ## BUILD RULES 63 | ##--------------------------------------------------------------------- 64 | 65 | %.o:%.cpp 66 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 67 | 68 | %.o:../%.cpp 69 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 70 | 71 | %.o:../../%.cpp 72 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 73 | 74 | %.o:../libs/gl3w/GL/%.c 75 | $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< 76 | 77 | all: $(EXE) 78 | @echo Build complete for $(EXE) 79 | 80 | $(EXE): $(OBJS) 81 | $(CXX) -o $@ $^ $(LIBS) $(LDFLAGS) 82 | 83 | clean: 84 | rm -f $(EXE) $(OBJS) *.js *.wasm *.wasm.pre 85 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_emscripten/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions 5 | 6 | - Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools. 7 | 8 | - Then build using `make` while in the `example_emscripten/` directory. 9 | 10 | - Note that Emscripten 1.39.0 (October 2019) obsoleted the `BINARYEN_TRAP_MODE=clamp` compilation flag which was required with version older than 1.39.0 to avoid rendering artefacts. See [#2877](https://github.com/ocornut/imgui/issues/2877) for details. If you use an older version, uncomment this line in the Makefile: 11 | 12 | `#EMS += -s BINARYEN_TRAP_MODE=clamp` 13 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_emscripten/shell_minimal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dear ImGui Emscripten example 7 | 29 | 30 | 31 | 32 | 62 | {{{ SCRIPT }}} 63 | 64 | 65 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_metal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # You will need GLFW (http://www.glfw.org): 3 | # brew install glfw 4 | # 5 | 6 | #CXX = g++ 7 | #CXX = clang++ 8 | 9 | EXE = example_glfw_metal 10 | SOURCES = main.mm 11 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_metal.mm 12 | SOURCES += ../../imgui.cpp ../../imgui_widgets.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp 13 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 14 | 15 | LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore 16 | LIBS += -L/usr/local/lib -lglfw 17 | 18 | CXXFLAGS = -I../ -I../../ -I/usr/local/include 19 | CXXFLAGS += -Wall -Wformat 20 | CFLAGS = $(CXXFLAGS) 21 | 22 | %.o:%.cpp 23 | $(CXX) $(CXXFLAGS) -c -o $@ $< 24 | 25 | %.o:../%.cpp 26 | $(CXX) $(CXXFLAGS) -c -o $@ $< 27 | 28 | %.o:../../%.cpp 29 | $(CXX) $(CXXFLAGS) -c -o $@ $< 30 | 31 | %.o:../%.mm 32 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 33 | 34 | %.o:%.mm 35 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 36 | 37 | all: $(EXE) 38 | @echo Build complete 39 | 40 | $(EXE): $(OBJS) 41 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 42 | 43 | clean: 44 | rm -f $(EXE) $(OBJS) 45 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl2 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl2.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## BUILD FLAGS PER PLATFORM 30 | ##--------------------------------------------------------------------- 31 | 32 | ifeq ($(UNAME_S), Linux) #LINUX 33 | ECHO_MESSAGE = "Linux" 34 | LIBS += -lGL `pkg-config --static --libs glfw3` 35 | 36 | CXXFLAGS += `pkg-config --cflags glfw3` 37 | CFLAGS = $(CXXFLAGS) 38 | endif 39 | 40 | ifeq ($(UNAME_S), Darwin) #APPLE 41 | ECHO_MESSAGE = "Mac OS X" 42 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 43 | LIBS += -L/usr/local/lib -L/opt/local/lib 44 | #LIBS += -lglfw3 45 | LIBS += -lglfw 46 | 47 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 48 | CFLAGS = $(CXXFLAGS) 49 | endif 50 | 51 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 52 | ECHO_MESSAGE = "MinGW" 53 | LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 54 | 55 | CXXFLAGS += `pkg-config --cflags glfw3` 56 | CFLAGS = $(CXXFLAGS) 57 | endif 58 | 59 | ##--------------------------------------------------------------------- 60 | ## BUILD RULES 61 | ##--------------------------------------------------------------------- 62 | 63 | %.o:%.cpp 64 | $(CXX) $(CXXFLAGS) -c -o $@ $< 65 | 66 | %.o:../%.cpp 67 | $(CXX) $(CXXFLAGS) -c -o $@ $< 68 | 69 | %.o:../../%.cpp 70 | $(CXX) $(CXXFLAGS) -c -o $@ $< 71 | 72 | all: $(EXE) 73 | @echo Build complete for $(ECHO_MESSAGE) 74 | 75 | $(EXE): $(OBJS) 76 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 77 | 78 | clean: 79 | rm -f $(EXE) $(OBJS) 80 | 81 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_opengl2.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## OPENGL LOADER 30 | ##--------------------------------------------------------------------- 31 | 32 | ## Using OpenGL loader: gl3w [default] 33 | SOURCES += ../libs/gl3w/GL/gl3w.c 34 | CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W 35 | 36 | ## Using OpenGL loader: glew 37 | ## (This assumes a system-wide installation) 38 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW 39 | # LIBS += -lGLEW 40 | 41 | ## Using OpenGL loader: glad 42 | # SOURCES += ../libs/glad/src/glad.c 43 | # CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 44 | 45 | ## Using OpenGL loader: glbinding 46 | ## This assumes a system-wide installation 47 | ## of either version 3.0.0 (or newer) 48 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3 49 | # LIBS += -lglbinding 50 | ## or the older version 2.x 51 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2 52 | # LIBS += -lglbinding 53 | 54 | ##--------------------------------------------------------------------- 55 | ## BUILD FLAGS PER PLATFORM 56 | ##--------------------------------------------------------------------- 57 | 58 | ifeq ($(UNAME_S), Linux) #LINUX 59 | ECHO_MESSAGE = "Linux" 60 | LIBS += -lGL `pkg-config --static --libs glfw3` 61 | 62 | CXXFLAGS += `pkg-config --cflags glfw3` 63 | CFLAGS = $(CXXFLAGS) 64 | endif 65 | 66 | ifeq ($(UNAME_S), Darwin) #APPLE 67 | ECHO_MESSAGE = "Mac OS X" 68 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 69 | LIBS += -L/usr/local/lib -L/opt/local/lib 70 | #LIBS += -lglfw3 71 | LIBS += -lglfw 72 | 73 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 74 | CFLAGS = $(CXXFLAGS) 75 | endif 76 | 77 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 78 | ECHO_MESSAGE = "MinGW" 79 | LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 80 | 81 | CXXFLAGS += `pkg-config --cflags glfw3` 82 | CFLAGS = $(CXXFLAGS) 83 | endif 84 | 85 | ##--------------------------------------------------------------------- 86 | ## BUILD RULES 87 | ##--------------------------------------------------------------------- 88 | 89 | %.o:%.cpp 90 | $(CXX) $(CXXFLAGS) -c -o $@ $< 91 | 92 | %.o:../%.cpp 93 | $(CXX) $(CXXFLAGS) -c -o $@ $< 94 | 95 | %.o:../../%.cpp 96 | $(CXX) $(CXXFLAGS) -c -o $@ $< 97 | 98 | %.o:../libs/gl3w/GL/%.c 99 | $(CC) $(CFLAGS) -c -o $@ $< 100 | 101 | %.o:../libs/glad/src/%.c 102 | $(CC) $(CFLAGS) -c -o $@ $< 103 | 104 | all: $(EXE) 105 | @echo Build complete for $(ECHO_MESSAGE) 106 | 107 | $(EXE): $(OBJS) 108 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 109 | 110 | clean: 111 | rm -f $(EXE) $(OBJS) 112 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {42f99867-3108-43b8-99d0-fabefaf1f2e3} 13 | 14 | 15 | 16 | 17 | sources 18 | 19 | 20 | imgui 21 | 22 | 23 | gl3w 24 | 25 | 26 | imgui 27 | 28 | 29 | imgui 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | gl3w 50 | 51 | 52 | gl3w 53 | 54 | 55 | imgui 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Example usage: 2 | # mkdir build 3 | # cd build 4 | # cmake -g "Visual Studio 14 2015" .. 5 | 6 | cmake_minimum_required(VERSION 2.8) 7 | project(imgui_example_glfw_vulkan C CXX) 8 | 9 | if(NOT CMAKE_BUILD_TYPE) 10 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) 11 | endif() 12 | 13 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") 14 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") 15 | 16 | # GLFW 17 | set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo 18 | option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) 19 | option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) 20 | option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) 21 | option(GLFW_INSTALL "Generate installation target" OFF) 22 | option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) 23 | add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) 24 | include_directories(${GLFW_DIR}/include) 25 | 26 | # Dear ImGui 27 | set(IMGUI_DIR ../../) 28 | include_directories(${IMGUI_DIR} ..) 29 | 30 | # Libraries 31 | find_library(VULKAN_LIBRARY 32 | NAMES vulkan vulkan-1) 33 | set(LIBRARIES "glfw;${VULKAN_LIBRARY}") 34 | 35 | # Use vulkan headers from glfw: 36 | include_directories(${GLFW_DIR}/deps) 37 | 38 | file(GLOB sources *.cpp) 39 | 40 | add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_widgets.cpp) 41 | target_link_libraries(example_glfw_vulkan ${LIBRARIES}) 42 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/build_win64.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/gen_spv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag 3 | glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert 4 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/glsl_shader.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) out vec4 fColor; 3 | 4 | layout(set=0, binding=0) uniform sampler2D sTexture; 5 | 6 | layout(location = 0) in struct { 7 | vec4 Color; 8 | vec2 UV; 9 | } In; 10 | 11 | void main() 12 | { 13 | fColor = In.Color * texture(sTexture, In.UV.st); 14 | } 15 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glfw_vulkan/glsl_shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) in vec2 aPos; 3 | layout(location = 1) in vec2 aUV; 4 | layout(location = 2) in vec4 aColor; 5 | 6 | layout(push_constant) uniform uPushConstant { 7 | vec2 uScale; 8 | vec2 uTranslate; 9 | } pc; 10 | 11 | out gl_PerVertex { 12 | vec4 gl_Position; 13 | }; 14 | 15 | layout(location = 0) out struct { 16 | vec4 Color; 17 | vec2 UV; 18 | } Out; 19 | 20 | void main() 21 | { 22 | Out.Color = aColor; 23 | Out.UV = aUV; 24 | gl_Position = vec4(aPos * pc.uScale + pc.uTranslate, 0, 1); 25 | } 26 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glut_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # Linux: 6 | # apt-get install freeglut3-dev 7 | # 8 | 9 | #CXX = g++ 10 | #CXX = clang++ 11 | 12 | EXE = example_glut_opengl2 13 | SOURCES = main.cpp 14 | SOURCES += ../imgui_impl_glut.cpp ../imgui_impl_opengl2.cpp 15 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 16 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 17 | UNAME_S := $(shell uname -s) 18 | 19 | CXXFLAGS = -I../ -I../../ 20 | CXXFLAGS += -g -Wall -Wformat 21 | LIBS = 22 | 23 | ##--------------------------------------------------------------------- 24 | ## BUILD FLAGS PER PLATFORM 25 | ##--------------------------------------------------------------------- 26 | 27 | ifeq ($(UNAME_S), Linux) #LINUX 28 | ECHO_MESSAGE = "Linux" 29 | LIBS += -lGL -lglut 30 | CFLAGS = $(CXXFLAGS) 31 | endif 32 | 33 | ifeq ($(UNAME_S), Darwin) #APPLE 34 | ECHO_MESSAGE = "Mac OS X" 35 | LIBS += -framework OpenGL -framework GLUT 36 | LIBS += -L/usr/local/lib -L/opt/local/lib 37 | 38 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 39 | CFLAGS = $(CXXFLAGS) 40 | endif 41 | 42 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 43 | ECHO_MESSAGE = "MinGW" 44 | LIBS += -lgdi32 -lopengl32 -limm32 45 | ifeq ($(shell pkg-config freeglut --exists 2> /dev/null && echo yes || echo no),yes) 46 | CXXFLAGS += $(shell pkg-config freeglut --cflags) 47 | LIBS += $(shell pkg-config freeglut --libs) 48 | else 49 | LIBS += -lglut 50 | endif 51 | CFLAGS = $(CXXFLAGS) 52 | endif 53 | 54 | ##--------------------------------------------------------------------- 55 | ## BUILD RULES 56 | ##--------------------------------------------------------------------- 57 | 58 | %.o:%.cpp 59 | $(CXX) $(CXXFLAGS) -c -o $@ $< 60 | 61 | %.o:../%.cpp 62 | $(CXX) $(CXXFLAGS) -c -o $@ $< 63 | 64 | %.o:../../%.cpp 65 | $(CXX) $(CXXFLAGS) -c -o $@ $< 66 | 67 | all: $(EXE) 68 | @echo Build complete for $(ECHO_MESSAGE) 69 | 70 | $(EXE): $(OBJS) 71 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 72 | 73 | clean: 74 | rm -f $(EXE) $(OBJS) 75 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glut_opengl2/example_glut_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_glut_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for GLUT/FreeGLUT + OpenGL2, using legacy fixed pipeline 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | // !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! 5 | // !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!! 6 | // !!! Nowadays, prefer using GLFW or SDL instead! 7 | 8 | #include "imgui.h" 9 | #include "imgui_impl_glut.h" 10 | #include "imgui_impl_opengl2.h" 11 | #ifdef __APPLE__ 12 | #include 13 | #else 14 | #include 15 | #endif 16 | 17 | #ifdef _MSC_VER 18 | #pragma warning (disable: 4505) // unreferenced local function has been removed 19 | #endif 20 | 21 | // Our state 22 | static bool show_demo_window = true; 23 | static bool show_another_window = false; 24 | static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 25 | 26 | void my_display_code() 27 | { 28 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 29 | if (show_demo_window) 30 | ImGui::ShowDemoWindow(&show_demo_window); 31 | 32 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 33 | { 34 | static float f = 0.0f; 35 | static int counter = 0; 36 | 37 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 38 | 39 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 40 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 41 | ImGui::Checkbox("Another Window", &show_another_window); 42 | 43 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 44 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 45 | 46 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 47 | counter++; 48 | ImGui::SameLine(); 49 | ImGui::Text("counter = %d", counter); 50 | 51 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 52 | ImGui::End(); 53 | } 54 | 55 | // 3. Show another simple window. 56 | if (show_another_window) 57 | { 58 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 59 | ImGui::Text("Hello from another window!"); 60 | if (ImGui::Button("Close Me")) 61 | show_another_window = false; 62 | ImGui::End(); 63 | } 64 | } 65 | 66 | void glut_display_func() 67 | { 68 | // Start the Dear ImGui frame 69 | ImGui_ImplOpenGL2_NewFrame(); 70 | ImGui_ImplGLUT_NewFrame(); 71 | 72 | my_display_code(); 73 | 74 | // Rendering 75 | ImGui::Render(); 76 | ImGuiIO& io = ImGui::GetIO(); 77 | glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y); 78 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 79 | glClear(GL_COLOR_BUFFER_BIT); 80 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code. 81 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 82 | 83 | glutSwapBuffers(); 84 | glutPostRedisplay(); 85 | } 86 | 87 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 88 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 89 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 90 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 91 | 92 | int main(int argc, char** argv) 93 | { 94 | // Create GLUT window 95 | glutInit(&argc, argv); 96 | #ifdef __FREEGLUT_EXT_H__ 97 | glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); 98 | #endif 99 | glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); 100 | glutInitWindowSize(1280, 720); 101 | glutCreateWindow("Dear ImGui GLUT+OpenGL2 Example"); 102 | 103 | // Setup GLUT display function 104 | // We will also call ImGui_ImplGLUT_InstallFuncs() to get all the other functions installed for us, 105 | // otherwise it is possible to install our own functions and call the imgui_impl_glut.h functions ourselves. 106 | glutDisplayFunc(glut_display_func); 107 | 108 | // Setup Dear ImGui context 109 | IMGUI_CHECKVERSION(); 110 | ImGui::CreateContext(); 111 | ImGuiIO& io = ImGui::GetIO(); (void)io; 112 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 113 | io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking 114 | 115 | // Setup Dear ImGui style 116 | ImGui::StyleColorsDark(); 117 | //ImGui::StyleColorsClassic(); 118 | 119 | // Setup Platform/Renderer bindings 120 | ImGui_ImplGLUT_Init(); 121 | ImGui_ImplGLUT_InstallFuncs(); 122 | ImGui_ImplOpenGL2_Init(); 123 | 124 | // Load Fonts 125 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 126 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 127 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 128 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 129 | // - Read 'docs/FONTS.md' for more instructions and details. 130 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 131 | //io.Fonts->AddFontDefault(); 132 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 133 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 134 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 135 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 136 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 137 | //IM_ASSERT(font != NULL); 138 | 139 | glutMainLoop(); 140 | 141 | // Cleanup 142 | ImGui_ImplOpenGL2_Shutdown(); 143 | ImGui_ImplGLUT_Shutdown(); 144 | ImGui::DestroyContext(); 145 | 146 | return 0; 147 | } 148 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_marmalade/data/app.icf: -------------------------------------------------------------------------------- 1 | # This file is for configuration settings for your 2 | # application. 3 | # 4 | # The syntax is similar to windows .ini files ie 5 | # 6 | # [GroupName] 7 | # Setting = Value 8 | # 9 | # Which can be read by your application using 10 | # e.g s3eConfigGetString("GroupName", "Setting", string) 11 | # 12 | # All settings must be documented in .config.txt files. 13 | # New settings specific to this application should be 14 | # documented in app.config.txt 15 | # 16 | # Some conditional operations are also permitted, see the 17 | # S3E documentation for details. 18 | 19 | [S3E] 20 | MemSize=6000000 21 | MemSizeDebug=6000000 22 | DispFixRot=FixedLandscape 23 | 24 | # emulate iphone 5 resolution, change these settings to emulate other display resolution 25 | WinWidth=1136 26 | WinHeight=640 27 | 28 | [GX] 29 | DataCacheSize=131070 30 | 31 | [Util] 32 | #MemoryBreakpoint=1282 33 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_marmalade/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: standalone example application for Marmalade 2 | // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | // Copyright (C) 2015 by Giovanni Zito 5 | // This file is part of Dear ImGui 6 | 7 | #include "imgui.h" 8 | #include "imgui_impl_marmalade.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int, char**) 16 | { 17 | IwGxInit(); 18 | 19 | // Setup Dear ImGui context 20 | IMGUI_CHECKVERSION(); 21 | ImGui::CreateContext(); 22 | ImGuiIO& io = ImGui::GetIO(); (void)io; 23 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 24 | io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking 25 | 26 | // Setup Dear ImGui style 27 | ImGui::StyleColorsDark(); 28 | //ImGui::StyleColorsClassic(); 29 | 30 | // Setup Platform/Renderer bindings 31 | ImGui_Marmalade_Init(true); 32 | 33 | // Load Fonts 34 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 35 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 36 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 37 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 38 | // - Read 'docs/FONTS.md' for more instructions and details. 39 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 40 | //io.Fonts->AddFontDefault(); 41 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 42 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 43 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 44 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 45 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 46 | //IM_ASSERT(font != NULL); 47 | 48 | // Our state 49 | bool show_demo_window = true; 50 | bool show_another_window = false; 51 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 52 | 53 | // Main loop 54 | while (true) 55 | { 56 | if (s3eDeviceCheckQuitRequest()) 57 | break; 58 | 59 | // Poll and handle inputs 60 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 61 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 62 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 63 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 64 | s3eKeyboardUpdate(); 65 | s3ePointerUpdate(); 66 | 67 | // Start the Dear ImGui frame 68 | ImGui_Marmalade_NewFrame(); 69 | ImGui::NewFrame(); 70 | 71 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 72 | if (show_demo_window) 73 | ImGui::ShowDemoWindow(&show_demo_window); 74 | 75 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 76 | { 77 | static float f = 0.0f; 78 | static int counter = 0; 79 | 80 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 81 | 82 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 83 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 84 | ImGui::Checkbox("Another Window", &show_another_window); 85 | 86 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 87 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 88 | 89 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 90 | counter++; 91 | ImGui::SameLine(); 92 | ImGui::Text("counter = %d", counter); 93 | 94 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 95 | ImGui::End(); 96 | } 97 | 98 | // 3. Show another simple window. 99 | if (show_another_window) 100 | { 101 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 102 | ImGui::Text("Hello from another window!"); 103 | if (ImGui::Button("Close Me")) 104 | show_another_window = false; 105 | ImGui::End(); 106 | } 107 | 108 | // Rendering 109 | ImGui::Render(); 110 | IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255); 111 | IwGxClear(); 112 | ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData()); 113 | IwGxSwapBuffers(); 114 | 115 | s3eDeviceYield(0); 116 | } 117 | 118 | // Cleanup 119 | ImGui_Marmalade_Shutdown(); 120 | ImGui::DestroyContext(); 121 | IwGxTerminate(); 122 | 123 | return 0; 124 | } 125 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_marmalade/marmalade_example.mkb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env mkb 2 | 3 | # ImGui - standalone example application for Marmalade 4 | # Copyright (C) 2015 by Giovanni Zito 5 | # This file is part of ImGui 6 | # https://github.com/ocornut/imgui 7 | 8 | define IMGUI_DISABLE_INCLUDE_IMCONFIG_H 9 | define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 10 | define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS 11 | define _snprintf=snprintf 12 | 13 | options 14 | { 15 | optimise-speed=1 16 | } 17 | 18 | includepaths 19 | { 20 | .. 21 | ../.. 22 | } 23 | 24 | subprojects 25 | { 26 | iwgx 27 | } 28 | 29 | files 30 | { 31 | (.) 32 | ["imgui"] 33 | ../../imgui.cpp 34 | ../../imgui_demo.cpp 35 | ../../imgui_draw.cpp 36 | ../../imgui_widgets.cpp 37 | ../../imconfig.h 38 | ../../imgui.h 39 | ../../imgui_internal.h 40 | 41 | ["imgui","Marmalade binding"] 42 | ../imgui_impl_marmalade.h 43 | ../imgui_impl_marmalade.cpp 44 | main.cpp 45 | 46 | } 47 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_null/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # Important: This is a "null back-end" application, with no visible output or interaction! 6 | # This is used for testing purpose and continuous integration, and has little use for end-user. 7 | # 8 | 9 | # Options 10 | WITH_EXTRA_WARNINGS ?= 0 11 | WITH_FREETYPE ?= 0 12 | 13 | EXE = example_null 14 | SOURCES = main.cpp 15 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 16 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 17 | UNAME_S := $(shell uname -s) 18 | 19 | CXXFLAGS += -I../ -I../../ 20 | CXXFLAGS += -g -Wall -Wformat 21 | LIBS = 22 | 23 | # We use the WITH_EXTRA_WARNINGS flag on our CI setup to eagerly catch zealous warnings 24 | ifeq ($(WITH_EXTRA_WARNINGS), 1) 25 | CXXFLAGS += -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros 26 | endif 27 | 28 | # We use the WITH_FREETYPE flag on our CI setup to test compiling misc/freetype/imgui_freetype.cpp 29 | # (only supported on Linux, and note that the imgui_freetype code currently won't be executed) 30 | ifeq ($(WITH_FREETYPE), 1) 31 | SOURCES += ../../misc/freetype/imgui_freetype.cpp 32 | CXXFLAGS += $(shell pkg-config --cflags freetype2) 33 | LIBS += $(shell pkg-config --libs freetype2) 34 | endif 35 | 36 | ##--------------------------------------------------------------------- 37 | ## BUILD FLAGS PER PLATFORM 38 | ##--------------------------------------------------------------------- 39 | 40 | ifeq ($(UNAME_S), Linux) #LINUX 41 | ECHO_MESSAGE = "Linux" 42 | ifneq ($(WITH_EXTRA_WARNINGS), 0) 43 | CXXFLAGS += -Wextra -Wpedantic 44 | ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1) 45 | CXXFLAGS += -Wshadow -Wsign-conversion 46 | endif 47 | endif 48 | CFLAGS = $(CXXFLAGS) 49 | endif 50 | 51 | ifeq ($(UNAME_S), Darwin) #APPLE 52 | ECHO_MESSAGE = "Mac OS X" 53 | ifneq ($(WITH_EXTRA_WARNINGS), 0) 54 | CXXFLAGS += -Weverything -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-padded -Wno-c++11-long-long 55 | endif 56 | CFLAGS = $(CXXFLAGS) 57 | endif 58 | 59 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 60 | ECHO_MESSAGE = "MinGW" 61 | ifneq ($(WITH_EXTRA_WARNINGS), 0) 62 | CXXFLAGS += -Wextra -Wpedantic 63 | endif 64 | CFLAGS = $(CXXFLAGS) 65 | endif 66 | 67 | ##--------------------------------------------------------------------- 68 | ## BUILD RULES 69 | ##--------------------------------------------------------------------- 70 | 71 | %.o:%.cpp 72 | $(CXX) $(CXXFLAGS) -c -o $@ $< 73 | 74 | %.o:../%.cpp 75 | $(CXX) $(CXXFLAGS) -c -o $@ $< 76 | 77 | %.o:../../%.cpp 78 | $(CXX) $(CXXFLAGS) -c -o $@ $< 79 | 80 | %.o:../../misc/freetype/%.cpp 81 | $(CXX) $(CXXFLAGS) -c -o $@ $< 82 | 83 | all: $(EXE) 84 | @echo Build complete for $(ECHO_MESSAGE) 85 | 86 | $(EXE): $(OBJS) 87 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 88 | 89 | clean: 90 | rm -f $(EXE) $(OBJS) 91 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_null/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_null/main.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: null/dummy example application 2 | // (compile and link imgui, create context, run headless with NO INPUTS, NO GRAPHICS OUTPUT) 3 | // This is useful to test building, but you cannot interact with anything here! 4 | #include "imgui.h" 5 | #include 6 | 7 | int main(int, char**) 8 | { 9 | IMGUI_CHECKVERSION(); 10 | ImGui::CreateContext(); 11 | ImGuiIO& io = ImGui::GetIO(); 12 | 13 | // Build atlas 14 | unsigned char* tex_pixels = NULL; 15 | int tex_w, tex_h; 16 | io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); 17 | 18 | for (int n = 0; n < 20; n++) 19 | { 20 | printf("NewFrame() %d\n", n); 21 | io.DisplaySize = ImVec2(1920, 1080); 22 | io.DeltaTime = 1.0f / 60.0f; 23 | ImGui::NewFrame(); 24 | 25 | static float f = 0.0f; 26 | ImGui::Text("Hello, world!"); 27 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); 28 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); 29 | ImGui::ShowDemoWindow(NULL); 30 | 31 | ImGui::Render(); 32 | } 33 | 34 | printf("DestroyContext()\n"); 35 | ImGui::DestroyContext(); 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_directx11 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_dx11.cpp ..\..\imgui*.cpp 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_directx11/example_sdl_directx11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | imgui 46 | 47 | 48 | sources 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_metal/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # You will need SDL2 (http://www.libsdl.org): 3 | # brew install sdl2 4 | # 5 | 6 | #CXX = g++ 7 | #CXX = clang++ 8 | 9 | EXE = example_sdl_metal 10 | SOURCES = main.mm 11 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_metal.mm 12 | SOURCES += ../../imgui.cpp ../../imgui_widgets.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp 13 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 14 | 15 | LIBS = -framework Metal -framework MetalKit -framework Cocoa -framework IOKit -framework CoreVideo -framework QuartzCore 16 | LIBS += `sdl2-config --libs` 17 | LIBS += -L/usr/local/lib 18 | 19 | CXXFLAGS = -I../ -I../../ -I/usr/local/include 20 | CXXFLAGS += `sdl2-config --cflags` 21 | CXXFLAGS += -Wall -Wformat 22 | CFLAGS = $(CXXFLAGS) 23 | 24 | %.o:%.cpp 25 | $(CXX) $(CXXFLAGS) -c -o $@ $< 26 | 27 | %.o:../%.cpp 28 | $(CXX) $(CXXFLAGS) -c -o $@ $< 29 | 30 | %.o:../../%.cpp 31 | $(CXX) $(CXXFLAGS) -c -o $@ $< 32 | 33 | %.o:../%.mm 34 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 35 | 36 | %.o:%.mm 37 | $(CXX) $(CXXFLAGS) -ObjC++ -fobjc-weak -fobjc-arc -c -o $@ $< 38 | 39 | all: $(EXE) 40 | @echo Build complete 41 | 42 | $(EXE): $(OBJS) 43 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 44 | 45 | clean: 46 | rm -f $(EXE) $(OBJS) 47 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL2 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl2 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## BUILD FLAGS PER PLATFORM 30 | ##--------------------------------------------------------------------- 31 | 32 | ifeq ($(UNAME_S), Linux) #LINUX 33 | ECHO_MESSAGE = "Linux" 34 | LIBS += -lGL -ldl `sdl2-config --libs` 35 | 36 | CXXFLAGS += `sdl2-config --cflags` 37 | CFLAGS = $(CXXFLAGS) 38 | endif 39 | 40 | ifeq ($(UNAME_S), Darwin) #APPLE 41 | ECHO_MESSAGE = "Mac OS X" 42 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 43 | LIBS += -L/usr/local/lib -L/opt/local/lib 44 | 45 | CXXFLAGS += `sdl2-config --cflags` 46 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 47 | CFLAGS = $(CXXFLAGS) 48 | endif 49 | 50 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 51 | ECHO_MESSAGE = "MinGW" 52 | LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 53 | 54 | CXXFLAGS += `pkg-config --cflags sdl2` 55 | CFLAGS = $(CXXFLAGS) 56 | endif 57 | 58 | ##--------------------------------------------------------------------- 59 | ## BUILD RULES 60 | ##--------------------------------------------------------------------- 61 | 62 | %.o:%.cpp 63 | $(CXX) $(CXXFLAGS) -c -o $@ $< 64 | 65 | %.o:../%.cpp 66 | $(CXX) $(CXXFLAGS) -c -o $@ $< 67 | 68 | %.o:../../%.cpp 69 | $(CXX) $(CXXFLAGS) -c -o $@ $< 70 | 71 | all: $(EXE) 72 | @echo Build complete for $(ECHO_MESSAGE) 73 | 74 | $(EXE): $(OBJS) 75 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 76 | 77 | clean: 78 | rm -f $(EXE) $(OBJS) 79 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl2/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2_DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | # ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries 10 | # or for 64-bit: 11 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 12 | ``` 13 | 14 | - On Linux and similar Unixes 15 | 16 | ``` 17 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL 18 | ``` 19 | 20 | - On Mac OS X 21 | 22 | ``` 23 | brew install sdl2 24 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl 25 | ``` 26 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_opengl2 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL2 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | CXXFLAGS = -I../ -I../../ 25 | CXXFLAGS += -g -Wall -Wformat 26 | LIBS = 27 | 28 | ##--------------------------------------------------------------------- 29 | ## OPENGL LOADER 30 | ##--------------------------------------------------------------------- 31 | 32 | ## Using OpenGL loader: gl3w [default] 33 | SOURCES += ../libs/gl3w/GL/gl3w.c 34 | CXXFLAGS += -I../libs/gl3w -DIMGUI_IMPL_OPENGL_LOADER_GL3W 35 | 36 | ## Using OpenGL loader: glew 37 | ## (This assumes a system-wide installation) 38 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLEW 39 | # LIBS += -lGLEW 40 | 41 | ## Using OpenGL loader: glad 42 | # SOURCES += ../libs/glad/src/glad.c 43 | # CXXFLAGS += -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 44 | 45 | ## Using OpenGL loader: glbinding 46 | ## This assumes a system-wide installation 47 | ## of either version 3.0.0 (or newer) 48 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING3 49 | # LIBS += -lglbinding 50 | ## or the older version 2.x 51 | # CXXFLAGS += -DIMGUI_IMPL_OPENGL_LOADER_GLBINDING2 52 | # LIBS += -lglbinding 53 | 54 | ##--------------------------------------------------------------------- 55 | ## BUILD FLAGS PER PLATFORM 56 | ##--------------------------------------------------------------------- 57 | 58 | ifeq ($(UNAME_S), Linux) #LINUX 59 | ECHO_MESSAGE = "Linux" 60 | LIBS += -lGL -ldl `sdl2-config --libs` 61 | 62 | CXXFLAGS += `sdl2-config --cflags` 63 | CFLAGS = $(CXXFLAGS) 64 | endif 65 | 66 | ifeq ($(UNAME_S), Darwin) #APPLE 67 | ECHO_MESSAGE = "Mac OS X" 68 | LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 69 | LIBS += -L/usr/local/lib -L/opt/local/lib 70 | 71 | CXXFLAGS += `sdl2-config --cflags` 72 | CXXFLAGS += -I/usr/local/include -I/opt/local/include 73 | CFLAGS = $(CXXFLAGS) 74 | endif 75 | 76 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 77 | ECHO_MESSAGE = "MinGW" 78 | LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 79 | 80 | CXXFLAGS += `pkg-config --cflags sdl2` 81 | CFLAGS = $(CXXFLAGS) 82 | endif 83 | 84 | ##--------------------------------------------------------------------- 85 | ## BUILD RULES 86 | ##--------------------------------------------------------------------- 87 | 88 | %.o:%.cpp 89 | $(CXX) $(CXXFLAGS) -c -o $@ $< 90 | 91 | %.o:../%.cpp 92 | $(CXX) $(CXXFLAGS) -c -o $@ $< 93 | 94 | %.o:../../%.cpp 95 | $(CXX) $(CXXFLAGS) -c -o $@ $< 96 | 97 | %.o:../libs/gl3w/GL/%.c 98 | $(CC) $(CFLAGS) -c -o $@ $< 99 | 100 | %.o:../libs/glad/src/%.c 101 | $(CC) $(CFLAGS) -c -o $@ $< 102 | 103 | all: $(EXE) 104 | @echo Build complete for $(ECHO_MESSAGE) 105 | 106 | $(EXE): $(OBJS) 107 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 108 | 109 | clean: 110 | rm -f $(EXE) $(OBJS) 111 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl3/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2_DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | # ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries 10 | # or for 64-bit: 11 | cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 12 | ``` 13 | 14 | - On Linux and similar Unixes 15 | 16 | ``` 17 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl 18 | ``` 19 | 20 | - On Mac OS X 21 | 22 | ``` 23 | brew install sdl2 24 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation 25 | ``` 26 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | set OUT_DIR=Debug 3 | set OUT_EXE=example_sdl_opengl3 4 | set INCLUDES=/I.. /I..\.. /I%SDL2_DIR%\include /I..\libs\gl3w 5 | set SOURCES=main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c 6 | set LIBS=/libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib 7 | mkdir %OUT_DIR% 8 | cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console 9 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {f9997b32-5479-4756-9ffc-77793ad3764f} 13 | 14 | 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | gl3w 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | imgui 50 | 51 | 52 | gl3w 53 | 54 | 55 | gl3w 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx10/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_win32.cpp ..\imgui_impl_dx10.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx10.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx11.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx11.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx12/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx12.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx12.exe /FoDebug/ /link d3d12.lib d3dcompiler.lib dxgi.lib 4 | 5 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fb3d294f-51ec-478e-a627-25831c80fefd} 6 | 7 | 8 | {4f33ddea-9910-456d-b868-4267eb3c2b19} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx9/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%DXSDK_DIR%/Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx9.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx9.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib 4 | -------------------------------------------------------------------------------- /libs/imgui/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {a82cba23-9de0-45c2-b1e3-2eb1666702de} 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_allegro5.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer + Platform Binding for Allegro 5 2 | // (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Platform: Clipboard support (from Allegro 5.1.12) 7 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 8 | // Issues: 9 | // [ ] Renderer: The renderer is suboptimal as we need to unindex our buffers and convert vertices manually. 10 | // [ ] Platform: Missing gamepad support. 11 | 12 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 13 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 14 | // https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd 15 | 16 | #pragma once 17 | #include "imgui.h" // IMGUI_IMPL_API 18 | 19 | struct ALLEGRO_DISPLAY; 20 | union ALLEGRO_EVENT; 21 | 22 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display); 23 | IMGUI_IMPL_API void ImGui_ImplAllegro5_Shutdown(); 24 | IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame(); 25 | IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); 26 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); 27 | 28 | // Use if you want to reset your rendering device without losing Dear ImGui state. 29 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); 30 | IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); 31 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_dx10.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX10 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 10 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct ID3D10Device; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); 19 | IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects(); 25 | IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX11 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 10 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct ID3D11Device; 17 | struct ID3D11DeviceContext; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Use if you want to reset your rendering device without losing Dear ImGui state. 25 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 26 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 27 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_dx12.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX12 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | // Missing features, issues: 9 | // [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 12 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui 14 | 15 | #pragma once 16 | #include "imgui.h" // IMGUI_IMPL_API 17 | 18 | enum DXGI_FORMAT; 19 | struct ID3D12Device; 20 | struct ID3D12DescriptorHeap; 21 | struct ID3D12GraphicsCommandList; 22 | struct D3D12_CPU_DESCRIPTOR_HANDLE; 23 | struct D3D12_GPU_DESCRIPTOR_HANDLE; 24 | 25 | // cmd_list is the command list that the implementation will use to render imgui draw lists. 26 | // Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate 27 | // render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle. 28 | // font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture. 29 | IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap, 30 | D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle); 31 | IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); 32 | IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); 33 | IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); 34 | 35 | // Use if you want to reset your rendering device without losing Dear ImGui state. 36 | IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects(); 37 | IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(); 38 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX9 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 10 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | #pragma once 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | struct IDirect3DDevice9; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 19 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing Dear ImGui state. 24 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. 9 | // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). 10 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 11 | 12 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 13 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 14 | // https://github.com/ocornut/imgui 15 | 16 | // About GLSL version: 17 | // The 'glsl_version' initialization parameter defaults to "#version 150" if NULL. 18 | // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! 19 | 20 | #pragma once 21 | #include "imgui.h" // IMGUI_IMPL_API 22 | 23 | struct GLFWwindow; 24 | struct GLFWmonitor; 25 | 26 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 27 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 28 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 29 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 30 | 31 | // GLFW callbacks 32 | // - When calling Init with 'install_callbacks=true': GLFW callbacks will be installed for you. They will call user's previously installed callbacks, if any. 33 | // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call those function yourself from your own GLFW callbacks. 34 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 35 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 36 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 37 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 38 | IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event); 39 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_glut.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for GLUT/FreeGLUT 2 | // This needs to be used along with a Renderer (e.g. OpenGL2) 3 | 4 | // !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! 5 | // !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!! 6 | // !!! Nowadays, prefer using GLFW or SDL instead! 7 | 8 | // Issues: 9 | // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I 10 | // [ ] Platform: Missing mouse cursor shape/visibility support. 11 | // [ ] Platform: Missing clipboard support (not supported by Glut). 12 | // [ ] Platform: Missing gamepad support. 13 | 14 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 15 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 16 | // https://github.com/ocornut/imgui 17 | 18 | // CHANGELOG 19 | // (minor and older changes stripped away, please see git history for details) 20 | // 2019-04-03: Misc: Renamed imgui_impl_freeglut.cpp/.h to imgui_impl_glut.cpp/.h. 21 | // 2019-03-25: Misc: Made io.DeltaTime always above zero. 22 | // 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window. 23 | // 2018-03-22: Added GLUT Platform binding. 24 | 25 | #include "imgui.h" 26 | #include "imgui_impl_glut.h" 27 | #ifdef __APPLE__ 28 | #include 29 | #else 30 | #include 31 | #endif 32 | 33 | #ifdef _MSC_VER 34 | #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) 35 | #endif 36 | 37 | static int g_Time = 0; // Current time, in milliseconds 38 | 39 | bool ImGui_ImplGLUT_Init() 40 | { 41 | ImGuiIO& io = ImGui::GetIO(); 42 | 43 | #ifdef FREEGLUT 44 | io.BackendPlatformName = "imgui_impl_glut (freeglut)"; 45 | #else 46 | io.BackendPlatformName = "imgui_impl_glut"; 47 | #endif 48 | 49 | g_Time = 0; 50 | 51 | // Glut has 1 function for characters and one for "special keys". We map the characters in the 0..255 range and the keys above. 52 | io.KeyMap[ImGuiKey_Tab] = '\t'; // == 9 == CTRL+I 53 | io.KeyMap[ImGuiKey_LeftArrow] = 256 + GLUT_KEY_LEFT; 54 | io.KeyMap[ImGuiKey_RightArrow] = 256 + GLUT_KEY_RIGHT; 55 | io.KeyMap[ImGuiKey_UpArrow] = 256 + GLUT_KEY_UP; 56 | io.KeyMap[ImGuiKey_DownArrow] = 256 + GLUT_KEY_DOWN; 57 | io.KeyMap[ImGuiKey_PageUp] = 256 + GLUT_KEY_PAGE_UP; 58 | io.KeyMap[ImGuiKey_PageDown] = 256 + GLUT_KEY_PAGE_DOWN; 59 | io.KeyMap[ImGuiKey_Home] = 256 + GLUT_KEY_HOME; 60 | io.KeyMap[ImGuiKey_End] = 256 + GLUT_KEY_END; 61 | io.KeyMap[ImGuiKey_Insert] = 256 + GLUT_KEY_INSERT; 62 | io.KeyMap[ImGuiKey_Delete] = 127; 63 | io.KeyMap[ImGuiKey_Backspace] = 8; // == CTRL+H 64 | io.KeyMap[ImGuiKey_Space] = ' '; 65 | io.KeyMap[ImGuiKey_Enter] = 13; // == CTRL+M 66 | io.KeyMap[ImGuiKey_Escape] = 27; 67 | io.KeyMap[ImGuiKey_KeyPadEnter] = 13; // == CTRL+M 68 | io.KeyMap[ImGuiKey_A] = 'A'; 69 | io.KeyMap[ImGuiKey_C] = 'C'; 70 | io.KeyMap[ImGuiKey_V] = 'V'; 71 | io.KeyMap[ImGuiKey_X] = 'X'; 72 | io.KeyMap[ImGuiKey_Y] = 'Y'; 73 | io.KeyMap[ImGuiKey_Z] = 'Z'; 74 | 75 | return true; 76 | } 77 | 78 | void ImGui_ImplGLUT_InstallFuncs() 79 | { 80 | glutReshapeFunc(ImGui_ImplGLUT_ReshapeFunc); 81 | glutMotionFunc(ImGui_ImplGLUT_MotionFunc); 82 | glutPassiveMotionFunc(ImGui_ImplGLUT_MotionFunc); 83 | glutMouseFunc(ImGui_ImplGLUT_MouseFunc); 84 | #ifdef __FREEGLUT_EXT_H__ 85 | glutMouseWheelFunc(ImGui_ImplGLUT_MouseWheelFunc); 86 | #endif 87 | glutKeyboardFunc(ImGui_ImplGLUT_KeyboardFunc); 88 | glutKeyboardUpFunc(ImGui_ImplGLUT_KeyboardUpFunc); 89 | glutSpecialFunc(ImGui_ImplGLUT_SpecialFunc); 90 | glutSpecialUpFunc(ImGui_ImplGLUT_SpecialUpFunc); 91 | } 92 | 93 | void ImGui_ImplGLUT_Shutdown() 94 | { 95 | } 96 | 97 | void ImGui_ImplGLUT_NewFrame() 98 | { 99 | // Setup time step 100 | ImGuiIO& io = ImGui::GetIO(); 101 | int current_time = glutGet(GLUT_ELAPSED_TIME); 102 | int delta_time_ms = (current_time - g_Time); 103 | if (delta_time_ms <= 0) 104 | delta_time_ms = 1; 105 | io.DeltaTime = delta_time_ms / 1000.0f; 106 | g_Time = current_time; 107 | 108 | // Start the frame 109 | ImGui::NewFrame(); 110 | } 111 | 112 | static void ImGui_ImplGLUT_UpdateKeyboardMods() 113 | { 114 | ImGuiIO& io = ImGui::GetIO(); 115 | int mods = glutGetModifiers(); 116 | io.KeyCtrl = (mods & GLUT_ACTIVE_CTRL) != 0; 117 | io.KeyShift = (mods & GLUT_ACTIVE_SHIFT) != 0; 118 | io.KeyAlt = (mods & GLUT_ACTIVE_ALT) != 0; 119 | } 120 | 121 | void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y) 122 | { 123 | // Send character to imgui 124 | //printf("char_down_func %d '%c'\n", c, c); 125 | ImGuiIO& io = ImGui::GetIO(); 126 | if (c >= 32) 127 | io.AddInputCharacter((unsigned int)c); 128 | 129 | // Store letters in KeysDown[] array as both uppercase and lowercase + Handle GLUT translating CTRL+A..CTRL+Z as 1..26. 130 | // This is a hacky mess but GLUT is unable to distinguish e.g. a TAB key from CTRL+I so this is probably the best we can do here. 131 | if (c >= 1 && c <= 26) 132 | io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = true; 133 | else if (c >= 'a' && c <= 'z') 134 | io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = true; 135 | else if (c >= 'A' && c <= 'Z') 136 | io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = true; 137 | else 138 | io.KeysDown[c] = true; 139 | ImGui_ImplGLUT_UpdateKeyboardMods(); 140 | (void)x; (void)y; // Unused 141 | } 142 | 143 | void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y) 144 | { 145 | //printf("char_up_func %d '%c'\n", c, c); 146 | ImGuiIO& io = ImGui::GetIO(); 147 | if (c >= 1 && c <= 26) 148 | io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = false; 149 | else if (c >= 'a' && c <= 'z') 150 | io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = false; 151 | else if (c >= 'A' && c <= 'Z') 152 | io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = false; 153 | else 154 | io.KeysDown[c] = false; 155 | ImGui_ImplGLUT_UpdateKeyboardMods(); 156 | (void)x; (void)y; // Unused 157 | } 158 | 159 | void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y) 160 | { 161 | //printf("key_down_func %d\n", key); 162 | ImGuiIO& io = ImGui::GetIO(); 163 | if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) 164 | io.KeysDown[key + 256] = true; 165 | ImGui_ImplGLUT_UpdateKeyboardMods(); 166 | (void)x; (void)y; // Unused 167 | } 168 | 169 | void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y) 170 | { 171 | //printf("key_up_func %d\n", key); 172 | ImGuiIO& io = ImGui::GetIO(); 173 | if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) 174 | io.KeysDown[key + 256] = false; 175 | ImGui_ImplGLUT_UpdateKeyboardMods(); 176 | (void)x; (void)y; // Unused 177 | } 178 | 179 | void ImGui_ImplGLUT_MouseFunc(int glut_button, int state, int x, int y) 180 | { 181 | ImGuiIO& io = ImGui::GetIO(); 182 | io.MousePos = ImVec2((float)x, (float)y); 183 | int button = -1; 184 | if (glut_button == GLUT_LEFT_BUTTON) button = 0; 185 | if (glut_button == GLUT_RIGHT_BUTTON) button = 1; 186 | if (glut_button == GLUT_MIDDLE_BUTTON) button = 2; 187 | if (button != -1 && state == GLUT_DOWN) 188 | io.MouseDown[button] = true; 189 | if (button != -1 && state == GLUT_UP) 190 | io.MouseDown[button] = false; 191 | } 192 | 193 | #ifdef __FREEGLUT_EXT_H__ 194 | void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y) 195 | { 196 | ImGuiIO& io = ImGui::GetIO(); 197 | io.MousePos = ImVec2((float)x, (float)y); 198 | if (dir > 0) 199 | io.MouseWheel += 1.0; 200 | else if (dir < 0) 201 | io.MouseWheel -= 1.0; 202 | (void)button; // Unused 203 | } 204 | #endif 205 | 206 | void ImGui_ImplGLUT_ReshapeFunc(int w, int h) 207 | { 208 | ImGuiIO& io = ImGui::GetIO(); 209 | io.DisplaySize = ImVec2((float)w, (float)h); 210 | } 211 | 212 | void ImGui_ImplGLUT_MotionFunc(int x, int y) 213 | { 214 | ImGuiIO& io = ImGui::GetIO(); 215 | io.MousePos = ImVec2((float)x, (float)y); 216 | } 217 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_glut.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for GLUT/FreeGLUT 2 | // This needs to be used along with a Renderer (e.g. OpenGL2) 3 | 4 | // !!! GLUT/FreeGLUT IS OBSOLETE SOFTWARE. Using GLUT is not recommended unless you really miss the 90's. !!! 5 | // !!! If someone or something is teaching you GLUT in 2020, you are being abused. Please show some resistance. !!! 6 | // !!! Nowadays, prefer using GLFW or SDL instead! 7 | 8 | // Issues: 9 | // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I 10 | // [ ] Platform: Missing mouse cursor shape/visibility support. 11 | // [ ] Platform: Missing clipboard support (not supported by Glut). 12 | // [ ] Platform: Missing gamepad support. 13 | 14 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 15 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 16 | // https://github.com/ocornut/imgui 17 | 18 | #pragma once 19 | #include "imgui.h" // IMGUI_IMPL_API 20 | 21 | IMGUI_IMPL_API bool ImGui_ImplGLUT_Init(); 22 | IMGUI_IMPL_API void ImGui_ImplGLUT_InstallFuncs(); 23 | IMGUI_IMPL_API void ImGui_ImplGLUT_Shutdown(); 24 | IMGUI_IMPL_API void ImGui_ImplGLUT_NewFrame(); 25 | 26 | // You can call ImGui_ImplGLUT_InstallFuncs() to get all those functions installed automatically, 27 | // or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency.. 28 | //---------------------------------------- GLUT name --------------------------------------------- Decent Name --------- 29 | IMGUI_IMPL_API void ImGui_ImplGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc 30 | IMGUI_IMPL_API void ImGui_ImplGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc 31 | IMGUI_IMPL_API void ImGui_ImplGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc 32 | IMGUI_IMPL_API void ImGui_ImplGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc 33 | IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc 34 | IMGUI_IMPL_API void ImGui_ImplGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc 35 | IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc 36 | IMGUI_IMPL_API void ImGui_ImplGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc 37 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_marmalade.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer + Platform Binding for Marmalade + IwGx 2 | // Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID! 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | #pragma once 12 | #include "imgui.h" // IMGUI_IMPL_API 13 | 14 | IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); 15 | IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); 16 | IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); 17 | IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data); 18 | 19 | // Use if you want to reset your rendering device without losing Dear ImGui state. 20 | IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects(); 21 | IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects(); 22 | 23 | // Callbacks (installed by default if you enable 'install_callbacks' during initialization) 24 | // You can also handle inputs yourself and use those as a reference. 25 | IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data); 26 | IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data); 27 | IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data); 28 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_metal.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for Metal 2 | // This needs to be used along with a Platform Binding (e.g. OSX) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 7 | // Missing features: 8 | // [ ] Renderer: Multi-viewport / platform windows. 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 11 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 12 | // https://github.com/ocornut/imgui 13 | 14 | #include "imgui.h" // IMGUI_IMPL_API 15 | 16 | @class MTLRenderPassDescriptor; 17 | @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id device); 20 | IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor* renderPassDescriptor); 22 | IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, 23 | id commandBuffer, 24 | id commandEncoder); 25 | 26 | // Called by Init/NewFrame/Shutdown 27 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id device); 28 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture(); 29 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id device); 30 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects(); 31 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_opengl2.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for OpenGL2 (legacy OpenGL, fixed pipeline) 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! 6 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 13 | // **Prefer using the code in imgui_impl_opengl3.cpp** 14 | // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read. 15 | // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more 16 | // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might 17 | // confuse your GPU driver. 18 | // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. 19 | 20 | #pragma once 21 | #include "imgui.h" // IMGUI_IMPL_API 22 | 23 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); 24 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); 25 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); 26 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data); 27 | 28 | // Called by Init/NewFrame/Shutdown 29 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture(); 30 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture(); 31 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects(); 32 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects(); 33 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline 2 | // - Desktop GL: 2.x 3.x 4.x 3 | // - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0) 4 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 5 | 6 | // Implemented features: 7 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID! 8 | // [X] Renderer: Multi-viewport support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 9 | // [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices. 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 12 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui 14 | 15 | // About Desktop OpenGL function loaders: 16 | // Modern Desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers. 17 | // Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad). 18 | // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. 19 | 20 | // About GLSL version: 21 | // The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string. 22 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es" 23 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. 24 | 25 | #pragma once 26 | #include // IMGUI_IMPL_API 27 | 28 | // Backend API 29 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 30 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 31 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 32 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 33 | 34 | // (Optional) Called by Init/NewFrame/Shutdown 35 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 36 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 37 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 38 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 39 | 40 | // Specific OpenGL ES versions 41 | //#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten 42 | //#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android 43 | 44 | // Attempt to auto-detect the default Desktop GL loader based on available header files. 45 | // If auto-detection fails or doesn't select the same GL loader file as used by your application, 46 | // you are likely to get a crash in ImGui_ImplOpenGL3_Init(). 47 | // You can explicitly select a loader by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line. 48 | #if !defined(IMGUI_IMPL_OPENGL_ES2) \ 49 | && !defined(IMGUI_IMPL_OPENGL_ES3) \ 50 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \ 51 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \ 52 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \ 53 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) \ 54 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) \ 55 | && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) 56 | 57 | // Try to detect GLES on matching platforms 58 | #if defined(__APPLE__) 59 | #include "TargetConditionals.h" 60 | #endif 61 | #if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__)) 62 | #define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es" 63 | #elif defined(__EMSCRIPTEN__) 64 | #define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100" 65 | 66 | // Otherwise try to detect supported Desktop OpenGL loaders.. 67 | #elif defined(__has_include) 68 | #if __has_include() 69 | #define IMGUI_IMPL_OPENGL_LOADER_GLEW 70 | #elif __has_include() 71 | #define IMGUI_IMPL_OPENGL_LOADER_GLAD 72 | #elif __has_include() 73 | #define IMGUI_IMPL_OPENGL_LOADER_GL3W 74 | #elif __has_include() 75 | #define IMGUI_IMPL_OPENGL_LOADER_GLBINDING3 76 | #elif __has_include() 77 | #define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2 78 | #else 79 | #error "Cannot detect OpenGL loader!" 80 | #endif 81 | #else 82 | #define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W embedded in our repository 83 | #endif 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_osx.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for OSX / Cocoa 2 | // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) 3 | // [ALPHA] Early bindings, not well tested. If you want a portable application, prefer using the GLFW or SDL platform bindings on Mac. 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this back-end). 8 | // Issues: 9 | // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. 10 | // [ ] Platform: Multi-viewport / platform windows. 11 | 12 | #include "imgui.h" // IMGUI_IMPL_API 13 | 14 | @class NSEvent; 15 | @class NSView; 16 | 17 | IMGUI_IMPL_API bool ImGui_ImplOSX_Init(); 18 | IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown(); 19 | IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view); 20 | IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent* _Nonnull event, NSView* _Nullable view); 21 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 10 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 11 | // Missing features: 12 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 13 | // [ ] Platform: Multi-viewport + Minimized windows seems to break mouse wheel events (at least under Windows). 14 | 15 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 16 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 17 | // https://github.com/ocornut/imgui 18 | 19 | #pragma once 20 | #include // IMGUI_IMPL_API 21 | 22 | struct SDL_Window; 23 | typedef union SDL_Event SDL_Event; 24 | 25 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 26 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 27 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window); 28 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window); 29 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 30 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 31 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event); 32 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_vulkan.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for Vulkan 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices. 6 | // Missing features: 7 | // [ ] Platform: Multi-viewport / platform windows. 8 | // [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914 9 | 10 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 11 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 12 | // https://github.com/ocornut/imgui 13 | 14 | // The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification. 15 | // IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/ 16 | 17 | // Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app. 18 | // - Common ImGui_ImplVulkan_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h. 19 | // You will use those if you want to use this rendering back-end in your engine/app. 20 | // - Helper ImGui_ImplVulkanH_XXX functions and structures are only used by this example (main.cpp) and by 21 | // the back-end itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code. 22 | // Read comments in imgui_impl_vulkan.h. 23 | 24 | #pragma once 25 | #include "imgui.h" // IMGUI_IMPL_API 26 | #include 27 | 28 | // Initialization data, for ImGui_ImplVulkan_Init() 29 | // [Please zero-clear before use!] 30 | struct ImGui_ImplVulkan_InitInfo 31 | { 32 | VkInstance Instance; 33 | VkPhysicalDevice PhysicalDevice; 34 | VkDevice Device; 35 | uint32_t QueueFamily; 36 | VkQueue Queue; 37 | VkPipelineCache PipelineCache; 38 | VkDescriptorPool DescriptorPool; 39 | uint32_t MinImageCount; // >= 2 40 | uint32_t ImageCount; // >= MinImageCount 41 | VkSampleCountFlagBits MSAASamples; // >= VK_SAMPLE_COUNT_1_BIT 42 | const VkAllocationCallbacks* Allocator; 43 | void (*CheckVkResultFn)(VkResult err); 44 | }; 45 | 46 | // Called by user code 47 | IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass); 48 | IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown(); 49 | IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame(); 50 | IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer); 51 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer); 52 | IMGUI_IMPL_API void ImGui_ImplVulkan_DestroyFontUploadObjects(); 53 | IMGUI_IMPL_API void ImGui_ImplVulkan_SetMinImageCount(uint32_t min_image_count); // To override MinImageCount after initialization (e.g. if swap chain is recreated) 54 | 55 | 56 | //------------------------------------------------------------------------- 57 | // Internal / Miscellaneous Vulkan Helpers 58 | // (Used by example's main.cpp. Used by multi-viewport features. PROBABLY NOT used by your own engine/app.) 59 | //------------------------------------------------------------------------- 60 | // You probably do NOT need to use or care about those functions. 61 | // Those functions only exist because: 62 | // 1) they facilitate the readability and maintenance of the multiple main.cpp examples files. 63 | // 2) the multi-viewport / platform window implementation needs them internally. 64 | // Generally we avoid exposing any kind of superfluous high-level helpers in the bindings, 65 | // but it is too much code to duplicate everywhere so we exceptionally expose them. 66 | // 67 | // Your engine/app will likely _already_ have code to setup all that stuff (swap chain, render pass, frame buffers, etc.). 68 | // You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work. 69 | // (The ImGui_ImplVulkanH_XXX functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions) 70 | //------------------------------------------------------------------------- 71 | 72 | struct ImGui_ImplVulkanH_Frame; 73 | struct ImGui_ImplVulkanH_Window; 74 | 75 | // Helpers 76 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateOrResizeWindow(VkInstance instance, VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_Window* wnd, uint32_t queue_family, const VkAllocationCallbacks* allocator, int w, int h, uint32_t min_image_count); 77 | IMGUI_IMPL_API void ImGui_ImplVulkanH_DestroyWindow(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_Window* wnd, const VkAllocationCallbacks* allocator); 78 | IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space); 79 | IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count); 80 | IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode); 81 | 82 | // Helper structure to hold the data needed by one rendering frame 83 | // (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.) 84 | // [Please zero-clear before use!] 85 | struct ImGui_ImplVulkanH_Frame 86 | { 87 | VkCommandPool CommandPool; 88 | VkCommandBuffer CommandBuffer; 89 | VkFence Fence; 90 | VkImage Backbuffer; 91 | VkImageView BackbufferView; 92 | VkFramebuffer Framebuffer; 93 | }; 94 | 95 | struct ImGui_ImplVulkanH_FrameSemaphores 96 | { 97 | VkSemaphore ImageAcquiredSemaphore; 98 | VkSemaphore RenderCompleteSemaphore; 99 | }; 100 | 101 | // Helper structure to hold the data needed by one rendering context into one OS window 102 | // (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.) 103 | struct ImGui_ImplVulkanH_Window 104 | { 105 | int Width; 106 | int Height; 107 | VkSwapchainKHR Swapchain; 108 | VkSurfaceKHR Surface; 109 | VkSurfaceFormatKHR SurfaceFormat; 110 | VkPresentModeKHR PresentMode; 111 | VkRenderPass RenderPass; 112 | bool ClearEnable; 113 | VkClearValue ClearValue; 114 | uint32_t FrameIndex; // Current frame being rendered to (0 <= FrameIndex < FrameInFlightCount) 115 | uint32_t ImageCount; // Number of simultaneous in-flight frames (returned by vkGetSwapchainImagesKHR, usually derived from min_image_count) 116 | uint32_t SemaphoreIndex; // Current set of swapchain wait semaphores we're using (needs to be distinct from per frame data) 117 | ImGui_ImplVulkanH_Frame* Frames; 118 | ImGui_ImplVulkanH_FrameSemaphores* FrameSemaphores; 119 | 120 | ImGui_ImplVulkanH_Window() 121 | { 122 | memset(this, 0, sizeof(*this)); 123 | PresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR; 124 | ClearEnable = true; 125 | } 126 | }; 127 | 128 | -------------------------------------------------------------------------------- /libs/imgui/examples/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 9 | // [X] Platform: Multi-viewport support (multiple windows). Enable with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. 10 | 11 | #pragma once 12 | #include "imgui.h" // IMGUI_IMPL_API 13 | 14 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 15 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 16 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 17 | 18 | // Configuration 19 | // - Disable gamepad support or linking with xinput.lib 20 | //#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD 21 | //#define IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT 22 | 23 | // Win32 message handler your application need to call. 24 | // - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on from this helper. 25 | // - You should COPY the line below into your .cpp code to forward declare the function and then you can call it. 26 | #if 0 27 | extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 28 | #endif 29 | 30 | // DPI-related helpers (optional) 31 | // - Use to enable DPI awareness without having to create an application manifest. 32 | // - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps. 33 | // - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc. 34 | // but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime, 35 | // neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies. 36 | IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness(); 37 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd 38 | IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor 39 | -------------------------------------------------------------------------------- /libs/imgui/examples/libs/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /libs/imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib -------------------------------------------------------------------------------- /libs/imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib -------------------------------------------------------------------------------- /libs/imgui/examples/libs/usynergy/README.txt: -------------------------------------------------------------------------------- 1 | 2 | uSynergy client -- Implementation for the embedded Synergy client library 3 | version 1.0.0, July 7th, 2012 4 | Copyright (c) 2012 Alex Evans 5 | 6 | This is a copy of the files once found at: 7 | https://github.com/symless/synergy-core/tree/790d108a56ada9caad8e56ff777d444485a69da9/src/micro 8 | 9 | -------------------------------------------------------------------------------- /libs/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/branch with your modifications to imconfig.h) 7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" 8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include 9 | // 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. 10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 12 | //----------------------------------------------------------------------------- 13 | 14 | #pragma once 15 | 16 | //---- Define assertion handler. Defaults to calling assert(). 17 | // 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. 18 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 19 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 20 | 21 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows 22 | // 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. 23 | //#define IMGUI_API __declspec( dllexport ) 24 | //#define IMGUI_API __declspec( dllimport ) 25 | 26 | //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 27 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 28 | 29 | //---- Disable all of Dear ImGui or don't implement standard windows. 30 | // It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. 31 | //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. 32 | //#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. 33 | //#define IMGUI_DISABLE_METRICS_WINDOW // Disable debug/metrics window: ShowMetricsWindow() will be empty. 34 | 35 | //---- Don't implement some functions to reduce linkage requirements. 36 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 37 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 38 | //#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime). 39 | //#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). 40 | //#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) 41 | //#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself. 42 | //#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite 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. 43 | //#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(). 44 | 45 | //---- Include imgui_user.h at the end of imgui.h as a convenience 46 | //#define IMGUI_INCLUDE_IMGUI_USER_H 47 | 48 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 49 | //#define IMGUI_USE_BGRA_PACKED_COLOR 50 | 51 | //---- Use 32-bit for ImWchar (default is 16-bit) to support full unicode code points. 52 | //#define IMGUI_USE_WCHAR32 53 | 54 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 55 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 56 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 57 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 58 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 59 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 60 | 61 | //---- Unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined, use the much faster STB sprintf library implementation of vsnprintf instead of the one from the default C library. 62 | // Note that stb_sprintf.h is meant to be provided by the user and available in the include path at compile time. Also, the compatibility checks of the arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf. 63 | // #define IMGUI_USE_STB_SPRINTF 64 | 65 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 66 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 67 | /* 68 | #define IM_VEC2_CLASS_EXTRA \ 69 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 70 | operator MyVec2() const { return MyVec2(x,y); } 71 | 72 | #define IM_VEC4_CLASS_EXTRA \ 73 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 74 | operator MyVec4() const { return MyVec4(x,y,z,w); } 75 | */ 76 | 77 | //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. 78 | // Your renderer back-end will need to support it (most example renderer back-ends support both 16/32-bit indices). 79 | // Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer. 80 | // Read about ImGuiBackendFlags_RendererHasVtxOffset for details. 81 | //#define ImDrawIdx unsigned int 82 | 83 | //---- Override ImDrawCallback signature (will need to modify renderer back-ends accordingly) 84 | //struct ImDrawList; 85 | //struct ImDrawCmd; 86 | //typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data); 87 | //#define ImDrawCallback MyImDrawCallback 88 | 89 | //---- Debug Tools: Macro to break in Debugger 90 | // (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.) 91 | //#define IM_DEBUG_BREAK IM_ASSERT(0) 92 | //#define IM_DEBUG_BREAK __debugbreak() 93 | 94 | //---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), 95 | // (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) 96 | // This adds a small runtime cost which is why it is not enabled by default. 97 | //#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX 98 | 99 | //---- Debug Tools: Enable slower asserts 100 | //#define IMGUI_DEBUG_PARANOID 101 | 102 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 103 | /* 104 | namespace ImGui 105 | { 106 | void MyFunction(const char* name, const MyMatrix44& v); 107 | } 108 | */ 109 | -------------------------------------------------------------------------------- /libs/imgui/misc/README.txt: -------------------------------------------------------------------------------- 1 | 2 | misc/cpp/ 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | misc/fonts/ 7 | Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts). 8 | Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code. 9 | Suggested fonts and links. 10 | 11 | misc/freetype/ 12 | Font atlas builder/rasterizer using FreeType instead of stb_truetype. 13 | Benefit from better FreeType rasterization, in particular for small fonts. 14 | 15 | misc/natvis/ 16 | Natvis file to describe dear imgui types in the Visual Studio debugger. 17 | With this, types like ImVector<> will be displayed nicely in the debugger. 18 | You can include this file a Visual Studio project file, or install it in Visual Studio folder. 19 | 20 | misc/single_file/ 21 | Single-file header stub. 22 | We use this to validate compiling all *.cpp files in a same compilation unit. 23 | Users of that technique (also called "Unity builds") can generally provide this themselves, 24 | so we don't really recommend you use this in your projects. 25 | -------------------------------------------------------------------------------- /libs/imgui/misc/cpp/README.txt: -------------------------------------------------------------------------------- 1 | 2 | imgui_stdlib.h + imgui_stdlib.cpp 3 | InputText() wrappers for C++ standard library (STL) type: std::string. 4 | This is also an example of how you may wrap your own similar types. 5 | 6 | imgui_scoped.h 7 | [Experimental, not currently in main repository] 8 | Additional header file with some RAII-style wrappers for common Dear ImGui functions. 9 | Try by merging: https://github.com/ocornut/imgui/pull/2197 10 | Discuss at: https://github.com/ocornut/imgui/issues/2096 11 | -------------------------------------------------------------------------------- /libs/imgui/misc/cpp/imgui_stdlib.cpp: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Compatibility: 5 | // - std::string support is only guaranteed to work from C++11. 6 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 7 | 8 | // Changelog: 9 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 10 | 11 | #include "imgui.h" 12 | #include "imgui_stdlib.h" 13 | 14 | struct InputTextCallback_UserData 15 | { 16 | std::string* Str; 17 | ImGuiInputTextCallback ChainCallback; 18 | void* ChainCallbackUserData; 19 | }; 20 | 21 | static int InputTextCallback(ImGuiInputTextCallbackData* data) 22 | { 23 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData; 24 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) 25 | { 26 | // Resize string callback 27 | // If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want. 28 | std::string* str = user_data->Str; 29 | IM_ASSERT(data->Buf == str->c_str()); 30 | str->resize(data->BufTextLen); 31 | data->Buf = (char*)str->c_str(); 32 | } 33 | else if (user_data->ChainCallback) 34 | { 35 | // Forward to user callback, if any 36 | data->UserData = user_data->ChainCallbackUserData; 37 | return user_data->ChainCallback(data); 38 | } 39 | return 0; 40 | } 41 | 42 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 43 | { 44 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 45 | flags |= ImGuiInputTextFlags_CallbackResize; 46 | 47 | InputTextCallback_UserData cb_user_data; 48 | cb_user_data.Str = str; 49 | cb_user_data.ChainCallback = callback; 50 | cb_user_data.ChainCallbackUserData = user_data; 51 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 52 | } 53 | 54 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 55 | { 56 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 57 | flags |= ImGuiInputTextFlags_CallbackResize; 58 | 59 | InputTextCallback_UserData cb_user_data; 60 | cb_user_data.Str = str; 61 | cb_user_data.ChainCallback = callback; 62 | cb_user_data.ChainCallbackUserData = user_data; 63 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data); 64 | } 65 | 66 | bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 67 | { 68 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 69 | flags |= ImGuiInputTextFlags_CallbackResize; 70 | 71 | InputTextCallback_UserData cb_user_data; 72 | cb_user_data.Str = str; 73 | cb_user_data.ChainCallback = callback; 74 | cb_user_data.ChainCallbackUserData = user_data; 75 | return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 76 | } 77 | -------------------------------------------------------------------------------- /libs/imgui/misc/cpp/imgui_stdlib.h: -------------------------------------------------------------------------------- 1 | // dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.) 2 | // This is also an example of how you may wrap your own similar types. 3 | 4 | // Compatibility: 5 | // - std::string support is only guaranteed to work from C++11. 6 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 7 | 8 | // Changelog: 9 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace ImGui 16 | { 17 | // ImGui::InputText() with std::string 18 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 19 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 20 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 21 | IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 22 | } 23 | -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dfranx/PluginRust/a178dfa008dfcc6ac9a799596d85cec3769e6c08/libs/imgui/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /libs/imgui/misc/freetype/README.md: -------------------------------------------------------------------------------- 1 | # imgui_freetype 2 | 3 | Build font atlases using FreeType instead of stb_truetype (which is the default font rasterizer in Dear ImGui). 4 |
by @vuhdo, @mikesart, @ocornut. 5 | 6 | ### Usage 7 | 8 | 1. Get latest FreeType binaries or build yourself (under Windows you may use vcpkg with `vcpkg install freetype`, `vcpkg integrate install`). 9 | 2. Add imgui_freetype.h/cpp alongside your imgui sources. 10 | 3. Include imgui_freetype.h after imgui.h. 11 | 4. Call `ImGuiFreeType::BuildFontAtlas()` *BEFORE* calling `ImFontAtlas::GetTexDataAsRGBA32()` or `ImFontAtlas::Build()` (so normal Build() won't be called): 12 | 13 | ```cpp 14 | // See ImGuiFreeType::RasterizationFlags 15 | unsigned int flags = ImGuiFreeType::NoHinting; 16 | ImGuiFreeType::BuildFontAtlas(io.Fonts, flags); 17 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); 18 | ``` 19 | 20 | ### Gamma Correct Blending 21 | 22 | FreeType assumes blending in linear space rather than gamma space. 23 | See FreeType note for [FT_Render_Glyph](https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph). 24 | For correct results you need to be using sRGB and convert to linear space in the pixel shader output. 25 | The default Dear ImGui styles will be impacted by this change (alpha values will need tweaking). 26 | 27 | ### Test code Usage 28 | ```cpp 29 | #include "misc/freetype/imgui_freetype.h" 30 | #include "misc/freetype/imgui_freetype.cpp" 31 | 32 | // Load various small fonts 33 | ImGuiIO& io = ImGui::GetIO(); 34 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 13.0f); 35 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 13.0f); 36 | io.Fonts->AddFontDefault(); 37 | 38 | FreeTypeTest freetype_test; 39 | 40 | // Main Loop 41 | while (true) 42 | { 43 | if (freetype_test.UpdateRebuild()) 44 | { 45 | // REUPLOAD FONT TEXTURE TO GPU 46 | ImGui_ImplXXX_DestroyDeviceObjects(); 47 | ImGui_ImplXXX_CreateDeviceObjects(); 48 | } 49 | ImGui::NewFrame(); 50 | freetype_test.ShowFreetypeOptionsWindow(); 51 | ... 52 | } 53 | ``` 54 | 55 | ### Test code 56 | ```cpp 57 | #include "misc/freetype/imgui_freetype.h" 58 | #include "misc/freetype/imgui_freetype.cpp" 59 | 60 | struct FreeTypeTest 61 | { 62 | enum FontBuildMode 63 | { 64 | FontBuildMode_FreeType, 65 | FontBuildMode_Stb 66 | }; 67 | 68 | FontBuildMode BuildMode; 69 | bool WantRebuild; 70 | float FontsMultiply; 71 | int FontsPadding; 72 | unsigned int FontsFlags; 73 | 74 | FreeTypeTest() 75 | { 76 | BuildMode = FontBuildMode_FreeType; 77 | WantRebuild = true; 78 | FontsMultiply = 1.0f; 79 | FontsPadding = 1; 80 | FontsFlags = 0; 81 | } 82 | 83 | // Call _BEFORE_ NewFrame() 84 | bool UpdateRebuild() 85 | { 86 | if (!WantRebuild) 87 | return false; 88 | ImGuiIO& io = ImGui::GetIO(); 89 | io.Fonts->TexGlyphPadding = FontsPadding; 90 | for (int n = 0; n < io.Fonts->ConfigData.Size; n++) 91 | { 92 | ImFontConfig* font_config = (ImFontConfig*)&io.Fonts->ConfigData[n]; 93 | font_config->RasterizerMultiply = FontsMultiply; 94 | font_config->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00; 95 | } 96 | if (BuildMode == FontBuildMode_FreeType) 97 | ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags); 98 | else if (BuildMode == FontBuildMode_Stb) 99 | io.Fonts->Build(); 100 | WantRebuild = false; 101 | return true; 102 | } 103 | 104 | // Call to draw interface 105 | void ShowFreetypeOptionsWindow() 106 | { 107 | ImGui::Begin("FreeType Options"); 108 | ImGui::ShowFontSelector("Fonts"); 109 | WantRebuild |= ImGui::RadioButton("FreeType", (int*)&BuildMode, FontBuildMode_FreeType); 110 | ImGui::SameLine(); 111 | WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb); 112 | WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f); 113 | WantRebuild |= ImGui::DragInt("Padding", &FontsPadding, 0.1f, 0, 16); 114 | if (BuildMode == FontBuildMode_FreeType) 115 | { 116 | WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting); 117 | WantRebuild |= ImGui::CheckboxFlags("NoAutoHint", &FontsFlags, ImGuiFreeType::NoAutoHint); 118 | WantRebuild |= ImGui::CheckboxFlags("ForceAutoHint", &FontsFlags, ImGuiFreeType::ForceAutoHint); 119 | WantRebuild |= ImGui::CheckboxFlags("LightHinting", &FontsFlags, ImGuiFreeType::LightHinting); 120 | WantRebuild |= ImGui::CheckboxFlags("MonoHinting", &FontsFlags, ImGuiFreeType::MonoHinting); 121 | WantRebuild |= ImGui::CheckboxFlags("Bold", &FontsFlags, ImGuiFreeType::Bold); 122 | WantRebuild |= ImGui::CheckboxFlags("Oblique", &FontsFlags, ImGuiFreeType::Oblique); 123 | WantRebuild |= ImGui::CheckboxFlags("Monochrome", &FontsFlags, ImGuiFreeType::Monochrome); 124 | } 125 | ImGui::End(); 126 | } 127 | }; 128 | ``` 129 | 130 | ### Known issues 131 | - `cfg.OversampleH`, `OversampleV` are ignored (but perhaps not so necessary with this rasterizer). 132 | 133 | -------------------------------------------------------------------------------- /libs/imgui/misc/freetype/imgui_freetype.h: -------------------------------------------------------------------------------- 1 | // dear imgui: wrapper to use FreeType (instead of stb_truetype) 2 | // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype 3 | // Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut 4 | 5 | #pragma once 6 | 7 | #include "imgui.h" // IMGUI_API, ImFontAtlas 8 | 9 | namespace ImGuiFreeType 10 | { 11 | // Hinting greatly impacts visuals (and glyph sizes). 12 | // When disabled, FreeType generates blurrier glyphs, more or less matches the stb's output. 13 | // The Default hinting mode usually looks good, but may distort glyphs in an unusual way. 14 | // The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer. 15 | 16 | // You can set those flags on a per font basis in ImFontConfig::RasterizerFlags. 17 | // Use the 'extra_flags' parameter of BuildFontAtlas() to force a flag on all your fonts. 18 | enum RasterizerFlags 19 | { 20 | // By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter. 21 | NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. 22 | NoAutoHint = 1 << 1, // Disable auto-hinter. 23 | ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter. 24 | LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text. 25 | MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output. 26 | Bold = 1 << 5, // Styling: Should we artificially embolden the font? 27 | Oblique = 1 << 6, // Styling: Should we slant the font, emulating italic style? 28 | Monochrome = 1 << 7 // Disable anti-aliasing. Combine this with MonoHinting for best results! 29 | }; 30 | 31 | IMGUI_API bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags = 0); 32 | 33 | // By default ImGuiFreeType will use IM_ALLOC()/IM_FREE(). 34 | // However, as FreeType does lots of allocations we provide a way for the user to redirect it to a separate memory heap if desired: 35 | IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void (*free_func)(void* ptr, void* user_data), void* user_data = NULL); 36 | } 37 | -------------------------------------------------------------------------------- /libs/imgui/misc/natvis/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Natvis file to describe dear imgui types in the Visual Studio debugger. 3 | With this, types like ImVector<> will be displayed nicely in the debugger. 4 | You can include this file a Visual Studio project file, or install it in Visual Studio folder. 5 | -------------------------------------------------------------------------------- /libs/imgui/misc/natvis/imgui.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{Size={Size} Capacity={Capacity}}} 9 | 10 | 11 | Size 12 | Data 13 | 14 | 15 | 16 | 17 | 18 | {{Size={DataEnd-Data} }} 19 | 20 | 21 | DataEnd-Data 22 | Data 23 | 24 | 25 | 26 | 27 | 28 | {{x={x,g} y={y,g}}} 29 | 30 | 31 | 32 | {{x={x,g} y={y,g} z={z,g} w={w,g}}} 33 | 34 | 35 | 36 | {{Min=({Min.x,g} {Min.y,g}) Max=({Max.x,g} {Max.y,g}) Size=({Max.x-Min.x,g} {Max.y-Min.y,g})}} 37 | 38 | Min 39 | Max 40 | Max.x - Min.x 41 | Max.y - Min.y 42 | 43 | 44 | 45 | 46 | {{Name {Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d} Hidden {(Hidden)?1:0,d}} 47 | 48 | 49 | 50 | {{ID {ID,x} Pos=({Pos.x,g} {Pos.y,g}) Size=({Size.x,g} {Size.y,g}) Parent {(ParentNode==0)?0:ParentNode->ID,x} Childs {(ChildNodes[0] != 0)+(ChildNodes[1] != 0)} Windows {Windows.Size} } 51 | 52 | 53 | -------------------------------------------------------------------------------- /libs/imgui/misc/single_file/imgui_single_file.h: -------------------------------------------------------------------------------- 1 | // dear imgui: single-file wrapper include 2 | // We use this to validate compiling all *.cpp files in a same compilation unit. 3 | // Users of that technique (also called "Unity builds") can generally provide this themselves, 4 | // so we don't really recommend you use this in your projects. 5 | 6 | // Do this: 7 | // #define IMGUI_IMPLEMENTATION 8 | // Before you include this file in *one* C++ file to create the implementation. 9 | // Using this in your project will leak the contents of imgui_internal.h and ImVec2 operators in this compilation unit. 10 | #include "../../imgui.h" 11 | 12 | #ifdef IMGUI_IMPLEMENTATION 13 | #include "../../imgui.cpp" 14 | #include "../../imgui_demo.cpp" 15 | #include "../../imgui_draw.cpp" 16 | #include "../../imgui_widgets.cpp" 17 | #endif 18 | -------------------------------------------------------------------------------- /rust_crates/shader/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust_shader" 3 | version = "0.1.0" 4 | authors = ["Embark "] 5 | edition = "2018" 6 | license = "MIT OR Apache-2.0" 7 | publish = false 8 | 9 | [lib] 10 | crate-type = ["dylib"] 11 | 12 | [dependencies] 13 | spirv-std = { path = "../spirv-std" } 14 | -------------------------------------------------------------------------------- /rust_crates/spirv-std/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "spirv-std" 3 | version = "0.1.0" 4 | authors = ["Embark "] 5 | edition = "2018" 6 | license = "MIT OR Apache-2.0" 7 | repository = "https://github.com/EmbarkStudios/rust-gpu" 8 | 9 | [dependencies] 10 | # https://github.com/bitshifter/glam-rs/pull/85 11 | glam = { git = "https://github.com/EmbarkStudios/glam-rs", rev = "c9561e4dfd55fa5a9d6838cae3c9e90c8edafaf9" } 12 | -------------------------------------------------------------------------------- /rust_crates/spirv-std/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![feature(register_attr, repr_simd, core_intrinsics)] 3 | #![cfg_attr(target_arch = "spirv", feature(asm))] 4 | #![register_attr(spirv)] 5 | // Our standard Clippy lints that we use in Embark projects, we opt out of a few that are not appropriate for the specific crate (yet) 6 | #![warn( 7 | clippy::all, 8 | clippy::doc_markdown, 9 | clippy::dbg_macro, 10 | clippy::todo, 11 | clippy::empty_enum, 12 | clippy::enum_glob_use, 13 | clippy::pub_enum_variant_names, 14 | clippy::mem_forget, 15 | clippy::filter_map_next, 16 | clippy::needless_continue, 17 | clippy::needless_borrow, 18 | clippy::match_wildcard_for_single_variants, 19 | clippy::if_let_mutex, 20 | clippy::mismatched_target_os, 21 | clippy::await_holding_lock, 22 | clippy::match_on_vec_items, 23 | clippy::imprecise_flops, 24 | //clippy::suboptimal_flops, 25 | clippy::lossy_float_literal, 26 | clippy::rest_pat_in_fully_bound_structs, 27 | clippy::fn_params_excessive_bools, 28 | clippy::exit, 29 | clippy::inefficient_to_string, 30 | clippy::linkedlist, 31 | clippy::macro_use_imports, 32 | clippy::option_option, 33 | clippy::verbose_file_reads, 34 | clippy::unnested_or_patterns, 35 | rust_2018_idioms, 36 | future_incompatible, 37 | nonstandard_style 38 | )] 39 | 40 | mod math_ext; 41 | pub use math_ext::MathExt; 42 | 43 | pub use glam; 44 | 45 | macro_rules! pointer_addrspace_write { 46 | (false) => {}; 47 | (true) => { 48 | #[inline] 49 | #[allow(unused_attributes)] 50 | #[spirv(really_unsafe_ignore_bitcasts)] 51 | pub fn store(&mut self, v: T) { 52 | *self.x = v 53 | } 54 | }; 55 | } 56 | 57 | macro_rules! pointer_addrspace { 58 | ($storage_class:ident, $type_name:ident, $writeable:tt) => { 59 | #[allow(unused_attributes)] 60 | #[spirv($storage_class)] 61 | pub struct $type_name<'a, T> { 62 | x: &'a mut T, 63 | } 64 | 65 | impl<'a, T: Copy> $type_name<'a, T> { 66 | #[inline] 67 | #[allow(unused_attributes)] 68 | #[spirv(really_unsafe_ignore_bitcasts)] 69 | pub fn load(&self) -> T { 70 | *self.x 71 | } 72 | 73 | pointer_addrspace_write!($writeable); 74 | } 75 | }; 76 | } 77 | 78 | // Make sure these strings stay synced with symbols.rs 79 | // Note the type names don't have to match anything, they can be renamed (only the string must match) 80 | pointer_addrspace!(uniform_constant, UniformConstant, false); 81 | pointer_addrspace!(input, Input, false); 82 | pointer_addrspace!(uniform, Uniform, true); 83 | pointer_addrspace!(output, Output, true); 84 | pointer_addrspace!(workgroup, Workgroup, true); 85 | pointer_addrspace!(cross_workgroup, CrossWorkgroup, true); 86 | pointer_addrspace!(private, Private, true); 87 | pointer_addrspace!(function, Function, true); 88 | pointer_addrspace!(generic, Generic, true); 89 | pointer_addrspace!(push_constant, PushConstant, false); 90 | pointer_addrspace!(atomic_counter, AtomicCounter, true); 91 | pointer_addrspace!(image, Image, true); 92 | pointer_addrspace!(storage_buffer, StorageBuffer, true); 93 | pointer_addrspace!(callable_data_khr, CallableDataKHR, true); 94 | pointer_addrspace!(incoming_callable_data_khr, IncomingCallableDataKHR, true); 95 | pointer_addrspace!(ray_payload_khr, RayPayloadKHR, true); 96 | pointer_addrspace!(hit_attribute_khr, HitAttributeKHR, true); 97 | pointer_addrspace!(incoming_ray_payload_khr, IncomingRayPayloadKHR, true); 98 | pointer_addrspace!(shader_record_buffer_khr, ShaderRecordBufferKHR, true); 99 | pointer_addrspace!(physical_storage_buffer, PhysicalStorageBuffer, true); 100 | 101 | pub trait Derivative { 102 | fn ddx(self) -> Self; 103 | fn ddx_fine(self) -> Self; 104 | fn ddx_coarse(self) -> Self; 105 | fn ddy(self) -> Self; 106 | fn ddy_fine(self) -> Self; 107 | fn ddy_coarse(self) -> Self; 108 | fn fwidth(self) -> Self; 109 | fn fwidth_fine(self) -> Self; 110 | fn fwidth_coarse(self) -> Self; 111 | } 112 | 113 | #[cfg(target_arch = "spirv")] 114 | macro_rules! deriv_caps { 115 | (true) => { 116 | asm!("OpCapability DerivativeControl") 117 | }; 118 | (false) => {}; 119 | } 120 | 121 | macro_rules! deriv_fn { 122 | ($name:ident, $inst:ident, $needs_caps:tt) => { 123 | fn $name(self) -> Self { 124 | #[cfg(not(target_arch = "spirv"))] 125 | panic!(concat!(stringify!($name), " is not supported on the CPU")); 126 | #[cfg(target_arch = "spirv")] 127 | unsafe { 128 | let o; 129 | deriv_caps!($needs_caps); 130 | asm!( 131 | concat!("{1} = ", stringify!($inst), " typeof{0} {0}"), 132 | in(reg) self, 133 | out(reg) o, 134 | ); 135 | o 136 | } 137 | } 138 | }; 139 | } 140 | macro_rules! deriv_impl { 141 | ($ty:ty) => { 142 | impl Derivative for $ty { 143 | deriv_fn!(ddx, OpDPdx, false); 144 | deriv_fn!(ddx_fine, OpDPdxFine, true); 145 | deriv_fn!(ddx_coarse, OpDPdxCoarse, true); 146 | deriv_fn!(ddy, OpDPdy, false); 147 | deriv_fn!(ddy_fine, OpDPdyFine, true); 148 | deriv_fn!(ddy_coarse, OpDPdyCoarse, true); 149 | deriv_fn!(fwidth, OpFwidth, false); 150 | deriv_fn!(fwidth_fine, OpFwidthFine, true); 151 | deriv_fn!(fwidth_coarse, OpFwidthCoarse, true); 152 | } 153 | }; 154 | } 155 | 156 | // "must be a scalar or vector of floating-point type. The component width must be 32 bits." 157 | deriv_impl!(f32); 158 | // TODO: Fix rustc to support these 159 | // deriv_impl!(glam::Vec2); 160 | // deriv_impl!(glam::Vec3); 161 | // deriv_impl!(glam::Vec4); 162 | 163 | /// libcore requires a few external symbols to be defined: 164 | /// 165 | /// TODO: This is copied from `compiler_builtins/mem.rs`. Can we use that one instead? The note in the above link says 166 | /// "[the symbols] can also be provided by the compiler-builtins crate". The memcpy in `compiler_builtins` is behind a 167 | /// "mem" feature flag - can we enable that somehow? 168 | /// 169 | #[allow(clippy::missing_safety_doc)] 170 | #[no_mangle] 171 | pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 { 172 | let mut i = 0; 173 | while i < n { 174 | let a = *s1.add(i); 175 | let b = *s2.add(i); 176 | if a != b { 177 | return a as i32 - b as i32; 178 | } 179 | i += 1; 180 | } 181 | 0 182 | } 183 | -------------------------------------------------------------------------------- /rust_crates/spirv-std/src/math_ext.rs: -------------------------------------------------------------------------------- 1 | pub trait MathExt { 2 | fn pow(self, factor: Self) -> Self; 3 | fn sqrt(self) -> Self; 4 | fn log2(self) -> Self; 5 | fn abs(self) -> Self; 6 | fn cos(self) -> Self; 7 | fn sin(self) -> Self; 8 | fn sin_cos(self) -> (f32, f32); 9 | fn round(self) -> Self; 10 | fn floor(self) -> Self; 11 | fn ceil(self) -> Self; 12 | fn exp(self) -> Self; 13 | fn saturate(self) -> Self; 14 | fn trunc(self) -> Self; 15 | fn fract(self) -> Self; 16 | 17 | fn signum(self) -> Self; 18 | fn copysign(self, sign: Self) -> Self; 19 | 20 | // TODO: implement but need new intrinsic in core? 21 | //fn tan(self) -> Self; 22 | } 23 | 24 | impl MathExt for f32 { 25 | fn pow(self, factor: f32) -> f32 { 26 | unsafe { core::intrinsics::powf32(self, factor) } 27 | } 28 | 29 | fn sqrt(self) -> f32 { 30 | unsafe { core::intrinsics::sqrtf32(self) } 31 | } 32 | 33 | fn log2(self) -> f32 { 34 | unsafe { core::intrinsics::log2f32(self) } 35 | } 36 | 37 | fn abs(self) -> f32 { 38 | unsafe { core::intrinsics::fabsf32(self) } 39 | } 40 | 41 | fn cos(self) -> f32 { 42 | unsafe { core::intrinsics::cosf32(self) } 43 | } 44 | 45 | fn sin(self) -> f32 { 46 | unsafe { core::intrinsics::sinf32(self) } 47 | } 48 | 49 | // TODO: implement but need new intrinsic in core? 50 | //fn tan(self) -> f32 { 51 | 52 | fn sin_cos(self) -> (f32, f32) { 53 | (self.sin(), self.cos()) 54 | } 55 | 56 | fn round(self) -> f32 { 57 | unsafe { core::intrinsics::roundf32(self) } 58 | } 59 | 60 | fn floor(self) -> f32 { 61 | unsafe { core::intrinsics::floorf32(self) } 62 | } 63 | 64 | fn ceil(self) -> f32 { 65 | unsafe { core::intrinsics::ceilf32(self) } 66 | } 67 | 68 | fn exp(self) -> f32 { 69 | unsafe { core::intrinsics::expf32(self) } 70 | } 71 | 72 | fn saturate(self) -> f32 { 73 | self.max(0.0).min(1.0) 74 | } 75 | 76 | fn trunc(self) -> f32 { 77 | unsafe { core::intrinsics::truncf32(self) } 78 | } 79 | 80 | fn fract(self) -> f32 { 81 | self - self.trunc() 82 | } 83 | 84 | fn signum(self) -> f32 { 85 | if self.is_nan() { 86 | Self::NAN 87 | } else { 88 | 1.0_f32.copysign(self) 89 | } 90 | } 91 | 92 | fn copysign(self, sign: f32) -> f32 { 93 | unsafe { core::intrinsics::copysignf32(self, sign) } 94 | } 95 | } 96 | --------------------------------------------------------------------------------