Trying to fix issue with project / view matrix

main
Brett 2022-10-31 00:51:51 -04:00
parent 1e8914b4a5
commit d8bade25a2
93 changed files with 4442 additions and 8822 deletions

View File

@ -1 +0,0 @@
,brett,laforge,28.10.2022 15:02,file:///home/brett/.config/libreoffice/4;

View File

@ -4,7 +4,8 @@ project(Step_3)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
option(EnableDebugMenu "Enable the debug utils" OFF) option(EnableDebugMenu "Enable the debug utils" OFF)
option(COMPILE_GUI "Enable compilation of the GUI utils" OFF) option(COMPILE_GUI "Enable compilation of the GUI + utils" OFF)
option(USE_GLFW "Will try to use GLFW instead of X11. If libglfw3 and libglfw3-dev are not installed it will default to X11" ON)
option(COMPILE_OPENCL "Enable compilation of the OpenCL GPU Compute." OFF) option(COMPILE_OPENCL "Enable compilation of the OpenCL GPU Compute." OFF)
# used to debug memory related issues # used to debug memory related issues
@ -13,20 +14,20 @@ if ((CMAKE_BUILD_TYPE MATCHES Debug))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
add_compile_options(-fsanitize=address) add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address) add_link_options(-fsanitize=address)
endif() endif ()
set(COMPILER_DEBUG_ENABLED true) set(COMPILER_DEBUG_ENABLED true)
else() else ()
set(COMPILER_DEBUG_ENABLED false) set(COMPILER_DEBUG_ENABLED false)
endif() endif ()
set(COMPILER_DEBUG_ENABLED_BOOL true) set(COMPILER_DEBUG_ENABLED_BOOL true)
if(EnableDebugMenu MATCHES ON) if (EnableDebugMenu MATCHES ON)
message("debug mode") message("debug mode")
set(DEBUG_ENABLED true) set(DEBUG_ENABLED true)
else() else ()
message("release mode") message("release mode")
set(DEBUG_ENABLED false) set(DEBUG_ENABLED false)
endif(EnableDebugMenu MATCHES ON) endif (EnableDebugMenu MATCHES ON)
set(DEBUG_ENABLED_BOOL true) set(DEBUG_ENABLED_BOOL true)
#config stuff #config stuff
@ -45,30 +46,45 @@ file(GLOB_RECURSE engine_source_files "${engine_source_dir}/*.cpp" "${engine_sou
if (COMPILE_GUI MATCHES ON AND UNIX) if (COMPILE_GUI MATCHES ON AND UNIX)
message("Compiling with GUI.") message("Compiling with GUI.")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(X11) set(SHOULD_FIND_X ON)
if(NOT X11_FOUND)
message("X11 wasn't found on your system. Do you have the development libs? sudo apt install libx11-dev")
endif()
include_directories(${X11_INCLUDE_DIR}) if (USE_GLFW)
find_package(glfw3 3.3)
if (glfw3_FOUND)
message("Found GLFW3!")
set(SHOULD_FIND_X OFF)
else ()
message("Unable to find GLFW3. Please install with sudo apt install libglfw3 libglfw3-dev")
endif ()
endif ()
if (SHOULD_FIND_X MATCHES ON)
message("Defaulting to X11. Please consider using GLFW as it is consider to be more stable and is what is actively developed. Bugs are to be expected using X11.")
find_package(X11)
if (NOT X11_FOUND)
message("X11 wasn't found on your system. Do you have the development libs? sudo apt install libx11-dev")
endif ()
include_directories(${X11_INCLUDE_DIR})
endif ()
set(graphics_source_dir "${PROJECT_SOURCE_DIR}/src/graphics") set(graphics_source_dir "${PROJECT_SOURCE_DIR}/src/graphics")
file(GLOB_RECURSE graphics_source_files "${graphics_source_dir}/*.cpp" "${graphics_source_dir}/*.c") file(GLOB_RECURSE graphics_source_files "${graphics_source_dir}/*.cpp" "${graphics_source_dir}/*.c")
endif() endif ()
# Windows should be able to handle opencl no problem. # Windows should be able to handle opencl no problem.
# i decided that i wanted to use opencl due to it having a much nicer c99 language. # i decided that i wanted to use opencl due to it having a much nicer c99 language.
if (COMPILE_OPENCL MATCHES ON) if (COMPILE_OPENCL MATCHES ON)
find_package(OpenCL) find_package(OpenCL)
if(NOT OpenCL_FOUND) if (NOT OpenCL_FOUND)
message("Unable to find OpenCL on your system. Do you have the required libs?") message("Unable to find OpenCL on your system. Do you have the required libs?")
endif() endif ()
include_directories(${OpenCL_INCLUDE_DIRS}) include_directories(${OpenCL_INCLUDE_DIRS})
set(opencl_source_dir "${PROJECT_SOURCE_DIR}/src/opencl") set(opencl_source_dir "${PROJECT_SOURCE_DIR}/src/opencl")
file(GLOB_RECURSE opencl_source_files "${opencl_source_dir}/*.cpp" "${opencl_source_dir}/*.c") file(GLOB_RECURSE opencl_source_files "${opencl_source_dir}/*.cpp" "${opencl_source_dir}/*.c")
endif() endif ()
#Setup project header files #Setup project header files
include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${PROJECT_SOURCE_DIR}/include)
@ -80,8 +96,12 @@ target_link_libraries(${PROJECT_NAME} pthread)
if (COMPILE_GUI MATCHES ON AND UNIX) if (COMPILE_GUI MATCHES ON AND UNIX)
target_link_libraries(${PROJECT_NAME} OpenGL::GL OpenGL::GLU OpenGL::GLX) target_link_libraries(${PROJECT_NAME} OpenGL::GL OpenGL::GLU OpenGL::GLX)
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES})
endif() endif ()
if (USE_GLFW MATCHES ON AND glfw3_FOUND)
target_link_libraries(${PROJECT_NAME} glfw)
endif ()
if (COMPILE_OPENCL MATCHES ON) if (COMPILE_OPENCL MATCHES ON)
target_link_libraries(${PROJECT_NAME} ${OpenCL_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${OpenCL_LIBRARIES})
endif() endif ()

View File

@ -1,254 +0,0 @@
{
"inputs" :
[
{
"path" : "CMakeLists.txt"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.23.2/CMakeSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.23.2/CMakeCCompiler.cmake"
},
{
"isGenerated" : true,
"path" : "cmake-build-debug/CMakeFiles/3.23.2/CMakeCXXCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"path" : "include/engine/config.h.in"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
}
],
"kind" : "cmakeFiles",
"paths" :
{
"build" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug",
"source" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3"
},
"version" :
{
"major" : 1,
"minor" : 0
}
}

View File

@ -1,60 +0,0 @@
{
"configurations" :
[
{
"directories" :
[
{
"build" : ".",
"jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
},
"projectIndex" : 0,
"source" : ".",
"targetIndexes" :
[
0
]
}
],
"name" : "Debug",
"projects" :
[
{
"directoryIndexes" :
[
0
],
"name" : "Step_3",
"targetIndexes" :
[
0
]
}
],
"targets" :
[
{
"directoryIndex" : 0,
"id" : "Step_3::@6890427a1f51a3e7e1df",
"jsonFile" : "target-Step_3-Debug-c6b33fab9a47948e599f.json",
"name" : "Step_3",
"projectIndex" : 0
}
]
}
],
"kind" : "codemodel",
"paths" :
{
"build" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug",
"source" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3"
},
"version" :
{
"major" : 2,
"minor" : 4
}
}

View File

@ -1,395 +0,0 @@
{
"artifacts" :
[
{
"path" : "Step_3"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable",
"add_link_options",
"target_link_libraries",
"set_target_properties",
"find_package",
"add_compile_options",
"include_directories"
],
"files" :
[
"CMakeLists.txt",
"/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 76,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 15,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 78,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 81,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 82,
"parent" : 0
},
{
"command" : 2,
"file" : 0,
"line" : 86,
"parent" : 0
},
{
"command" : 4,
"file" : 0,
"line" : 47,
"parent" : 0
},
{
"file" : 1,
"parent" : 7
},
{
"command" : 3,
"file" : 1,
"line" : 510,
"parent" : 8
},
{
"command" : 5,
"file" : 0,
"line" : 14,
"parent" : 0
},
{
"command" : 6,
"file" : 0,
"line" : 35,
"parent" : 0
},
{
"command" : 6,
"file" : 0,
"line" : 74,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : " -fsanitize=address -g -march=native -g"
},
{
"backtrace" : 10,
"fragment" : "-fsanitize=address"
},
{
"fragment" : "-std=gnu++20"
}
],
"includes" :
[
{
"backtrace" : 11,
"path" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug"
},
{
"backtrace" : 12,
"path" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "20"
},
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
],
"id" : "Step_3::@6890427a1f51a3e7e1df",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-fsanitize=address -g -march=native -g",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
},
{
"backtrace" : 2,
"fragment" : "-fsanitize=address",
"role" : "flags"
},
{
"backtrace" : 3,
"fragment" : "-lpthread",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLU.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLX.so",
"role" : "libraries"
},
{
"backtrace" : 5,
"fragment" : "/usr/lib/x86_64-linux-gnu/libSM.so",
"role" : "libraries"
},
{
"backtrace" : 5,
"fragment" : "/usr/lib/x86_64-linux-gnu/libICE.so",
"role" : "libraries"
},
{
"backtrace" : 5,
"fragment" : "/usr/lib/x86_64-linux-gnu/libX11.so",
"role" : "libraries"
},
{
"backtrace" : 5,
"fragment" : "/usr/lib/x86_64-linux-gnu/libXext.so",
"role" : "libraries"
},
{
"backtrace" : 6,
"fragment" : "/usr/lib/x86_64-linux-gnu/libOpenCL.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLX.so",
"role" : "libraries"
},
{
"backtrace" : 9,
"fragment" : "/usr/lib/x86_64-linux-gnu/libOpenGL.so",
"role" : "libraries"
}
],
"language" : "CXX"
},
"name" : "Step_3",
"nameOnDisk" : "Step_3",
"paths" :
{
"build" : ".",
"source" : "."
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/globals.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/image/image.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/math/colliders.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/raytracing.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/debug.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/models.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/parser.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/world.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/gl/gl.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/gl/shader.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/graphics.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_demo.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_draw.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_impl_glfw.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_impl_opengl3.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_tables.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_widgets.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/input.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

Binary file not shown.

View File

@ -1,23 +1,86 @@
# ninja log v5 # ninja log v5
3 2328 1666645817680080118 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o dc4b23b5e01a8208 2468 4613 1667153960803219513 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o dc4b23b5e01a8208
2 1997 1666645817348070656 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o cf522ea42b0f8fd3 1 427 1667154074499589425 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1620 1666983166449949656 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb 2008 3974 1667153960163194261 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o cf522ea42b0f8fd3
1 979 1666648980885505392 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede 2 2766 1667153958955146576 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
1 1508 1666673054183662428 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 4ca9d05ad8f3d295 1 2008 1667153958199116717 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
1 2791 1667153958983147681 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 4ca9d05ad8f3d295
2318 3021 1667153959215156841 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o 6f5a39b3d5d543ae
1 1234 1666981302357304642 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa 1 1234 1666981302357304642 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
2 1991 1666645817344070539 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 12778f168a75833b 1 2030 1667153958223117664 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 12778f168a75833b
2 2283 1666933460283419002 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554 2 2648 1667153958839141995 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554
2 3803 1666645819156122183 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o f152a6b2309aba93 838 5349 1667153961539248544 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o f152a6b2309aba93
2088 2309 1666983564938369031 Step_3 50a8b57262a84bea 2017 2190 1667154076263655537 Step_3 32fd76f248d1f905
1 345 1666981453797536430 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 35f01a0bb2fddead 2041 2317 1667153958511129040 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 35f01a0bb2fddead
4 2331 1666645817684080231 CMakeFiles/Step_3.dir/src/graphics/shader.cpp.o 89b6559e07a1508c 4 2331 1666645817684080231 CMakeFiles/Step_3.dir/src/graphics/shader.cpp.o 89b6559e07a1508c
1 1849 1666983376724092088 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd 1 3635 1667153959823180843 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
4 41 1666933458043351230 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 10752ac78f398bdb 4 41 1666933458043351230 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 10752ac78f398bdb
3 3104 1666645818456102230 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o 707f99c685c75a0f 2030 5143 1667153961331240340 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o 707f99c685c75a0f
1 1429 1666983376304079808 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888 1 1349 1667154075423624061 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
3 3490 1666645818844113291 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o d81abd5f968f8f53 2648 5738 1667153961927263847 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o d81abd5f968f8f53
2 2699 1666981303821348302 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c 1 1982 1667154076055647747 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
3 375 1666933458379361395 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 45a2ee53269bffeb 3 375 1666933458379361395 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 45a2ee53269bffeb
1 1377 1666934125123463514 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6 1 1255 1667154075327620463 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
1 2088 1666983564718361404 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525 1 2017 1667154076091649095 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
1 1178 1666549740059765852 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o e9e3fe6fe9a4de66 2 2041 1667153958231117979 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o e9e3fe6fe9a4de66
3 692 1667163382924394018 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1184 1667163383420409456 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 3e7c95bef1d0ddaa
2 1265 1667163383500411946 CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o 6b49c8b248d04bb6
2 1555 1667163383792421035 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d5972a669671ede
3 1787 1667163384024428255 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
3 1884 1667163384120431243 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
2 1962 1667163384196433608 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
2 2318 1667163384552444689 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
2 2468 1667163384704449422 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
3 2470 1667163384704449422 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
2470 2670 1667163384904455646 Step_3 7f6959eaebe4da02
2 495 1667163437354089921 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1381 1667163438238117496 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
2 1451 1667163438310119742 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
2 2150 1667163439006141453 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1 2154 1667163439014141702 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2154 2362 1667163439218148065 Step_3 7f6959eaebe4da02
2 445 1667163512540438339 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1290 1667163513388464862 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
2 1341 1667163513436466363 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
2 2092 1667163514188489883 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1 2103 1667163514200490259 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2104 2285 1667163514380495887 Step_3 7f6959eaebe4da02
2 479 1667164649884505763 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 7e874136640e6898
2 1348 1667164650776531271 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
2 1439 1667164650868533902 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
1 1993 1667164651420549688 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
2 2153 1667164651580554264 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1 2163 1667164651588554493 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
1 2192 1667164651620555409 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2192 2376 1667164651804560671 Step_3 7f6959eaebe4da02
1 1918 1667164724182641387 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
1919 2099 1667164724362646587 Step_3 7f6959eaebe4da02
1 1961 1667164796716745795 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
1961 2139 1667164796896751037 Step_3 7f6959eaebe4da02
1 1339 1667166009917251171 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
1 1956 1667166010533266830 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1 1982 1667166010557267438 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
1982 2163 1667166010737272014 Step_3 7f6959eaebe4da02
1 1913 1667166119364084538 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1913 2092 1667166119544089279 Step_3 7f6959eaebe4da02
1 1415 1667183451634129148 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 12778f168a75833b
2 1867 1667183452082142894 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554
2 2017 1667183452234147558 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
2 2122 1667183452338150748 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
1 2299 1667183452514156149 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 4ca9d05ad8f3d295
2 2469 1667183452686161426 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
1 2552 1667183452766163880 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
2 2832 1667183453046172470 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
1 2944 1667183453158175907 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2944 3143 1667183453358182043 Step_3 7f6959eaebe4da02
2 1663 1667189508444800726 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 12778f168a75833b
4 1824 1667189508604805575 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o 53ce7d6ed877d888
3 1977 1667189508760810304 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 67f44a482b45cec6
3 2121 1667189508904814669 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o f8031520e846a554
3 2144 1667189508924815274 CMakeFiles/Step_3.dir/src/engine/world.cpp.o fa088ebdd4dea6cb
2 2321 1667189509104820730 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 4ca9d05ad8f3d295
3 2539 1667189509320827277 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o c67f39c07aae8f1c
3 2588 1667189509368828732 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 39bc1042baf06dcd
2 2604 1667189509384829217 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 9281ecbfd964c525
2604 2792 1667189509572834912 Step_3 7f6959eaebe4da02

View File

@ -206,7 +206,7 @@ CMAKE_STRIP:FILEPATH=/usr/bin/strip
// Studio IDE projects all commands are done without /nologo. // Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
//Enable compilation of the GUI utils //Enable compilation of the GUI + utils
COMPILE_GUI:BOOL=ON COMPILE_GUI:BOOL=ON
//Enable compilation of the OpenCL GPU Compute. //Enable compilation of the OpenCL GPU Compute.
@ -278,6 +278,10 @@ Step_3_IS_TOP_LEVEL:STATIC=ON
//Value Computed by CMake //Value Computed by CMake
Step_3_SOURCE_DIR:STATIC=/home/brett/Documents/Brock/CS 3P93/Project/Step 3 Step_3_SOURCE_DIR:STATIC=/home/brett/Documents/Brock/CS 3P93/Project/Step 3
//Will try to use GLFW instead of X11. If libglfw3 and libglfw3-dev
// are not installed it will default to X11
USE_GLFW:BOOL=ON
//Path to a file. //Path to a file.
X11_ICE_INCLUDE_PATH:PATH=/usr/include X11_ICE_INCLUDE_PATH:PATH=/usr/include
@ -509,6 +513,9 @@ X11_xkbfile_INCLUDE_PATH:PATH=/usr/include
//Path to a library. //Path to a library.
X11_xkbfile_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxkbfile.so X11_xkbfile_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxkbfile.so
//The directory containing a CMake configuration file for glfw3.
glfw3_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/glfw3
//Path to a library. //Path to a library.
pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so

View File

@ -1,6 +1,7 @@
/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DCOMPILE_GUI:BOOL=ON -DCOMPILE_OPENCL:BOOL=ON -G Ninja -S "/home/brett/Documents/Brock/CS 3P93/Project/Step 3" -B "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug" /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DCOMPILE_GUI:BOOL=ON -DCOMPILE_OPENCL:BOOL=ON -G Ninja -S "/home/brett/Documents/Brock/CS 3P93/Project/Step 3" -B "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug"
release mode release mode
Compiling with GUI. Compiling with GUI.
Found GLFW3!
-- Configuring done -- Configuring done
-- Generating done -- Generating done
-- Build files have been written to: /home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug -- Build files have been written to: /home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug

View File

@ -11,6 +11,16 @@
# ============================================================================= # =============================================================================
# ============================================================================= # =============================================================================
#############################################
# Rule for compiling C files.
rule C_COMPILER__Step_3_Debug
depfile = $DEP_FILE
deps = gcc
command = /usr/bin/cc $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
description = Building C object $out
############################################# #############################################
# Rule for compiling CXX files. # Rule for compiling CXX files.

Binary file not shown.

View File

@ -1,3 +1,3 @@
Start testing: Oct 28 14:59 EDT Start testing: Oct 31 00:11 EDT
---------------------------------------------------------- ----------------------------------------------------------
End testing: Oct 28 14:59 EDT End testing: Oct 31 00:11 EDT

View File

@ -112,6 +112,20 @@ build CMakeFiles/Step_3.dir/src/engine/world.cpp.o: CXX_COMPILER__Step_3_Debug /
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/engine OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/engine
build CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/debug_gui.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o.d
FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics
build CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o: C_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.c || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o.d
FLAGS = -g -fsanitize=address
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/gl
build CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.cpp || cmake_object_order_depends_target_Step_3 build CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o.d DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o.d
FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20 FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20
@ -168,6 +182,13 @@ build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o: CXX_COM
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui
build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_impl_x11.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o.d
FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-debug" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui
build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_tables.cpp || cmake_object_order_depends_target_Step_3 build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o: CXX_COMPILER__Step_3_Debug /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_tables.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o.d DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o.d
FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20 FLAGS = -fsanitize=address -g -march=native -g -fsanitize=address -std=gnu++20
@ -197,10 +218,10 @@ build CMakeFiles/Step_3.dir/src/graphics/input.cpp.o: CXX_COMPILER__Step_3_Debug
############################################# #############################################
# Link the executable Step_3 # Link the executable Step_3
build Step_3: CXX_EXECUTABLE_LINKER__Step_3_Debug CMakeFiles/Step_3.dir/src/engine/globals.cpp.o CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o CMakeFiles/Step_3.dir/src/engine/main.cpp.o CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o CMakeFiles/Step_3.dir/src/engine/world.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o CMakeFiles/Step_3.dir/src/graphics/input.cpp.o | /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so build Step_3: CXX_EXECUTABLE_LINKER__Step_3_Debug CMakeFiles/Step_3.dir/src/engine/globals.cpp.o CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o CMakeFiles/Step_3.dir/src/engine/main.cpp.o CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o CMakeFiles/Step_3.dir/src/engine/world.cpp.o CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o CMakeFiles/Step_3.dir/src/graphics/input.cpp.o | /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libglfw.so.3.3 /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so
FLAGS = -fsanitize=address -g -march=native -g FLAGS = -fsanitize=address -g -march=native -g
LINK_FLAGS = -fsanitize=address LINK_FLAGS = -fsanitize=address
LINK_LIBRARIES = -lpthread /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so LINK_LIBRARIES = -lpthread /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libglfw.so.3.3 /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
POST_BUILD = : POST_BUILD = :
PRE_LINK = : PRE_LINK = :
@ -251,14 +272,14 @@ build all: phony Step_3
############################################# #############################################
# Re-run CMake if any of its inputs changed. # Re-run CMake if any of its inputs changed.
build build.ninja: RERUN_CMAKE | ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake build build.ninja: RERUN_CMAKE | ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake
pool = console pool = console
############################################# #############################################
# A missing CMake input file is not an error. # A missing CMake input file is not an error.
build ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake: phony build ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake: phony
############################################# #############################################

View File

@ -14,6 +14,7 @@
#define COMPILE_GUI #define COMPILE_GUI
#define COMPILE_OPENCL #define COMPILE_OPENCL
#define USE_GLFW
#define CMAKE_CONFIG #define CMAKE_CONFIG
#endif #endif

View File

@ -4,12 +4,12 @@ Size=400,400
Collapsed=0 Collapsed=0
[Window][Dear ImGui Demo] [Window][Dear ImGui Demo]
Pos=650,20 Pos=828,19
Size=550,680 Size=550,680
Collapsed=0 Collapsed=1
[Window][Debug] [Window][Debug]
Pos=72,82 Pos=72,82
Size=74,100 Size=326,186
Collapsed=0 Collapsed=0

View File

@ -1,254 +0,0 @@
{
"inputs" :
[
{
"path" : "CMakeLists.txt"
},
{
"isGenerated" : true,
"path" : "cmake-build-release/CMakeFiles/3.23.2/CMakeSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake"
},
{
"isGenerated" : true,
"path" : "cmake-build-release/CMakeFiles/3.23.2/CMakeCCompiler.cmake"
},
{
"isGenerated" : true,
"path" : "cmake-build-release/CMakeFiles/3.23.2/CMakeCXXCompiler.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake"
},
{
"path" : "include/engine/config.h.in"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake"
}
],
"kind" : "cmakeFiles",
"paths" :
{
"build" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release",
"source" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3"
},
"version" :
{
"major" : 1,
"minor" : 0
}
}

View File

@ -1,60 +0,0 @@
{
"configurations" :
[
{
"directories" :
[
{
"build" : ".",
"jsonFile" : "directory-.-Release-f5ebdc15457944623624.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
},
"projectIndex" : 0,
"source" : ".",
"targetIndexes" :
[
0
]
}
],
"name" : "Release",
"projects" :
[
{
"directoryIndexes" :
[
0
],
"name" : "Step_3",
"targetIndexes" :
[
0
]
}
],
"targets" :
[
{
"directoryIndex" : 0,
"id" : "Step_3::@6890427a1f51a3e7e1df",
"jsonFile" : "target-Step_3-Release-bdebccb789912d5d0f87.json",
"name" : "Step_3",
"projectIndex" : 0
}
]
}
],
"kind" : "codemodel",
"paths" :
{
"build" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release",
"source" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3"
},
"version" :
{
"major" : 2,
"minor" : 4
}
}

View File

@ -1,108 +0,0 @@
{
"cmake" :
{
"generator" :
{
"multiConfig" : false,
"name" : "Ninja"
},
"paths" :
{
"cmake" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake",
"cpack" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cpack",
"ctest" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/ctest",
"root" : "/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23"
},
"version" :
{
"isDirty" : false,
"major" : 3,
"minor" : 23,
"patch" : 2,
"string" : "3.23.2",
"suffix" : ""
}
},
"objects" :
[
{
"jsonFile" : "codemodel-v2-5f1a984d7825cc4c9ec6.json",
"kind" : "codemodel",
"version" :
{
"major" : 2,
"minor" : 4
}
},
{
"jsonFile" : "cache-v2-c116349fbc5b58233d34.json",
"kind" : "cache",
"version" :
{
"major" : 2,
"minor" : 0
}
},
{
"jsonFile" : "cmakeFiles-v1-dd3ae7c60de5f194f384.json",
"kind" : "cmakeFiles",
"version" :
{
"major" : 1,
"minor" : 0
}
},
{
"jsonFile" : "toolchains-v1-a68c232ca45b00aa6bba.json",
"kind" : "toolchains",
"version" :
{
"major" : 1,
"minor" : 0
}
}
],
"reply" :
{
"cache-v2" :
{
"jsonFile" : "cache-v2-c116349fbc5b58233d34.json",
"kind" : "cache",
"version" :
{
"major" : 2,
"minor" : 0
}
},
"cmakeFiles-v1" :
{
"jsonFile" : "cmakeFiles-v1-dd3ae7c60de5f194f384.json",
"kind" : "cmakeFiles",
"version" :
{
"major" : 1,
"minor" : 0
}
},
"codemodel-v2" :
{
"jsonFile" : "codemodel-v2-5f1a984d7825cc4c9ec6.json",
"kind" : "codemodel",
"version" :
{
"major" : 2,
"minor" : 4
}
},
"toolchains-v1" :
{
"jsonFile" : "toolchains-v1-a68c232ca45b00aa6bba.json",
"kind" : "toolchains",
"version" :
{
"major" : 1,
"minor" : 0
}
}
}
}

View File

@ -1,372 +0,0 @@
{
"artifacts" :
[
{
"path" : "Step_3"
}
],
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_executable",
"target_link_libraries",
"set_target_properties",
"find_package",
"include_directories"
],
"files" :
[
"CMakeLists.txt",
"/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 76,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 78,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 81,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 82,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 86,
"parent" : 0
},
{
"command" : 3,
"file" : 0,
"line" : 47,
"parent" : 0
},
{
"file" : 1,
"parent" : 6
},
{
"command" : 2,
"file" : 1,
"line" : 510,
"parent" : 7
},
{
"command" : 4,
"file" : 0,
"line" : 35,
"parent" : 0
},
{
"command" : 4,
"file" : 0,
"line" : 74,
"parent" : 0
}
]
},
"compileGroups" :
[
{
"compileCommandFragments" :
[
{
"fragment" : " -march=native -O3 -DNDEBUG"
},
{
"fragment" : "-std=gnu++20"
}
],
"includes" :
[
{
"backtrace" : 9,
"path" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release"
},
{
"backtrace" : 10,
"path" : "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
}
],
"language" : "CXX",
"languageStandard" :
{
"backtraces" :
[
1
],
"standard" : "20"
},
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
],
"id" : "Step_3::@6890427a1f51a3e7e1df",
"link" :
{
"commandFragments" :
[
{
"fragment" : "-march=native -O3 -DNDEBUG",
"role" : "flags"
},
{
"fragment" : "",
"role" : "flags"
},
{
"backtrace" : 2,
"fragment" : "-lpthread",
"role" : "libraries"
},
{
"backtrace" : 3,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLU.so",
"role" : "libraries"
},
{
"backtrace" : 3,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLX.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libSM.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libICE.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libX11.so",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "/usr/lib/x86_64-linux-gnu/libXext.so",
"role" : "libraries"
},
{
"backtrace" : 5,
"fragment" : "/usr/lib/x86_64-linux-gnu/libOpenCL.so",
"role" : "libraries"
},
{
"backtrace" : 3,
"fragment" : "/usr/lib/x86_64-linux-gnu/libGLX.so",
"role" : "libraries"
},
{
"backtrace" : 8,
"fragment" : "/usr/lib/x86_64-linux-gnu/libOpenGL.so",
"role" : "libraries"
}
],
"language" : "CXX"
},
"name" : "Step_3",
"nameOnDisk" : "Step_3",
"paths" :
{
"build" : ".",
"source" : "."
},
"sourceGroups" :
[
{
"name" : "Source Files",
"sourceIndexes" :
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19
]
}
],
"sources" :
[
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/globals.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/image/image.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/main.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/math/colliders.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/raytracing.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/debug.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/models.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/util/parser.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/engine/world.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/gl/gl.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/gl/shader.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/graphics.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_demo.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_draw.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_impl_glfw.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_impl_opengl3.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_tables.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/imgui/imgui_widgets.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/graphics/input.cpp",
"sourceGroupIndex" : 0
}
],
"type" : "EXECUTABLE"
}

View File

@ -1,23 +1,48 @@
# ninja log v5 # ninja log v5
2 1891 1666585888837654600 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o f6dab204e07e8dcf 2 2553 1667058676876977871 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o f6dab204e07e8dcf
1 2520 1666585889465673262 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o 7798aba97da63e31 2 1734 1667164639612212249 CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o 30ab06816e8637c1
1 1301 1666981149056733417 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4 2 3277 1667058677601002493 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o 7798aba97da63e31
1 893 1666647453395941912 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d86a254d2bce8f74 2 1715 1667191643475802262 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1 1869 1666672425433732155 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 1c68ba16e6b4d09b 2 1199 1667160815556570953 CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o d86a254d2bce8f74
1 741 1666980538714543808 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 4ef77d2224f86511 1 3331 1667190218078401905 CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o 1c68ba16e6b4d09b
1 775 1666586379624689616 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 39e9f435096d066b 2 807 1667160815152555289 CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o 9493619f74acd06a
1 1524 1666811808578010855 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072 3 515 1667153528379594224 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o d1e9a2fcb31e2ec8
1 6680 1666585893625796878 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o 55e7538fd27b47be 1 781 1667160815140554827 CMakeFiles/Step_3.dir/src/engine/globals.cpp.o 4ef77d2224f86511
1438 1505 1666981290476950363 Step_3 8e1012bfab9235e9 2 1071 1667190215818332921 CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o 39e9f435096d066b
2 352 1666934238066860228 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 6aef9db88eb3d76d 2 1522 1667190216254346230 CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o 164394d360c43072
2 6623 1667058680945116176 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o 55e7538fd27b47be
2253 2317 1667191644075820056 Step_3 f055ce2b85635598
1 168 1667153277796642068 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o 6aef9db88eb3d76d
2 1091 1666586379944699493 CMakeFiles/Step_3.dir/src/graphics/shader.cpp.o 25fdf04995cdd7fe 2 1091 1666586379944699493 CMakeFiles/Step_3.dir/src/graphics/shader.cpp.o 25fdf04995cdd7fe
1 1438 1666981290408948337 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca 2 1703 1667191643463801906 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
1 17 1666723625180468244 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 510001b0955ab019 1 17 1666723625180468244 CMakeFiles/Step_3.dir/src/graphics/input.cpp.o 510001b0955ab019
1 3563 1666585915222438568 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o f89fa3d7b779872a 2 4378 1667058678701039897 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o f89fa3d7b779872a
1 4522 1666585908106227137 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o 84017388bc7af144 3 1325 1667190216074340733 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d
2 1110 1666981148864727693 CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o ce988de97a5cb51d 2 4955 1667058679277059480 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o 84017388bc7af144
2 4819 1666981152572838255 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o 330ad35a6abf06c3 2 4888 1667190219638449522 CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o 330ad35a6abf06c3
4 176 1666717766117955862 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 1b5f0fbe3cf8ce4e 4 176 1666717766117955862 CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o 1b5f0fbe3cf8ce4e
1 995 1666934083498211266 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 2553d57dba16057b 2 1372 1667190216122342199 CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o 2553d57dba16057b
1 1924 1666981149676751903 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e 1 2253 1667191644011818156 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1 1350 1666485932124409891 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o 1007c86c207ac940 2 1812 1667058676132952564 CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o 1007c86c207ac940
1 1366 1667191682544961462 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1 1428 1667191682608963361 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
1 1781 1667191682960973813 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1781 1845 1667191683024975712 Step_3 f055ce2b85635598
1 1752 1667191737298588205 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1752 1816 1667191737362590108 Step_3 f055ce2b85635598
1 1569 1667191746314856307 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1 1636 1667191746382858328 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
1 2215 1667191746962875577 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
2215 2286 1667191747030877600 Step_3 f055ce2b85635598
1 1391 1667191773179655501 CMakeFiles/Step_3.dir/src/engine/world.cpp.o 6470df278966c4
1 1462 1667191773247657524 CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o 11f0e227e9fda9ca
1 1792 1667191773579667404 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1792 1854 1667191773639669189 Step_3 f055ce2b85635598
1 1781 1667191787604084824 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1781 1845 1667191787668086729 Step_3 f055ce2b85635598
2 1832 1667191813176846315 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1832 1895 1667191813240848221 Step_3 f055ce2b85635598
1 1777 1667191829377328950 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1777 1844 1667191829445330975 Step_3 f055ce2b85635598
1 1795 1667191871242576935 CMakeFiles/Step_3.dir/src/engine/main.cpp.o 641dce3f86933e2e
1795 1858 1667191871306578844 Step_3 f055ce2b85635598

View File

@ -209,7 +209,7 @@ CMAKE_STRIP:FILEPATH=/usr/bin/strip
// Studio IDE projects all commands are done without /nologo. // Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
//Enable compilation of the GUI utils //Enable compilation of the GUI + utils
COMPILE_GUI:BOOL=ON COMPILE_GUI:BOOL=ON
//Enable compilation of the OpenCL GPU Compute. //Enable compilation of the OpenCL GPU Compute.
@ -281,6 +281,10 @@ Step_3_IS_TOP_LEVEL:STATIC=ON
//Value Computed by CMake //Value Computed by CMake
Step_3_SOURCE_DIR:STATIC=/home/brett/Documents/Brock/CS 3P93/Project/Step 3 Step_3_SOURCE_DIR:STATIC=/home/brett/Documents/Brock/CS 3P93/Project/Step 3
//Will try to use GLFW instead of X11. If libglfw3 and libglfw3-dev
// are not installed it will default to X11
USE_GLFW:BOOL=ON
//Path to a file. //Path to a file.
X11_ICE_INCLUDE_PATH:PATH=/usr/include X11_ICE_INCLUDE_PATH:PATH=/usr/include
@ -530,6 +534,9 @@ X11_xkbfile_INCLUDE_PATH:PATH=/usr/include
//Path to a library. //Path to a library.
X11_xkbfile_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxkbfile.so X11_xkbfile_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxkbfile.so
//The directory containing a CMake configuration file for glfw3.
glfw3_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/glfw3
//Path to a library. //Path to a library.
pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so

View File

@ -1,6 +1,7 @@
/opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DCOMPILE_GUI:BOOL=ON -DCOMPILE_OPENCL:BOOL=ON -G Ninja -S "/home/brett/Documents/Brock/CS 3P93/Project/Step 3" -B "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release" /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DCOMPILE_GUI:BOOL=ON -DCOMPILE_OPENCL:BOOL=ON -G Ninja -S "/home/brett/Documents/Brock/CS 3P93/Project/Step 3" -B "/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release"
release mode release mode
Compiling with GUI. Compiling with GUI.
Found GLFW3!
-- Configuring done -- Configuring done
-- Generating done -- Generating done
-- Build files have been written to: /home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release -- Build files have been written to: /home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release

View File

@ -11,6 +11,16 @@
# ============================================================================= # =============================================================================
# ============================================================================= # =============================================================================
#############################################
# Rule for compiling C files.
rule C_COMPILER__Step_3_Release
depfile = $DEP_FILE
deps = gcc
command = /usr/bin/cc $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
description = Building C object $out
############################################# #############################################
# Rule for compiling CXX files. # Rule for compiling CXX files.

Binary file not shown.

View File

@ -1,3 +1,3 @@
Start testing: Oct 28 15:02 EDT Start testing: Oct 31 00:51 EDT
---------------------------------------------------------- ----------------------------------------------------------
End testing: Oct 28 15:02 EDT End testing: Oct 31 00:51 EDT

View File

@ -112,6 +112,20 @@ build CMakeFiles/Step_3.dir/src/engine/world.cpp.o: CXX_COMPILER__Step_3_Release
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/engine OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/engine
build CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/debug_gui.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o.d
FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics
build CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o: C_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.c || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o.d
FLAGS = -O3 -DNDEBUG
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/gl
build CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.cpp || cmake_object_order_depends_target_Step_3 build CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/gl/gl.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o.d DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o.d
FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20 FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20
@ -168,6 +182,13 @@ build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o: CXX_COM
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui
build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_impl_x11.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o.d
FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20
INCLUDES = -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/cmake-build-release" -I"/home/brett/Documents/Brock/CS 3P93/Project/Step 3/include"
OBJECT_DIR = CMakeFiles/Step_3.dir
OBJECT_FILE_DIR = CMakeFiles/Step_3.dir/src/graphics/imgui
build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_tables.cpp || cmake_object_order_depends_target_Step_3 build CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o: CXX_COMPILER__Step_3_Release /home/brett/Documents/Brock/CS$ 3P93/Project/Step$ 3/src/graphics/imgui/imgui_tables.cpp || cmake_object_order_depends_target_Step_3
DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o.d DEP_FILE = CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o.d
FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20 FLAGS = -march=native -O3 -DNDEBUG -std=gnu++20
@ -197,9 +218,9 @@ build CMakeFiles/Step_3.dir/src/graphics/input.cpp.o: CXX_COMPILER__Step_3_Relea
############################################# #############################################
# Link the executable Step_3 # Link the executable Step_3
build Step_3: CXX_EXECUTABLE_LINKER__Step_3_Release CMakeFiles/Step_3.dir/src/engine/globals.cpp.o CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o CMakeFiles/Step_3.dir/src/engine/main.cpp.o CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o CMakeFiles/Step_3.dir/src/engine/world.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o CMakeFiles/Step_3.dir/src/graphics/input.cpp.o | /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so build Step_3: CXX_EXECUTABLE_LINKER__Step_3_Release CMakeFiles/Step_3.dir/src/engine/globals.cpp.o CMakeFiles/Step_3.dir/src/engine/image/image.cpp.o CMakeFiles/Step_3.dir/src/engine/main.cpp.o CMakeFiles/Step_3.dir/src/engine/math/colliders.cpp.o CMakeFiles/Step_3.dir/src/engine/raytracing.cpp.o CMakeFiles/Step_3.dir/src/engine/util/debug.cpp.o CMakeFiles/Step_3.dir/src/engine/util/models.cpp.o CMakeFiles/Step_3.dir/src/engine/util/parser.cpp.o CMakeFiles/Step_3.dir/src/engine/world.cpp.o CMakeFiles/Step_3.dir/src/graphics/debug_gui.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.c.o CMakeFiles/Step_3.dir/src/graphics/gl/gl.cpp.o CMakeFiles/Step_3.dir/src/graphics/gl/shader.cpp.o CMakeFiles/Step_3.dir/src/graphics/graphics.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_demo.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_draw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_glfw.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_opengl3.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_impl_x11.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_tables.cpp.o CMakeFiles/Step_3.dir/src/graphics/imgui/imgui_widgets.cpp.o CMakeFiles/Step_3.dir/src/graphics/input.cpp.o | /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libglfw.so.3.3 /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so
FLAGS = -march=native -O3 -DNDEBUG FLAGS = -march=native -O3 -DNDEBUG
LINK_LIBRARIES = -lpthread /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so LINK_LIBRARIES = -lpthread /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libglfw.so.3.3 /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so
OBJECT_DIR = CMakeFiles/Step_3.dir OBJECT_DIR = CMakeFiles/Step_3.dir
POST_BUILD = : POST_BUILD = :
PRE_LINK = : PRE_LINK = :
@ -250,14 +271,14 @@ build all: phony Step_3
############################################# #############################################
# Re-run CMake if any of its inputs changed. # Re-run CMake if any of its inputs changed.
build build.ninja: RERUN_CMAKE | ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake build build.ninja: RERUN_CMAKE | ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake
pool = console pool = console
############################################# #############################################
# A missing CMake input file is not an error. # A missing CMake input file is not an error.
build ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckFunctionExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckLibraryExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFontconfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindFreetype.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPkgConfig.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindX11.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/SelectLibraryConfigurations.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake: phony build ../CMakeLists.txt ../include/engine/config.h.in /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCXXInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeCommonLanguageInclude.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeGenericSystem.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeInitializeConfigs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeLanguageInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakePushCheckState.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInformation.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CMakeSystemSpecificInitialize.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/CheckSymbolExists.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/CMakeCommonCompilerMacros.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Compiler/GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenCL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindOpenGL.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/FindPackageMessage.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-C.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU-CXX.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux-GNU.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/Linux.cmake /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/share/cmake-3.23/Modules/Platform/UnixPaths.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake /usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake CMakeCache.txt CMakeFiles/3.23.2/CMakeCCompiler.cmake CMakeFiles/3.23.2/CMakeCXXCompiler.cmake CMakeFiles/3.23.2/CMakeSystem.cmake: phony
############################################# #############################################

View File

@ -14,6 +14,7 @@
#define COMPILE_GUI #define COMPILE_GUI
#define COMPILE_OPENCL #define COMPILE_OPENCL
#define USE_GLFW
#define CMAKE_CONFIG #define CMAKE_CONFIG
#endif #endif

View File

@ -4,12 +4,17 @@ Size=95,60
Collapsed=0 Collapsed=0
[Window][Dear ImGui Demo] [Window][Dear ImGui Demo]
Pos=952,11 Pos=952,10
Size=550,680 Size=550,680
Collapsed=1 Collapsed=1
[Window][Debug] [Window][Debug]
Pos=60,60 Pos=59,63
Size=74,100 Size=326,186
Collapsed=0
[Window][Debug Menu]
Pos=14,14
Size=339,226
Collapsed=0 Collapsed=0

View File

@ -14,6 +14,7 @@
#cmakedefine COMPILE_GUI #cmakedefine COMPILE_GUI
#cmakedefine COMPILE_OPENCL #cmakedefine COMPILE_OPENCL
#cmakedefine USE_GLFW
#define CMAKE_CONFIG #define CMAKE_CONFIG
#endif #endif

View File

@ -44,6 +44,18 @@ namespace Raytracing {
~Image(); ~Image();
}; };
class ImageInput {
private:
int width, height, channels;
unsigned char* data;
public:
explicit ImageInput(const std::string& image);
unsigned long* getImageAsIconBuffer();
unsigned char* getImageData(){return data;}
[[nodiscard]] int getImageSize() const{return width;}
~ImageInput();
};
// image writer class used to output the image to a file. // image writer class used to output the image to a file.
class ImageOutput { class ImageOutput {
private: private:

File diff suppressed because it is too large Load Diff

View File

@ -426,23 +426,6 @@ namespace Raytracing {
// well they do but there isn't much of a reason to use them since this is for opengl // well they do but there isn't much of a reason to use them since this is for opengl
class Mat4x4 { class Mat4x4 {
protected: protected:
inline float m00(float d) { return data[0] = d; }
inline float m10(float d) { return data[1] = d; }
inline float m20(float d) { return data[2] = d; }
inline float m30(float d) { return data[3] = d; }
inline float m01(float d) { return data[4] = d; }
inline float m11(float d) { return data[5] = d; }
inline float m21(float d) { return data[6] = d; }
inline float m31(float d) { return data[7] = d; }
inline float m02(float d) { return data[8] = d; }
inline float m12(float d) { return data[9] = d; }
inline float m22(float d) { return data[10] = d; }
inline float m32(float d) { return data[11] = d; }
inline float m03(float d) { return data[12] = d; }
inline float m13(float d) { return data[13] = d; }
inline float m23(float d) { return data[14] = d; }
inline float m33(float d) { return data[15] = d; }
inline float m(int i, int j, float d) { return data[i * 16 + j] = d; };
// 4x4 = 16 // 4x4 = 16
float data[16]{}; float data[16]{};
friend Mat4x4 operator+(const Mat4x4& left, const Mat4x4& right); friend Mat4x4 operator+(const Mat4x4& left, const Mat4x4& right);
@ -478,9 +461,9 @@ namespace Raytracing {
} }
inline Mat4x4& translate(const Vec4& vec) { inline Mat4x4& translate(const Vec4& vec) {
m03(vec.x()); m03(float(vec.x()));
m13(vec.y()); m13(float(vec.y()));
m23(vec.z()); m23(float(vec.z()));
return *this; return *this;
} }
@ -492,9 +475,9 @@ namespace Raytracing {
} }
inline Mat4x4& scale(const Vec4& vec) { inline Mat4x4& scale(const Vec4& vec) {
m00(vec.x()); m00(float(vec.x()));
m11(vec.y()); m11(float(vec.y()));
m22(vec.z()); m22(float(vec.z()));
return *this; return *this;
} }
@ -518,7 +501,24 @@ namespace Raytracing {
[[nodiscard]] inline float m13() const { return data[13]; } [[nodiscard]] inline float m13() const { return data[13]; }
[[nodiscard]] inline float m23() const { return data[14]; } [[nodiscard]] inline float m23() const { return data[14]; }
[[nodiscard]] inline float m33() const { return data[15]; } [[nodiscard]] inline float m33() const { return data[15]; }
[[nodiscard]] inline float m(int i, int j) const { return data[i * 16 + j]; }; [[nodiscard]] inline float m(int i, int j) const { return data[i + j * 4]; };
inline float m00(float d) { return data[0] = d; }
inline float m10(float d) { return data[1] = d; }
inline float m20(float d) { return data[2] = d; }
inline float m30(float d) { return data[3] = d; }
inline float m01(float d) { return data[4] = d; }
inline float m11(float d) { return data[5] = d; }
inline float m21(float d) { return data[6] = d; }
inline float m31(float d) { return data[7] = d; }
inline float m02(float d) { return data[8] = d; }
inline float m12(float d) { return data[9] = d; }
inline float m22(float d) { return data[10] = d; }
inline float m32(float d) { return data[11] = d; }
inline float m03(float d) { return data[12] = d; }
inline float m13(float d) { return data[13] = d; }
inline float m23(float d) { return data[14] = d; }
inline float m33(float d) { return data[15] = d; }
inline float m(int i, int j, float d) { return data[i + j * 4] = d; };
}; };
// adds the two Mat4x4 left and right // adds the two Mat4x4 left and right

View File

@ -30,6 +30,11 @@ namespace Raytracing {
PRECISION_TYPE viewportHeight; PRECISION_TYPE viewportHeight;
PRECISION_TYPE viewportWidth; PRECISION_TYPE viewportWidth;
PRECISION_TYPE focalLength = 1.0; PRECISION_TYPE focalLength = 1.0;
const PRECISION_TYPE NEAR_PLANE = 0.1;
const PRECISION_TYPE FAR_PLANE = 500;
PRECISION_TYPE tanFovHalf;
PRECISION_TYPE frustumLength;
Vec4 position{0, 0, 0}; Vec4 position{0, 0, 0};
Vec4 horizontalAxis; Vec4 horizontalAxis;
@ -39,9 +44,11 @@ namespace Raytracing {
Camera(PRECISION_TYPE fov, const Image& image): image(image), Camera(PRECISION_TYPE fov, const Image& image): image(image),
aspectRatio(double(image.getWidth()) / double(image.getHeight())) { aspectRatio(double(image.getWidth()) / double(image.getHeight())) {
// scale the viewport height based on the camera's FOV // scale the viewport height based on the camera's FOV
viewportHeight = (2.0 * tan(degreeeToRadian(fov) / 2)); tanFovHalf = tan(degreeeToRadian(fov) / 2);
viewportHeight = (2.0 * tanFovHalf);
// with must respect the aspect ratio of the image, otherwise we'd get funky results // with must respect the aspect ratio of the image, otherwise we'd get funky results
viewportWidth = (aspectRatio * viewportHeight); viewportWidth = (aspectRatio * viewportHeight);
frustumLength = FAR_PLANE - NEAR_PLANE;
// horizontal direction from the camera. used to translate the camera // horizontal direction from the camera. used to translate the camera
horizontalAxis = (Vec4{viewportWidth, 0, 0, 0}); horizontalAxis = (Vec4{viewportWidth, 0, 0, 0});
// virtual direction, also used to translate the camera // virtual direction, also used to translate the camera
@ -65,6 +72,87 @@ namespace Raytracing {
void setPosition(const Vec4& pos) { this->position = pos; } void setPosition(const Vec4& pos) { this->position = pos; }
void setRotation(PRECISION_TYPE yaw, PRECISION_TYPE pitch, PRECISION_TYPE roll); void setRotation(PRECISION_TYPE yaw, PRECISION_TYPE pitch, PRECISION_TYPE roll);
[[nodiscard]] Mat4x4 project() const {
Mat4x4 project;
// this should be all it takes to create a mostly correct projection matrix
project.m00(float(1.0 / (aspectRatio * tanFovHalf)));
project.m11(float(1.0 / tanFovHalf));
project.m22(float(-((FAR_PLANE + NEAR_PLANE) / frustumLength)));
project.m23(-1);
project.m32(float(-((2 * NEAR_PLANE * FAR_PLANE) / frustumLength)));
//project.m33(0);
return project;
}
Mat4x4 view(const Vec4& lookAtPos, const Vec4& up){
Mat4x4 view;
auto w = (position - lookAtPos).normalize(); // forward
auto u = (Vec4::cross(up, w)).normalize(); // right
auto v = Vec4::cross(w, u); // up
view.m00(float(w.x()));
view.m01(float(w.y()));
view.m02(float(w.z()));
view.m03(float(w.w()));
view.m10(float(u.x()));
view.m11(float(u.y()));
view.m12(float(u.z()));
view.m13(float(u.w()));
view.m20(float(v.x()));
view.m21(float(v.y()));
view.m22(float(v.z()));
view.m23(float(v.w()));
// view matrix are inverted, dot product to simulate translate matrix multiplication
view.m30(-float(Vec4::dot(u, position)));
view.m31(-float(Vec4::dot(v, position)));
view.m32(-float(Vec4::dot(w, position)));
view.m33(1);
return view;
}
Mat4x4 view(PRECISION_TYPE yaw, PRECISION_TYPE pitch) {
Mat4x4 view;
pitch = degreeeToRadian(pitch);
yaw = degreeeToRadian(yaw);
PRECISION_TYPE cosPitch = std::cos(pitch);
PRECISION_TYPE cosYaw = std::cos(yaw);
PRECISION_TYPE sinPitch = std::sin(pitch);
PRECISION_TYPE sinYaw = std::sin(yaw);
auto x = Vec4{cosYaw, 0, -sinYaw}; // forward
auto y = Vec4{sinYaw * sinPitch, cosPitch, cosYaw * sinPitch}; // right
auto z = Vec4{sinYaw * cosPitch, -sinPitch, cosPitch * cosYaw}; // up
view.m00(float(x.x()));
view.m01(float(x.y()));
view.m02(float(x.z()));
view.m03(float(x.w()));
view.m10(float(y.x()));
view.m11(float(y.y()));
view.m12(float(y.z()));
view.m13(float(y.w()));
view.m20(float(z.x()));
view.m21(float(z.y()));
view.m22(float(z.z()));
view.m23(float(z.w()));
// view matrix are inverted, dot product to simulate translate matrix multiplication
view.m30(-float(Vec4::dot(x, position)));
view.m31(-float(Vec4::dot(y, position)));
view.m32(-float(Vec4::dot(z, position)));
view.m33(1);
return view;
}
[[nodiscard]] inline Vec4 getPosition() const {return position;};
}; };

View File

@ -13,6 +13,10 @@
#define STEP_2_DEBUG_H #define STEP_2_DEBUG_H
#include "std.h" #include "std.h"
#include <config.h>
#ifdef COMPILE_GUI
#include <graphics/debug_gui.h>
#endif
namespace Raytracing { namespace Raytracing {
class profiler; class profiler;

View File

@ -112,7 +112,7 @@ namespace Raytracing {
* saving on computation * saving on computation
*/ */
// TODO: the above todo has been done, now we need to test the performance advantage of the BVH // TODO: the above todo has been done, now we need to test the performance advantage of the BVH
//BVHTree* bvhTree = nullptr; BVHTree* bvhTree = nullptr;
std::unordered_map<std::string, Material*> materials; std::unordered_map<std::string, Material*> materials;
public: public:
World() = default; World() = default;

View File

@ -0,0 +1,20 @@
/*
* Created by Brett Terpstra 6920201 on 30/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*/
#ifndef STEP_3_DEBUG_GUI_H
#define STEP_3_DEBUG_GUI_H
#include <functional>
#include <string>
namespace Raytracing {
class DebugUI {
public:
static void render(const std::function<void()>& generalTab);
static void registerTab(const std::string& name, const std::function<void()>& tabFunc);
};
}
#endif //STEP_3_DEBUG_GUI_H

View File

@ -10,19 +10,25 @@
#include <engine/util/std.h> #include <engine/util/std.h>
#include <engine/types.h> #include <engine/types.h>
#include <engine/image/image.h> #include <engine/image/image.h>
#include <GLES3/gl32.h> #include <config.h>
#include <GLES3/gl3.h> #include <graphics/gl/shader.h>
#include <GL/gl.h> #ifndef USE_GLFW
#include "graphics/gl/glext.h" #include <GLES3/gl32.h>
#include <GLES3/gl3.h>
extern PFNGLCREATEVERTEXARRAYSPROC glCreateVertexArrays; #include <GL/gl.h>
extern PFNGLCREATEBUFFERSPROC glCreateBuffers; #include "graphics/gl/glext.h"
extern PFNGLNAMEDBUFFERDATAPROC glNamedBufferData;
extern PFNGLNAMEDBUFFERSUBDATAPROC glNamedBufferSubData; extern PFNGLCREATEVERTEXARRAYSPROC glCreateVertexArrays;
extern PFNGLCREATEBUFFERSPROC glCreateBuffers;
extern PFNGLENABLEVERTEXARRAYATTRIBPROC glEnableVertexArrayAttrib; extern PFNGLNAMEDBUFFERDATAPROC glNamedBufferData;
extern PFNGLVERTEXARRAYATTRIBBINDINGPROC glVertexArrayAttribBinding; extern PFNGLNAMEDBUFFERSUBDATAPROC glNamedBufferSubData;
extern PFNGLVERTEXARRAYATTRIBFORMATPROC glVertexArrayAttribFormat;
extern PFNGLENABLEVERTEXARRAYATTRIBPROC glEnableVertexArrayAttrib;
extern PFNGLVERTEXARRAYATTRIBBINDINGPROC glVertexArrayAttribBinding;
extern PFNGLVERTEXARRAYATTRIBFORMATPROC glVertexArrayAttribFormat;
#else
#include <graphics/gl/glad/gl.h>
#endif
// since we are doing everything with raytracing // since we are doing everything with raytracing
// the purpose of these utility classes are purely for debug // the purpose of these utility classes are purely for debug
@ -83,7 +89,7 @@ class VAO {
// draws as if it where a fullscreen quad (literally used for that) // draws as if it where a fullscreen quad (literally used for that)
void draw() const; void draw() const;
// draw as if it's a box that we need to bulk draw. // draw as if it's a box that we need to bulk draw.
void draw(const std::vector<Raytracing::Vec4>& positions); void draw(Raytracing::Shader& shader, const std::vector<Raytracing::Vec4>& positions);
~VAO(); ~VAO();
}; };

View File

@ -8,10 +8,16 @@
#include "engine/util/std.h" #include "engine/util/std.h"
#include "engine/math/vectors.h" #include "engine/math/vectors.h"
#include <GL/gl.h> #include <config.h>
#include <GLES3/gl32.h> #ifndef USE_GLFW
#include <GL/glx.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GLES3/gl32.h>
#include <GL/glx.h>
#include <GL/glu.h>
#else
#include <graphics/gl/glad/gl.h>
#endif
// opengl shader // opengl shader

View File

@ -11,16 +11,23 @@
// we are using the GLX extension to the X11 windowing system // we are using the GLX extension to the X11 windowing system
// instead of using external libs like GLFW and GLAD. // instead of using external libs like GLFW and GLAD.
// Wayland is not and will not be supported. // Wayland is not and will not be supported.
#include <X11/X.h> #include <config.h>
#include <X11/Xlib.h> #ifndef USE_GLFW
#include <GLES3/gl32.h> #include <X11/X.h>
#include <GL/gl.h> #include <X11/Xlib.h>
#include <GL/glx.h> #include <GLES3/gl32.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include "graphics/imgui/imgui_impl_x11.h"
#else
#include <graphics/gl/glad/gl.h>
#include <GLFW/glfw3.h>
#include "graphics/imgui/imgui_impl_glfw.h"
#endif
#include <config.h> #include <config.h>
#include <engine/util/std.h> #include <engine/util/std.h>
#include <functional> #include <functional>
#include <graphics/input.h> #include <graphics/input.h>
#include "graphics/imgui/imgui_impl_glfw.h"
#include "graphics/imgui/imgui_impl_opengl3.h" #include "graphics/imgui/imgui_impl_opengl3.h"
#include <engine/image/image.h> #include <engine/image/image.h>
#include <engine/types.h> #include <engine/types.h>
@ -30,6 +37,21 @@ namespace Raytracing {
void drawQuad(); void drawQuad();
void deleteQuad(); void deleteQuad();
#ifdef USE_GLFW
class XWindow {
private:
GLFWwindow* window;
int m_displayWidth, m_displayHeight;
bool isCloseRequested = false;
public:
XWindow(int width, int height);
// runs X11 event processing and some GL commands used for window drawing
void runUpdates(const std::function<void()>& drawFunction);
[[nodiscard]] inline bool shouldWindowClose() const{ return isCloseRequested; }
void closeWindow();
~XWindow();
};
#else
class XWindow { class XWindow {
private: private:
// X11 display itself // X11 display itself
@ -78,6 +100,7 @@ namespace Raytracing {
void closeWindow(); void closeWindow();
~XWindow(); ~XWindow();
}; };
#endif
} }
#endif //STEP_3_GRAPHICS_H #endif //STEP_3_GRAPHICS_H

View File

@ -1,15 +1,3 @@
/*
* Created by Brett Terpstra 6920201 on 25/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*
* I HAVE MODIFIED THIS FILE SIGNIFICANTLY!
* I AM NOT USING GLFW
* BUT HAVE TAKEN THE BACKEND FOR IT AND ADAPTED IT FOR RAW X11
*/
#ifndef STEP_3_IMGUI_IMPL_GLFW_H
#define STEP_3_IMGUI_IMPL_GLFW_H
// dear imgui: Platform Backend for GLFW // dear imgui: Platform Backend for GLFW
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..) // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
@ -25,27 +13,30 @@
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs // Read online: https://github.com/ocornut/imgui/tree/master/docs
#include "graphics/imgui/imgui.h" // IMGUI_IMPL_API #pragma once
#include "imgui.h" // IMGUI_IMPL_API
struct GLFWwindow;
struct GLFWmonitor;
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks);
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks);
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks);
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(double time, int display_w, int display_h, int w, int h); IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
IMGUI_IMPL_API bool ImGui_ImplGlfw_Init();
// GLFW callbacks (installer) // GLFW callbacks (installer)
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any. // - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks. // - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(); IMGUI_IMPL_API void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window);
IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(); IMGUI_IMPL_API void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window);
// GLFW callbacks (individual callbacks to call if you didn't install callbacks) // GLFW callbacks (individual callbacks to call if you didn't install callbacks)
IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(int focused); // Since 1.84 IMGUI_IMPL_API void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused); // Since 1.84
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(int entered, bool cursorVisible); // Since 1.84 IMGUI_IMPL_API void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered); // Since 1.84
IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(double x, double y, bool cursorVisible); // Since 1.87 IMGUI_IMPL_API void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y); // Since 1.87
IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(unsigned int button, bool pressed, int mods); IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(double xoffset, double yoffset); IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(unsigned int key, int scancode, bool pressed, int mods); IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(unsigned int c); IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c);
IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(int event); IMGUI_IMPL_API void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor* monitor, int event);
IMGUI_IMPL_API void ImGui_ImplGlfw_UpdateMouseData(bool cursorVisible, bool focused);
#endif //STEP_3_IMGUI_IMPL_GLFW_H

View File

@ -0,0 +1,51 @@
/*
* Created by Brett Terpstra 6920201 on 25/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*
* I HAVE MODIFIED THIS FILE SIGNIFICANTLY!
* I AM NOT USING GLFW
* BUT HAVE TAKEN THE BACKEND FOR IT AND ADAPTED IT FOR RAW X11
*/
#ifndef STEP_3_IMGUI_IMPL_X11_H
#define STEP_3_IMGUI_IMPL_X11_H
// dear imgui: Platform Backend for GLFW
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// Implemented features:
// [X] Platform: Clipboard support.
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs
#include "graphics/imgui/imgui.h" // IMGUI_IMPL_API
IMGUI_IMPL_API void ImGui_ImplX11_Shutdown();
IMGUI_IMPL_API void ImGui_ImplX11_NewFrame(double time, int display_w, int display_h, int w, int h);
IMGUI_IMPL_API bool ImGui_ImplX11_Init();
// GLFW callbacks (installer)
// - When calling Init with 'install_callbacks=true': ImGui_ImplX11_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
IMGUI_IMPL_API void ImGui_ImplX11_InstallCallbacks();
IMGUI_IMPL_API void ImGui_ImplX11_RestoreCallbacks();
// GLFW callbacks (individual callbacks to call if you didn't install callbacks)
IMGUI_IMPL_API void ImGui_ImplX11_WindowFocusCallback(int focused); // Since 1.84
IMGUI_IMPL_API void ImGui_ImplX11_CursorEnterCallback(int entered, bool cursorVisible); // Since 1.84
IMGUI_IMPL_API void ImGui_ImplX11_CursorPosCallback(double x, double y, bool cursorVisible); // Since 1.87
IMGUI_IMPL_API void ImGui_ImplX11_MouseButtonCallback(unsigned int button, bool pressed, int mods);
IMGUI_IMPL_API void ImGui_ImplX11_ScrollCallback(double xoffset, double yoffset);
IMGUI_IMPL_API void ImGui_ImplX11_KeyCallback(unsigned int key, int scancode, bool pressed, int mods);
IMGUI_IMPL_API void ImGui_ImplX11_CharCallback(unsigned int c);
IMGUI_IMPL_API void ImGui_ImplX11_MonitorCallback(int event);
IMGUI_IMPL_API void ImGui_ImplX11_UpdateMouseData(bool cursorVisible, bool focused);
#endif //STEP_3_IMGUI_IMPL_X11_H

View File

@ -0,0 +1,15 @@
#version 330 core
out vec4 FragColor;
in vec2 outUv;
in vec3 outNormal;
uniform sampler2D tex;
const vec3 lightDir = vec3(1.0, 1.0, 1.0);
void main() {
vec4 textureColor = texture(tex, outUv);
//FragColor = vec4(textureColor.rgb, 1.0f);
FragColor = vec4(vec3(1.0, 0.0f, 0.0f) * dot(lightDir, outNormal), 1.0f);
}

View File

@ -0,0 +1,18 @@
#version 330 core
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec2 inUv;
layout (location = 2) in vec3 inNormal;
out vec2 outUv;
out vec3 outNormal;
uniform mat4 transform;
uniform mat4 projectMatrix;
uniform mat4 ViewMatrix;
void main() {
gl_Position = projectMatrix * ViewMatrix * transform * vec4(inPos, 1.0);
outUv = inUv;
outNormal = inNormal;
}

View File

@ -7,6 +7,9 @@
#include <fstream> #include <fstream>
#define STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION
#include "engine/image/stb_image_write.h" #include "engine/image/stb_image_write.h"
#include "engine/image/stb_image.h"
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include "engine/image/stb_image_resize.h"
namespace Raytracing { namespace Raytracing {
@ -91,4 +94,26 @@ namespace Raytracing {
delete[](data); delete[](data);
} }
} }
ImageInput::ImageInput(const std::string& image) {
data = stbi_load(image.c_str(), &width, &height, &channels, 4);
}
unsigned long* ImageInput::getImageAsIconBuffer() {
const int size = 32;
unsigned char newData[size * size * channels];
auto* returnData = new unsigned long[size * size + 2];
stbir_resize_uint8(data, width, height, 0, newData, size, size, 0, channels);
int charPoint = 0;
returnData[charPoint++] = size;
returnData[charPoint++] = size;
for (int i = 0; i < size; i++){
for (int j = 0; j < size; j++){
unsigned long dtr = (((const unsigned long*) data)[i + j * size]);
returnData[i + j * size + 2] = (dtr >> 48) | (dtr << ((sizeof(unsigned long)*8) - 48));
}
}
return returnData;
}
ImageInput::~ImageInput() {
stbi_image_free(data);
}
} }

View File

@ -132,46 +132,78 @@ int main(int argc, char** args) {
world.add(new Raytracing::ModelObject({0, 0, 5}, house, world.getMaterial("blueDiffuse"))); world.add(new Raytracing::ModelObject({0, 0, 5}, house, world.getMaterial("blueDiffuse")));
Raytracing::Raycaster raycaster{camera, image, world, parser}; Raytracing::Raycaster raycaster{camera, image, world, parser};
static bool started = false; static bool started = false, debug = false;
static int maxRayBounce = 50;
static int raysPerPixel = 50;
raycaster.updateRayInfo(maxRayBounce, raysPerPixel);
if (parser.hasOption("--gui") || parser.hasOption("-g")) { if (parser.hasOption("--gui") || parser.hasOption("-g")) {
#ifdef COMPILE_GUI #ifdef COMPILE_GUI
XWindow window(1440, 720); XWindow window(1440, 720);
Texture mainImage(&image); Texture mainImage(&image);
auto spiderVAO = new VAO(spider.toTriangles());
auto houseVAO = new VAO(house.toTriangles());
auto planeVAO = new VAO(plane.toTriangles());
Shader shader("../resources/shaders/basic.vs", "../resources/shaders/basic.fs"); Shader shader("../resources/shaders/basic.vs", "../resources/shaders/basic.fs");
Shader worldShader("../resources/shaders/world.vs", "../resources/shaders/world.fs");
while (!window.shouldWindowClose()) { while (!window.shouldWindowClose()) {
window.runUpdates([&window, &mainImage, &shader, &raycaster, &parser]() -> void { window.runUpdates([&window, &mainImage, &shader, &raycaster, &parser, &worldShader, &spiderVAO, &houseVAO, &planeVAO, &camera]() -> void {
if (*haltExecution){window.closeWindow();} if (*haltExecution){window.closeWindow();}
ImGui::Begin("Debug"); DebugUI::render([&raycaster, &parser]() -> void {
if (ImGui::Button("Start") && !started){ if (ImGui::Button("Start") && !started){
started = true; started = true;
*haltRaytracing = false; *haltRaytracing = false;
ilog << "Running raycaster!\n"; ilog << "Running raycaster!\n";
if(parser.hasOption("--multi")) { if(parser.hasOption("--multi")) {
raycaster.runMulti(std::max(std::stoi(parser.getOptionValue("-t")), std::stoi(parser.getOptionValue("--threads")))); raycaster.runMulti(std::max(std::stoi(parser.getOptionValue("-t")), std::stoi(parser.getOptionValue("--threads"))));
} else { // we don't actually have to check for --single since it's implied to be default true. } else { // we don't actually have to check for --single since it's implied to be default true.
raycaster.runSingle(); raycaster.runSingle();
}
} }
} if (ImGui::Checkbox("Pause", pauseRaytracing)){}
if (ImGui::Checkbox("Pause", pauseRaytracing)){} if (ImGui::Button("Stop") && started){
if (ImGui::Button("Stop") && started){ *haltRaytracing = true;
*haltRaytracing = true; started = false;
started = false; raycaster.deleteThreads();
raycaster.deleteThreads(); }
} ImGui::NewLine();
ImGui::End(); ImGui::InputInt("Max Ray Bounce", &maxRayBounce);
ImGui::InputInt("Rays Per Pixel", &raysPerPixel);
raycaster.updateRayInfo(maxRayBounce, raysPerPixel);
ImGui::Checkbox("Debug", &debug);
});
if (debug){
shader.use(); auto projection = camera.project();
mainImage.updateImage(); static float yaw = 0;
mainImage.bind(); yaw += 1.0/60.0;
mainImage.enableGlTextures(1); auto view = camera.view(yaw, 0);
drawQuad(); worldShader.setMatrix("projectMatrix", projection);
worldShader.setMatrix("ViewMatrix", view);
worldShader.use();
spiderVAO->bind();
spiderVAO->draw(worldShader, {{0, 1, 0}});
houseVAO->bind();
houseVAO->draw(worldShader, {{5, 1, 0}, {0, 0, -5}, {0, 0, 5}});
planeVAO->bind();
planeVAO->draw(worldShader, {{-5, 0.5, 0}});
} else {
shader.use();
mainImage.updateImage();
mainImage.bind();
mainImage.enableGlTextures(1);
drawQuad();
}
mainImage.updateImage(); mainImage.updateImage();
}); });
} }
*haltExecution = true;
raycaster.join();
delete(spiderVAO);
delete(houseVAO);
delete(planeVAO);
#else #else
flog << "Program not compiled with GUI support! Unable to continue!\n"; flog << "Program not compiled with GUI support! Unable to continue!\n";
#endif #endif

View File

@ -182,10 +182,8 @@ namespace Raytracing {
PRECISION_TYPE sf = 1.0 / raysPerPixel; PRECISION_TYPE sf = 1.0 / raysPerPixel;
// apply pixel color with gamma correction // apply pixel color with gamma correction
image.setPixelColor(x, y, {std::sqrt(sf * color.r()), std::sqrt(sf * color.g()), std::sqrt(sf * color.b())}); image.setPixelColor(x, y, {std::sqrt(sf * color.r()), std::sqrt(sf * color.g()), std::sqrt(sf * color.b())});
if (*haltExecution || *haltRaytracing) { if (*haltExecution || *haltRaytracing)
tlog << "Halting raytracing! " << *haltExecution << " " << *haltRaytracing << " " << i << "\n";
return; return;
}
while (*pauseRaytracing) // sleep for 1/60th of a second, or about 1 frame. while (*pauseRaytracing) // sleep for 1/60th of a second, or about 1 frame.
std::this_thread::sleep_for(std::chrono::milliseconds(16)); std::this_thread::sleep_for(std::chrono::milliseconds(16));
} catch (std::exception& error) { } catch (std::exception& error) {
@ -196,7 +194,6 @@ namespace Raytracing {
} }
j++; j++;
} }
tlog << "ex threead " << i << "\n";
finishedThreads++; finishedThreads++;
profiler::end("Raytracer Results", str.str()); profiler::end("Raytracer Results", str.str());
})); }));

View File

@ -57,7 +57,8 @@ namespace Raytracing {
} }
std::pair<HitData, Object*> World::checkIfHit(const Ray& ray, PRECISION_TYPE min, PRECISION_TYPE max) const { std::pair<HitData, Object*> World::checkIfHit(const Ray& ray, PRECISION_TYPE min, PRECISION_TYPE max) const {
/*if (bvhTree != nullptr){ // actually speeds up rendering by about 110,000ms (total across 16 threads)
if (bvhTree != nullptr){
auto hResult = HitData{false, Vec4(), Vec4(), max}; auto hResult = HitData{false, Vec4(), Vec4(), max};
Object* objPtr = nullptr; Object* objPtr = nullptr;
@ -86,7 +87,7 @@ namespace Raytracing {
} }
return {hResult, objPtr}; return {hResult, objPtr};
} else {*/ } else {
// rejection algo without using a binary space partitioning data structure // rejection algo without using a binary space partitioning data structure
auto hResult = HitData{false, Vec4(), Vec4(), max}; auto hResult = HitData{false, Vec4(), Vec4(), max};
Object* objPtr = nullptr; Object* objPtr = nullptr;
@ -100,11 +101,11 @@ namespace Raytracing {
} }
} }
return {hResult, objPtr}; return {hResult, objPtr};
//} }
} }
void World::generateBVH() { void World::generateBVH() {
//bvhTree = new BVHTree(objects); bvhTree = new BVHTree(objects);
} }
ScatterResults DiffuseMaterial::scatter(const Ray& ray, const HitData& hitData) const { ScatterResults DiffuseMaterial::scatter(const Ray& ray, const HitData& hitData) const {

View File

@ -0,0 +1,41 @@
/*
* Created by Brett Terpstra 6920201 on 30/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*/
#include <graphics/debug_gui.h>
#include <engine/util/std.h>
#include <graphics/imgui/imgui.h>
// this file is only included if the compile gui setting is enabled in CMake
namespace Raytracing {
std::vector<std::pair<std::string, std::function<void()>>> tabs;
void DebugUI::render(const std::function<void()>& generalTab) {
if (ImGui::Begin("Debug Menu", nullptr, ImGuiWindowFlags_AlwaysAutoResize)){
if (ImGui::BeginTabBar("debugTabs")){
// Always have the general tab for starting / stopping the ray tracer
if (ImGui::BeginTabItem("General")) {
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate,
ImGui::GetIO().Framerate);
generalTab();
ImGui::EndTabItem();
}
// add any extra tabs after
for (const auto& tab: tabs) {
if (ImGui::BeginTabItem(tab.first.c_str())) {
tab.second();
ImGui::EndTabItem();
}
}
ImGui::EndTabBar();
}
}
ImGui::End();
}
void DebugUI::registerTab(const std::string& name, const std::function<void()>& tabFunc) {
tabs.emplace_back(name, tabFunc);
}
}

View File

@ -6,8 +6,9 @@
#include <graphics/gl/gl.h> #include <graphics/gl/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include <graphics/gl/stb_image.h> #include "engine/image/stb_image.h"
#ifndef USE_GLFW
PFNGLCREATEVERTEXARRAYSPROC glCreateVertexArrays; PFNGLCREATEVERTEXARRAYSPROC glCreateVertexArrays;
PFNGLCREATEBUFFERSPROC glCreateBuffers; PFNGLCREATEBUFFERSPROC glCreateBuffers;
PFNGLNAMEDBUFFERDATAPROC glNamedBufferData; PFNGLNAMEDBUFFERDATAPROC glNamedBufferData;
@ -29,6 +30,7 @@ void assignGLFunctionPointers() {
glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC) glXGetProcAddress((unsigned char*) "glVertexArrayAttribFormat"); glVertexArrayAttribFormat = (PFNGLVERTEXARRAYATTRIBFORMATPROC) glXGetProcAddress((unsigned char*) "glVertexArrayAttribFormat");
} }
#endif
unsigned int createVAO() { unsigned int createVAO() {
unsigned int vaoID; unsigned int vaoID;
@ -107,9 +109,6 @@ VAO::VAO(const std::vector<float>& verts, const std::vector<float>& uvs, const s
// enable the attributes, prevents us from having to do this later. // enable the attributes, prevents us from having to do this later.
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
// redundant DSA nonsense. TODO: remove? my plan was to switch to GL4.6 idk if wise.
(*glEnableVertexArrayAttrib)(VaoID, 0);
(*glEnableVertexArrayAttrib)(VaoID, 1);
// store index data // store index data
storeData((int)indices.size(), indices.data()); storeData((int)indices.size(), indices.data());
// store vertex data // store vertex data
@ -119,14 +118,11 @@ VAO::VAO(const std::vector<float>& verts, const std::vector<float>& uvs, const s
unbind(); unbind();
} }
VAO::VAO(const std::vector<Raytracing::Triangle>& triangles): VaoID(createVAO()) { VAO::VAO(const std::vector<Raytracing::Triangle>& triangles): VaoID(createVAO()) {
this->drawCount = (int)triangles.size(); this->drawCount = (int)triangles.size() * 3;
glBindVertexArray(VaoID); glBindVertexArray(VaoID);
// enable the attributes, prevents us from having to do this later. // enable the attributes, prevents us from having to do this later.
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
// redundant DSA nonsense. TODO: remove? my plan was to switch to GL4.6 idk if wise.
(*glEnableVertexArrayAttrib)(VaoID, 0);
(*glEnableVertexArrayAttrib)(VaoID, 1);
// convert vertex data // convert vertex data
std::vector<float> verts; std::vector<float> verts;
std::vector<float> uvs; std::vector<float> uvs;
@ -173,12 +169,12 @@ VAO::VAO(const std::vector<Raytracing::Triangle>& triangles): VaoID(createVAO())
storeData(2, 3, 3 * sizeof(float), 0, (int)normals.size(), normals.data()); storeData(2, 3, 3 * sizeof(float), 0, (int)normals.size(), normals.data());
// create an instance buffer with a large number of positions (stored in matrices) // create an instance buffer with a large number of positions (stored in matrices)
// this way we don't have to expand it later, since I don't think I'll use 1k // this way we don't have to expand it later, since I don't think I'll use 1k
createInstanceVBO(1000, sizeof(Raytracing::Mat4x4)); // createInstanceVBO(1000, sizeof(Raytracing::Mat4x4));
// send the positions as attributes // // send the positions as attributes
addInstancedAttribute(3, 4, sizeof(Raytracing::Mat4x4), 0); // addInstancedAttribute(3, 4, sizeof(Raytracing::Mat4x4), 0);
addInstancedAttribute(4, 4, sizeof(Raytracing::Mat4x4), 16); // addInstancedAttribute(4, 4, sizeof(Raytracing::Mat4x4), 16);
addInstancedAttribute(5, 4, sizeof(Raytracing::Mat4x4), 32); // addInstancedAttribute(5, 4, sizeof(Raytracing::Mat4x4), 32);
addInstancedAttribute(6, 4, sizeof(Raytracing::Mat4x4), 48); // addInstancedAttribute(6, 4, sizeof(Raytracing::Mat4x4), 48);
unbind(); unbind();
} }
void VAO::bind() const { void VAO::bind() const {
@ -188,24 +184,30 @@ void VAO::unbind() {
glBindVertexArray(0); glBindVertexArray(0);
VaoID; VaoID;
} }
void VAO::draw(const std::vector<Raytracing::Vec4>& positions) { void VAO::draw(Raytracing::Shader& shader, const std::vector<Raytracing::Vec4>& positions) {
// this should only update if we are drawing with more positions than we already have allocated. // this should only update if we are drawing with more positions than we already have allocated.
createInstanceVBO((int)positions.size(), sizeof(Raytracing::Mat4x4)); // createInstanceVBO((int)positions.size(), sizeof(Raytracing::Mat4x4));
std::vector<Raytracing::Mat4x4> data; // std::vector<Raytracing::Mat4x4> data;
for (const Raytracing::Vec4& v : positions){ // for (const Raytracing::Vec4& v : positions){
// identity matrix // // identity matrix
Raytracing::Mat4x4 mat4X4 {}; // Raytracing::Mat4x4 mat4X4 {};
// translate to position // // translate to position
mat4X4 = mat4X4.translate(v); // mat4X4 = mat4X4.translate(v);
data.push_back(mat4X4); // data.push_back(mat4X4);
} // }
// send translated matrices as data to the GPU, TODO: since this will likely be used on static geometry, try making this more static! // send translated matrices as data to the GPU, TODO: since this will likely be used on static geometry, try making this more static!
glBindBuffer(GL_ARRAY_BUFFER, instanceVBO); // glBindBuffer(GL_ARRAY_BUFFER, instanceVBO);
//glBufferData(GL_ARRAY_BUFFER, datas.size() * sizeof(LightData), NULL, GL_STREAM_DRAW); // //glBufferData(GL_ARRAY_BUFFER, datas.size() * sizeof(LightData), NULL, GL_STREAM_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, (long)(data.size() * sizeof(Raytracing::Mat4x4)), &data[0]); // glBufferSubData(GL_ARRAY_BUFFER, 0, (long)(data.size() * sizeof(Raytracing::Mat4x4)), &data[0]);
glBindBuffer(GL_ARRAY_BUFFER, 0); // glBindBuffer(GL_ARRAY_BUFFER, 0);
// then finally draw // // then finally draw
glDrawArraysInstanced(GL_TRIANGLES, 0, drawCount * 3, (int)positions.size()); //glDrawArraysInstanced(GL_TRIANGLES, 0, drawCount * 3, (int)positions.size());
for (const auto& v : positions) {
Raytracing::Mat4x4 transform {};
transform.translate(v);
shader.setMatrix("transform", transform);
glDrawArrays(GL_TRIANGLES, 0, drawCount);
}
} }
void VAO::draw() const { void VAO::draw() const {
if (drawCount < 0) if (drawCount < 0)

View File

@ -4,8 +4,8 @@
*/ */
#include <graphics/graphics.h> #include <graphics/graphics.h>
#include <chrono> #include <chrono>
#include <GLES/glext.h>
#include <graphics/gl/gl.h> #include <graphics/gl/gl.h>
#include "engine/image/stb_image.h"
namespace Raytracing { namespace Raytracing {
@ -61,10 +61,115 @@ namespace Raytracing {
delete (quad); delete (quad);
} }
// unfortunately GLX doesn't provide a typedef for the context creation, so we must define our own. I've chosen to go with the same style as struct ImageData {
// GL function pointers, "Pointer to the FunctioN GLX createContextAttribsARB PROCedure" unsigned char* data;
typedef GLXContext (* PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*, GLXFBConfig, GLXContext, Bool, const int*); int width;
int height;
int channels;
};
GLFWimage getImageData(const std::string& file) {
GLFWimage imager;
int channels = 0;
imager.pixels = stbi_load(file.c_str(), &imager.width, &imager.height, &channels, 4);
return imager;
}
#ifdef USE_GLFW
XWindow::XWindow(int width, int height): m_displayWidth(width), m_displayHeight(height) {
// OpenGL 4.6 is like 5 years old at this point and most systems support it
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
// We only generated GLAD headers for GL core profile. Plus renderdoc only support core profile.
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Apple stuff. Not like apple supports GL4.6 anyways :/
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_VISIBLE, GL_TRUE);
glfwWindowHint(GLFW_DECORATED, GL_TRUE);
glfwWindowHint(GLFW_FOCUSED, GL_TRUE);
glfwSetErrorCallback([](int error_code, const char* description) -> void {
elog << "GLFW Error: " << error_code << "\n\t" << description << "\n";
});
if (!glfwInit())
throw std::runtime_error("Unable to init GLFW!\n");
// create a window using the above settings,
window = glfwCreateWindow(width, height, "GLFW 3P93 Raytracing Project", NULL, NULL);
if (!window)
throw std::runtime_error("Unable to create GLFW window!\n");
glfwMakeContextCurrent(window);
// enable V-Sync.
glfwSwapInterval(1);
// setup the callbacks we might use.
auto imageData16 = getImageData("../resources/icon/icon16.png");
auto imageData32 = getImageData("../resources/icon/icon32.png");
GLFWimage images[2];
// TODO: delete STBI_resize
images[0] = imageData16;
images[1] = imageData32;
glfwSetWindowIcon(window, 2, images);
stbi_image_free(imageData16.pixels);
stbi_image_free(imageData32.pixels);
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
// create ImGUI GLFW instance and install the callbacks
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 130");
int version = gladLoadGL(glfwGetProcAddress);
if(!version)
throw std::runtime_error("Unable to load Glad GL!\n");
glfwShowWindow(window);
ilog << "Loaded GL" << GLAD_VERSION_MAJOR(version) << "." << GLAD_VERSION_MINOR(version) << "!\n";
}
void XWindow::runUpdates(const std::function<void()>& drawFunction) {
// check for window events
isCloseRequested = glfwWindowShouldClose(window);
glfwPollEvents();
// update window settings
glfwGetFramebufferSize(window, &m_displayWidth, &m_displayHeight);
glViewport(0, 0, m_displayWidth, m_displayHeight);
glClearColor(0.5, 0.7, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::ShowDemoWindow(nullptr);
drawFunction();
// Render ImGUI
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
}
void XWindow::closeWindow() {
if (isCloseRequested)
return;
tlog << "Closing window!\n";
isCloseRequested = true;
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwDestroyWindow(window);
glfwTerminate();
}
XWindow::~XWindow() {
closeWindow();
}
#else
XWindow::XWindow(int width, int height): m_width(width), m_height(height) { XWindow::XWindow(int width, int height): m_width(width), m_height(height) {
// open the DEFAULT display. We don't want to open a specific screen as that is annoying. // open the DEFAULT display. We don't want to open a specific screen as that is annoying.
dlog << "Creating X11 display!\n"; dlog << "Creating X11 display!\n";
@ -145,19 +250,47 @@ namespace Raytracing {
CWColormap | CWEventMask, CWColormap | CWEventMask,
&xSetWindowAttributes); &xSetWindowAttributes);
// install a error handler // install a error handler
// maybe we should set back the old one but i'd rather it goto std:err than crash the window // maybe we should set back the old one but I'd rather it goto std:err than crash the window
XSetErrorHandler([](Display* displayPtr, XErrorEvent* eventPtr) -> int { XSetErrorHandler([](Display* displayPtr, XErrorEvent* eventPtr) -> int {
elog << "An error occurred while trying to setup X11: " << eventPtr->error_code << ";\n " << eventPtr->minor_code << ";\n " elog << "An error occurred while trying to setup X11: " << eventPtr->error_code << ";\n " << eventPtr->minor_code << ";\n "
<< eventPtr->request_code << "\n"; << eventPtr->request_code << "\n";
return 0; return 0;
}); });
// Now show the window
XMapWindow(display, window);
XStoreName(display, window, "3P93 Raytracing Project"); XStoreName(display, window, "3P93 Raytracing Project");
ImageInput image("../resources/icon/icon.png");
auto* imageData = image.getImageAsIconBuffer();
auto hints = XAllocWMHints();
hints->flags = IconPixmapHint | StateHint | IconPositionHint;
auto pixMapRob = XCreateBitmapFromData(display, window, (const char*) (icon_bits), 32, 32);
if (!pixMapRob)
flog << "Unable to create icon pixel map\n";
hints->icon_pixmap = pixMapRob;
hints->initial_state = IconicState;
hints->icon_x = 0;
hints->icon_y = 0;
XSetWMHints(display, window, hints);
XFree(hints);
int length = 32 * 32 + 2;
//int length = 16 * 16 * 4 + 32*32 * 4 + 4 * 4;
XChangeProperty(display,
window,
XInternAtom(display, "_NET_WM_ICON", False),
XInternAtom(display, "CARDINAL", False),
32,
PropModeReplace,
(const unsigned char*) imageData,
length);
delete[](imageData);
// there might actually be an argument to be made about X11 being outdated.... // there might actually be an argument to be made about X11 being outdated....
wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", True); wmDelete = XInternAtom(display, "WM_DELETE_WINDOW", True);
XSetWMProtocols(display, window, &wmDelete, 1); XSetWMProtocols(display, window, &wmDelete, 1);
// Now show the window
XMapWindow(display, window);
// get the list of GLX extensions for this system // get the list of GLX extensions for this system
const char* glExtensions = glXQueryExtensionsString(display, DefaultScreen(display)); const char* glExtensions = glXQueryExtensionsString(display, DefaultScreen(display));
// much in the same way that we get GL function pointers and use them we will do the same with the context creation // much in the same way that we get GL function pointers and use them we will do the same with the context creation
@ -181,7 +314,7 @@ namespace Raytracing {
XSync(display, False); XSync(display, False);
if (!glContext) if (!glContext)
flog << "Unable to create GL context!"; flog << "Unable to create GL context!";
if (glXIsDirect(display, glContext)){ if (glXIsDirect(display, glContext)) {
ilog << "A direct GL context was acquired!\n"; ilog << "A direct GL context was acquired!\n";
} else // direct contexts are faster than indirect! } else // direct contexts are faster than indirect!
wlog << "Warning! Indirect context!\n"; wlog << "Warning! Indirect context!\n";
@ -193,7 +326,7 @@ namespace Raytracing {
// we want to respect depth // we want to respect depth
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
assignGLFunctionPointers(); //assignGLFunctionPointers();
//glEnableVertexArrayAttribPtr = glXGetProcAddress((unsigned char*)("glEnableVertexArrayAttrib")); //glEnableVertexArrayAttribPtr = glXGetProcAddress((unsigned char*)("glEnableVertexArrayAttrib"));
// Setup Dear IMGUI // Setup Dear IMGUI
@ -323,4 +456,5 @@ namespace Raytracing {
XDestroyWindow(display, window); XDestroyWindow(display, window);
XCloseDisplay(display); XCloseDisplay(display);
} }
#endif
} }

View File

@ -1,13 +1,3 @@
/*
* Created by Brett Terpstra 6920201 on 25/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*
*
* I HAVE MODIFIED THIS FILE SIGNIFICANTLY!
* I AM NOT USING GLFW
* BUT HAVE TAKEN THE BACKEND FOR IT AND ADAPTED IT FOR RAW X11
*
*/
// dear imgui: Platform Backend for GLFW // dear imgui: Platform Backend for GLFW
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..) // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
@ -24,13 +14,105 @@
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp. // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs // Read online: https://github.com/ocornut/imgui/tree/master/docs
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2022-10-18: Perform a dummy glfwGetError() read to cancel missing mouse cursors errors. Using GLFW_VERSION_COMBINED directly. (#5785)
// 2022-10-11: Using 'nullptr' instead of 'NULL' as per our switch to C++11.
// 2022-09-26: Inputs: Renamed ImGuiKey_ModXXX introduced in 1.87 to ImGuiMod_XXX (old names still supported).
// 2022-09-01: Inputs: Honor GLFW_CURSOR_DISABLED by not setting mouse position.
// 2022-04-30: Inputs: Fixed ImGui_ImplGlfw_TranslateUntranslatedKey() for lower case letters on OSX.
// 2022-03-23: Inputs: Fixed a regression in 1.87 which resulted in keyboard modifiers events being reported incorrectly on Linux/X11.
// 2022-02-07: Added ImGui_ImplGlfw_InstallCallbacks()/ImGui_ImplGlfw_RestoreCallbacks() helpers to facilitate user installing callbacks after initializing backend.
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago) with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
// 2022-01-17: Inputs: always update key mods next and before key event (not in NewFrame) to fix input queue with very low framerates.
// 2022-01-12: *BREAKING CHANGE*: Now using glfwSetCursorPosCallback(). If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetCursorPosCallback() and forward it to the backend via ImGui_ImplGlfw_CursorPosCallback().
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
// 2022-01-05: Inputs: Converting GLFW untranslated keycodes back to translated keycodes (in the ImGui_ImplGlfw_KeyCallback() function) in order to match the behavior of every other backend, and facilitate the use of GLFW with lettered-shortcuts API.
// 2021-08-17: *BREAKING CHANGE*: Now using glfwSetWindowFocusCallback() to calling io.AddFocusEvent(). If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetWindowFocusCallback() and forward it to the backend via ImGui_ImplGlfw_WindowFocusCallback().
// 2021-07-29: *BREAKING CHANGE*: Now using glfwSetCursorEnterCallback(). MousePos is correctly reported when the host platform window is hovered but not focused. If you called ImGui_ImplGlfw_InitXXX() with install_callbacks = false, you MUST install glfwSetWindowFocusCallback() callback and forward it to the backend via ImGui_ImplGlfw_CursorEnterCallback().
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
// 2020-01-17: Inputs: Disable error callback while assigning mouse cursors because some X11 setup don't have them and it generates errors.
// 2019-12-05: Inputs: Added support for new mouse cursors added in GLFW 3.4+ (resizing cursors, not allowed cursor).
// 2019-10-18: Misc: Previously installed user callbacks are now restored on shutdown.
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
// 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
// 2018-11-07: Inputs: When installing our GLFW callbacks, we save user's previously installed ones - if any - and chain call them.
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
// 2018-06-08: Misc: Extracted imgui_impl_glfw.cpp/.h away from the old combined GLFW+OpenGL/Vulkan examples.
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value, passed to glfwSetCursor()).
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
// 2018-01-25: Inputs: Added gamepad support if ImGuiConfigFlags_NavEnableGamepad is set.
// 2018-01-25: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
// 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
#include "graphics/imgui/imgui.h" #include "graphics/imgui/imgui.h"
#include "graphics/imgui/imgui_impl_glfw.h" #include "graphics/imgui/imgui_impl_glfw.h"
#define XK_LATIN1
#define XK_MISCELLANY // Clang warnings with -Weverything
#include <graphics/keys.h> #if defined(__clang__)
#include <engine/util/logging.h> #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
#endif
// GLFW
#include <GLFW/glfw3.h>
#ifdef _WIN32
#undef APIENTRY
#define GLFW_EXPOSE_NATIVE_WIN32
#include <GLFW/glfw3native.h> // for glfwGetWin32Window
#endif
// We gather version tests as define in order to easily see which features are version-dependent.
#define GLFW_VERSION_COMBINED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 + GLFW_VERSION_REVISION)
#ifdef GLFW_RESIZE_NESW_CURSOR // Let's be nice to people who pulled GLFW between 2019-04-16 (3.4 define) and 2019-11-29 (cursors defines) // FIXME: Remove when GLFW 3.4 is released?
#define GLFW_HAS_NEW_CURSORS (GLFW_VERSION_COMBINED >= 3400) // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
#else
#define GLFW_HAS_NEW_CURSORS (0)
#endif
#define GLFW_HAS_GAMEPAD_API (GLFW_VERSION_COMBINED >= 3300) // 3.3+ glfwGetGamepadState() new api
#define GLFW_HAS_GETKEYNAME (GLFW_VERSION_COMBINED >= 3200) // 3.2+ glfwGetKeyName()
// GLFW data
enum GlfwClientApi
{
GlfwClientApi_Unknown,
GlfwClientApi_OpenGL,
GlfwClientApi_Vulkan
};
struct ImGui_ImplGlfw_Data
{
GLFWwindow* Window;
GlfwClientApi ClientApi;
double Time;
GLFWwindow* MouseWindow;
GLFWcursor* MouseCursors[ImGuiMouseCursor_COUNT];
ImVec2 LastValidMousePos;
bool InstalledCallbacks;
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
GLFWwindowfocusfun PrevUserCallbackWindowFocus;
GLFWcursorposfun PrevUserCallbackCursorPos;
GLFWcursorenterfun PrevUserCallbackCursorEnter;
GLFWmousebuttonfun PrevUserCallbackMousebutton;
GLFWscrollfun PrevUserCallbackScroll;
GLFWkeyfun PrevUserCallbackKey;
GLFWcharfun PrevUserCallbackChar;
GLFWmonitorfun PrevUserCallbackMonitor;
ImGui_ImplGlfw_Data() { memset((void*)this, 0, sizeof(*this)); }
};
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts. // It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
@ -39,201 +121,182 @@
// (passing install_callbacks=false in ImGui_ImplGlfw_InitXXX functions), set the current dear imgui context and then call our callbacks. // (passing install_callbacks=false in ImGui_ImplGlfw_InitXXX functions), set the current dear imgui context and then call our callbacks.
// - Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it. // - Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it.
// FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context. // FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.
static ImGui_ImplGlfw_Data* ImGui_ImplGlfw_GetBackendData()
{
return ImGui::GetCurrentContext() ? (ImGui_ImplGlfw_Data*)ImGui::GetIO().BackendPlatformUserData : nullptr;
}
// Functions
static const char* ImGui_ImplGlfw_GetClipboardText(void* user_data)
{
return glfwGetClipboardString((GLFWwindow*)user_data);
}
//// Functions static void ImGui_ImplGlfw_SetClipboardText(void* user_data, const char* text)
//static const char* ImGui_ImplGlfw_GetClipboardText(void* data) { {
//// auto sel = XInternAtom(display, "CLIPBOARD", false); glfwSetClipboardString((GLFWwindow*)user_data, text);
//// auto utf = XInternAtom(display, "UTF8_STRING", false); }
//// Window WindowWithSelection = XGetSelectionOwner(display, sel);
//// if (WindowWithSelection == None)
//// return "";
//// auto fake = XCreateSimpleWindow(display, root, -10, -10, 1, 1, 0, 0, 0);
//// auto fakeProperty = XInternAtom(display, "UGHX11", false);
//// XConvertSelection(display, sel, utf, fakeProperty, fake, CurrentTime);
//// int di;
//// unsigned long size, dul;
//// unsigned char* clipboard;
//// XGetWindowProperty(display, fake, fakeProperty, 0, 0, false, AnyPropertyType, &type, )
//// TODO:
// return "\0";
//}
//
//void ImGui_ImplGlfw_SetClipboardText(void* data) {
// // TODO:
// //glfwSetClipboardString((GLFWwindow*)user_data, text);
//}
static ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(unsigned int key) { static ImGuiKey ImGui_ImplGlfw_KeyToImGuiKey(int key)
switch (key) { {
case XK_Tab: return ImGuiKey_Tab; switch (key)
case XK_Left: return ImGuiKey_LeftArrow; {
case XK_Right: return ImGuiKey_RightArrow; case GLFW_KEY_TAB: return ImGuiKey_Tab;
case XK_Up: return ImGuiKey_UpArrow; case GLFW_KEY_LEFT: return ImGuiKey_LeftArrow;
case XK_Down: return ImGuiKey_DownArrow; case GLFW_KEY_RIGHT: return ImGuiKey_RightArrow;
case XK_Page_Up: return ImGuiKey_PageUp; case GLFW_KEY_UP: return ImGuiKey_UpArrow;
case XK_Page_Down: return ImGuiKey_PageDown; case GLFW_KEY_DOWN: return ImGuiKey_DownArrow;
case XK_Home: return ImGuiKey_Home; case GLFW_KEY_PAGE_UP: return ImGuiKey_PageUp;
case XK_End: return ImGuiKey_End; case GLFW_KEY_PAGE_DOWN: return ImGuiKey_PageDown;
case XK_Insert: return ImGuiKey_Insert; case GLFW_KEY_HOME: return ImGuiKey_Home;
case XK_Delete: return ImGuiKey_Delete; case GLFW_KEY_END: return ImGuiKey_End;
case XK_BackSpace: return ImGuiKey_Backspace; case GLFW_KEY_INSERT: return ImGuiKey_Insert;
case XK_space: return ImGuiKey_Space; case GLFW_KEY_DELETE: return ImGuiKey_Delete;
case XK_Return: return ImGuiKey_Enter; case GLFW_KEY_BACKSPACE: return ImGuiKey_Backspace;
case XK_Escape: return ImGuiKey_Escape; case GLFW_KEY_SPACE: return ImGuiKey_Space;
case XK_apostrophe: return ImGuiKey_Apostrophe; case GLFW_KEY_ENTER: return ImGuiKey_Enter;
case XK_comma: return ImGuiKey_Comma; case GLFW_KEY_ESCAPE: return ImGuiKey_Escape;
case XK_minus: return ImGuiKey_Minus; case GLFW_KEY_APOSTROPHE: return ImGuiKey_Apostrophe;
case XK_period: return ImGuiKey_Period; case GLFW_KEY_COMMA: return ImGuiKey_Comma;
case XK_slash: return ImGuiKey_Slash; case GLFW_KEY_MINUS: return ImGuiKey_Minus;
case XK_semicolon: return ImGuiKey_Semicolon; case GLFW_KEY_PERIOD: return ImGuiKey_Period;
case XK_equal: return ImGuiKey_Equal; case GLFW_KEY_SLASH: return ImGuiKey_Slash;
case XK_bracketleft: return ImGuiKey_LeftBracket; case GLFW_KEY_SEMICOLON: return ImGuiKey_Semicolon;
case XK_backslash: return ImGuiKey_Backslash; case GLFW_KEY_EQUAL: return ImGuiKey_Equal;
case XK_bracketright: return ImGuiKey_RightBracket; case GLFW_KEY_LEFT_BRACKET: return ImGuiKey_LeftBracket;
case XK_grave: return ImGuiKey_GraveAccent; case GLFW_KEY_BACKSLASH: return ImGuiKey_Backslash;
case XK_Caps_Lock: return ImGuiKey_CapsLock; case GLFW_KEY_RIGHT_BRACKET: return ImGuiKey_RightBracket;
case XK_Scroll_Lock: return ImGuiKey_ScrollLock; case GLFW_KEY_GRAVE_ACCENT: return ImGuiKey_GraveAccent;
case XK_Num_Lock: return ImGuiKey_NumLock; case GLFW_KEY_CAPS_LOCK: return ImGuiKey_CapsLock;
case XK_Print: return ImGuiKey_PrintScreen; case GLFW_KEY_SCROLL_LOCK: return ImGuiKey_ScrollLock;
case XK_Pause: return ImGuiKey_Pause; case GLFW_KEY_NUM_LOCK: return ImGuiKey_NumLock;
case XK_KP_0: return ImGuiKey_Keypad0; case GLFW_KEY_PRINT_SCREEN: return ImGuiKey_PrintScreen;
case XK_KP_1: return ImGuiKey_Keypad1; case GLFW_KEY_PAUSE: return ImGuiKey_Pause;
case XK_KP_2: return ImGuiKey_Keypad2; case GLFW_KEY_KP_0: return ImGuiKey_Keypad0;
case XK_KP_3: return ImGuiKey_Keypad3; case GLFW_KEY_KP_1: return ImGuiKey_Keypad1;
case XK_KP_4: return ImGuiKey_Keypad4; case GLFW_KEY_KP_2: return ImGuiKey_Keypad2;
case XK_KP_5: return ImGuiKey_Keypad5; case GLFW_KEY_KP_3: return ImGuiKey_Keypad3;
case XK_KP_6: return ImGuiKey_Keypad6; case GLFW_KEY_KP_4: return ImGuiKey_Keypad4;
case XK_KP_7: return ImGuiKey_Keypad7; case GLFW_KEY_KP_5: return ImGuiKey_Keypad5;
case XK_KP_8: return ImGuiKey_Keypad8; case GLFW_KEY_KP_6: return ImGuiKey_Keypad6;
case XK_KP_9: return ImGuiKey_Keypad9; case GLFW_KEY_KP_7: return ImGuiKey_Keypad7;
case XK_KP_Decimal: return ImGuiKey_KeypadDecimal; case GLFW_KEY_KP_8: return ImGuiKey_Keypad8;
case XK_KP_Divide: return ImGuiKey_KeypadDivide; case GLFW_KEY_KP_9: return ImGuiKey_Keypad9;
case XK_KP_Multiply: return ImGuiKey_KeypadMultiply; case GLFW_KEY_KP_DECIMAL: return ImGuiKey_KeypadDecimal;
case XK_KP_Subtract: return ImGuiKey_KeypadSubtract; case GLFW_KEY_KP_DIVIDE: return ImGuiKey_KeypadDivide;
case XK_KP_Add: return ImGuiKey_KeypadAdd; case GLFW_KEY_KP_MULTIPLY: return ImGuiKey_KeypadMultiply;
case XK_KP_Enter: return ImGuiKey_KeypadEnter; case GLFW_KEY_KP_SUBTRACT: return ImGuiKey_KeypadSubtract;
case XK_KP_Equal: return ImGuiKey_KeypadEqual; case GLFW_KEY_KP_ADD: return ImGuiKey_KeypadAdd;
case XK_Shift_L: return ImGuiKey_LeftShift; case GLFW_KEY_KP_ENTER: return ImGuiKey_KeypadEnter;
case XK_Control_L: return ImGuiKey_LeftCtrl; case GLFW_KEY_KP_EQUAL: return ImGuiKey_KeypadEqual;
case XK_Alt_L: return ImGuiKey_LeftAlt; case GLFW_KEY_LEFT_SHIFT: return ImGuiKey_LeftShift;
case XK_Super_L: return ImGuiKey_LeftSuper; case GLFW_KEY_LEFT_CONTROL: return ImGuiKey_LeftCtrl;
case XK_Shift_R: return ImGuiKey_RightShift; case GLFW_KEY_LEFT_ALT: return ImGuiKey_LeftAlt;
case XK_Control_R: return ImGuiKey_RightCtrl; case GLFW_KEY_LEFT_SUPER: return ImGuiKey_LeftSuper;
case XK_Alt_R: return ImGuiKey_RightAlt; case GLFW_KEY_RIGHT_SHIFT: return ImGuiKey_RightShift;
case XK_Super_R: return ImGuiKey_RightSuper; case GLFW_KEY_RIGHT_CONTROL: return ImGuiKey_RightCtrl;
case XK_Menu: return ImGuiKey_Menu; case GLFW_KEY_RIGHT_ALT: return ImGuiKey_RightAlt;
case XK_0: return ImGuiKey_0; case GLFW_KEY_RIGHT_SUPER: return ImGuiKey_RightSuper;
case XK_1: return ImGuiKey_1; case GLFW_KEY_MENU: return ImGuiKey_Menu;
case XK_2: return ImGuiKey_2; case GLFW_KEY_0: return ImGuiKey_0;
case XK_3: return ImGuiKey_3; case GLFW_KEY_1: return ImGuiKey_1;
case XK_4: return ImGuiKey_4; case GLFW_KEY_2: return ImGuiKey_2;
case XK_5: return ImGuiKey_5; case GLFW_KEY_3: return ImGuiKey_3;
case XK_6: return ImGuiKey_6; case GLFW_KEY_4: return ImGuiKey_4;
case XK_7: return ImGuiKey_7; case GLFW_KEY_5: return ImGuiKey_5;
case XK_8: return ImGuiKey_8; case GLFW_KEY_6: return ImGuiKey_6;
case XK_9: return ImGuiKey_9; case GLFW_KEY_7: return ImGuiKey_7;
case XK_A: return ImGuiKey_A; case GLFW_KEY_8: return ImGuiKey_8;
case XK_B: return ImGuiKey_B; case GLFW_KEY_9: return ImGuiKey_9;
case XK_C: return ImGuiKey_C; case GLFW_KEY_A: return ImGuiKey_A;
case XK_D: return ImGuiKey_D; case GLFW_KEY_B: return ImGuiKey_B;
case XK_E: return ImGuiKey_E; case GLFW_KEY_C: return ImGuiKey_C;
case XK_F: return ImGuiKey_F; case GLFW_KEY_D: return ImGuiKey_D;
case XK_G: return ImGuiKey_G; case GLFW_KEY_E: return ImGuiKey_E;
case XK_H: return ImGuiKey_H; case GLFW_KEY_F: return ImGuiKey_F;
case XK_I: return ImGuiKey_I; case GLFW_KEY_G: return ImGuiKey_G;
case XK_J: return ImGuiKey_J; case GLFW_KEY_H: return ImGuiKey_H;
case XK_K: return ImGuiKey_K; case GLFW_KEY_I: return ImGuiKey_I;
case XK_L: return ImGuiKey_L; case GLFW_KEY_J: return ImGuiKey_J;
case XK_M: return ImGuiKey_M; case GLFW_KEY_K: return ImGuiKey_K;
case XK_N: return ImGuiKey_N; case GLFW_KEY_L: return ImGuiKey_L;
case XK_O: return ImGuiKey_O; case GLFW_KEY_M: return ImGuiKey_M;
case XK_P: return ImGuiKey_P; case GLFW_KEY_N: return ImGuiKey_N;
case XK_Q: return ImGuiKey_Q; case GLFW_KEY_O: return ImGuiKey_O;
case XK_R: return ImGuiKey_R; case GLFW_KEY_P: return ImGuiKey_P;
case XK_S: return ImGuiKey_S; case GLFW_KEY_Q: return ImGuiKey_Q;
case XK_T: return ImGuiKey_T; case GLFW_KEY_R: return ImGuiKey_R;
case XK_U: return ImGuiKey_U; case GLFW_KEY_S: return ImGuiKey_S;
case XK_V: return ImGuiKey_V; case GLFW_KEY_T: return ImGuiKey_T;
case XK_W: return ImGuiKey_W; case GLFW_KEY_U: return ImGuiKey_U;
case XK_X: return ImGuiKey_X; case GLFW_KEY_V: return ImGuiKey_V;
case XK_Y: return ImGuiKey_Y; case GLFW_KEY_W: return ImGuiKey_W;
case XK_Z: return ImGuiKey_Z; case GLFW_KEY_X: return ImGuiKey_X;
case XK_a: return ImGuiKey_A; case GLFW_KEY_Y: return ImGuiKey_Y;
case XK_b: return ImGuiKey_B; case GLFW_KEY_Z: return ImGuiKey_Z;
case XK_c: return ImGuiKey_C; case GLFW_KEY_F1: return ImGuiKey_F1;
case XK_d: return ImGuiKey_D; case GLFW_KEY_F2: return ImGuiKey_F2;
case XK_e: return ImGuiKey_E; case GLFW_KEY_F3: return ImGuiKey_F3;
case XK_f: return ImGuiKey_F; case GLFW_KEY_F4: return ImGuiKey_F4;
case XK_g: return ImGuiKey_G; case GLFW_KEY_F5: return ImGuiKey_F5;
case XK_h: return ImGuiKey_H; case GLFW_KEY_F6: return ImGuiKey_F6;
case XK_i: return ImGuiKey_I; case GLFW_KEY_F7: return ImGuiKey_F7;
case XK_j: return ImGuiKey_J; case GLFW_KEY_F8: return ImGuiKey_F8;
case XK_k: return ImGuiKey_K; case GLFW_KEY_F9: return ImGuiKey_F9;
case XK_l: return ImGuiKey_L; case GLFW_KEY_F10: return ImGuiKey_F10;
case XK_m: return ImGuiKey_M; case GLFW_KEY_F11: return ImGuiKey_F11;
case XK_n: return ImGuiKey_N; case GLFW_KEY_F12: return ImGuiKey_F12;
case XK_o: return ImGuiKey_O;
case XK_p: return ImGuiKey_P;
case XK_q: return ImGuiKey_Q;
case XK_r: return ImGuiKey_R;
case XK_s: return ImGuiKey_S;
case XK_t: return ImGuiKey_T;
case XK_u: return ImGuiKey_U;
case XK_v: return ImGuiKey_V;
case XK_w: return ImGuiKey_W;
case XK_x: return ImGuiKey_X;
case XK_y: return ImGuiKey_Y;
case XK_z: return ImGuiKey_Z;
case XK_F1: return ImGuiKey_F1;
case XK_F2: return ImGuiKey_F2;
case XK_F3: return ImGuiKey_F3;
case XK_F4: return ImGuiKey_F4;
case XK_F5: return ImGuiKey_F5;
case XK_F6: return ImGuiKey_F6;
case XK_F7: return ImGuiKey_F7;
case XK_F8: return ImGuiKey_F8;
case XK_F9: return ImGuiKey_F9;
case XK_F10: return ImGuiKey_F10;
case XK_F11: return ImGuiKey_F11;
case XK_F12: return ImGuiKey_F12;
default: return ImGuiKey_None; default: return ImGuiKey_None;
} }
} }
int ImGui_ImplGlfw_KeyToModifier(unsigned int key) { static int ImGui_ImplGlfw_KeyToModifier(int key)
if (key == XK_Control_L || key == XK_Control_R) {
return RT_CONTROL; if (key == GLFW_KEY_LEFT_CONTROL || key == GLFW_KEY_RIGHT_CONTROL)
if (key == XK_Shift_L || key == XK_Shift_R) return GLFW_MOD_CONTROL;
return RT_SHIFT; if (key == GLFW_KEY_LEFT_SHIFT || key == GLFW_KEY_RIGHT_SHIFT)
if (key == XK_Alt_L || key == XK_Alt_R) return GLFW_MOD_SHIFT;
return RT_ALT; if (key == GLFW_KEY_LEFT_ALT || key == GLFW_KEY_RIGHT_ALT)
if (key == XK_Super_L || key == XK_Super_R) return GLFW_MOD_ALT;
return RT_SUPER; if (key == GLFW_KEY_LEFT_SUPER || key == GLFW_KEY_RIGHT_SUPER)
return GLFW_MOD_SUPER;
return 0; return 0;
} }
void ImGui_ImplGlfw_UpdateKeyModifiers(int mods) static void ImGui_ImplGlfw_UpdateKeyModifiers(int mods)
{ {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.AddKeyEvent(ImGuiModFlags_Ctrl, (mods & RT_CONTROL) != 0); io.AddKeyEvent(ImGuiKey_ModCtrl, (mods & GLFW_MOD_CONTROL) != 0);
io.AddKeyEvent(ImGuiModFlags_Shift, (mods & RT_SHIFT) != 0); io.AddKeyEvent(ImGuiKey_ModShift, (mods & GLFW_MOD_SHIFT) != 0);
io.AddKeyEvent(ImGuiModFlags_Alt, (mods & RT_ALT) != 0); io.AddKeyEvent(ImGuiKey_ModAlt, (mods & GLFW_MOD_ALT) != 0);
io.AddKeyEvent(ImGuiModFlags_Super, (mods & RT_SUPER) != 0); io.AddKeyEvent(ImGuiKey_ModSuper, (mods & GLFW_MOD_SUPER) != 0);
} }
void ImGui_ImplGlfw_MouseButtonCallback(unsigned int button, bool press, int mods) { void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackMousebutton != nullptr && window == bd->Window)
bd->PrevUserCallbackMousebutton(window, button, action, mods);
ImGui_ImplGlfw_UpdateKeyModifiers(mods);
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
if (button < ImGuiMouseButton_COUNT) if (button >= 0 && button < ImGuiMouseButton_COUNT)
io.AddMouseButtonEvent((int)button, press); io.AddMouseButtonEvent(button, action == GLFW_PRESS);
} }
void ImGui_ImplGlfw_ScrollCallback(double xoffset, double yoffset) { void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackScroll != nullptr && window == bd->Window)
bd->PrevUserCallbackScroll(window, xoffset, yoffset);
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.AddMouseWheelEvent((float)xoffset, (float)yoffset); io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
} }
static int ImGui_ImplGlfw_TranslateUntranslatedKey(unsigned int key, int scancode) { static int ImGui_ImplGlfw_TranslateUntranslatedKey(int key, int scancode)
{
#if GLFW_HAS_GETKEYNAME && !defined(__EMSCRIPTEN__) #if GLFW_HAS_GETKEYNAME && !defined(__EMSCRIPTEN__)
// GLFW 3.1+ attempts to "untranslate" keys, which goes the opposite of what every other framework does, making using lettered shortcuts difficult. // GLFW 3.1+ attempts to "untranslate" keys, which goes the opposite of what every other framework does, making using lettered shortcuts difficult.
// (It had reasons to do so: namely GLFW is/was more likely to be used for WASD-type game controls rather than lettered shortcuts, but IHMO the 3.1 change could have been done differently) // (It had reasons to do so: namely GLFW is/was more likely to be used for WASD-type game controls rather than lettered shortcuts, but IHMO the 3.1 change could have been done differently)
@ -260,87 +323,162 @@ static int ImGui_ImplGlfw_TranslateUntranslatedKey(unsigned int key, int scancod
return key; return key;
} }
void ImGui_ImplGlfw_KeyCallback(unsigned int keycode, int scancode, bool press, int mods) { void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int keycode, int scancode, int action, int mods)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackKey != nullptr && window == bd->Window)
bd->PrevUserCallbackKey(window, keycode, scancode, action, mods);
if (action != GLFW_PRESS && action != GLFW_RELEASE)
return;
// Workaround: X11 does not include current pressed/released modifier key in 'mods' flags. https://github.com/glfw/glfw/issues/1630 // Workaround: X11 does not include current pressed/released modifier key in 'mods' flags. https://github.com/glfw/glfw/issues/1630
if (int keycode_to_mod = ImGui_ImplGlfw_KeyToModifier(keycode)) if (int keycode_to_mod = ImGui_ImplGlfw_KeyToModifier(keycode))
mods = (press) ? (mods | keycode_to_mod) : (mods & ~keycode_to_mod); mods = (action == GLFW_PRESS) ? (mods | keycode_to_mod) : (mods & ~keycode_to_mod);
ImGui_ImplGlfw_UpdateKeyModifiers(mods); ImGui_ImplGlfw_UpdateKeyModifiers(mods);
//keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode); keycode = ImGui_ImplGlfw_TranslateUntranslatedKey(keycode, scancode);
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGuiKey imgui_key = ImGui_ImplGlfw_KeyToImGuiKey(keycode); ImGuiKey imgui_key = ImGui_ImplGlfw_KeyToImGuiKey(keycode);
if (!press && ((keycode < 127 && keycode > 80) || (keycode < 64 && keycode > 31))) io.AddKeyEvent(imgui_key, (action == GLFW_PRESS));
io.AddInputCharacter(keycode); io.SetKeyEventNativeData(imgui_key, keycode, scancode); // To support legacy indexing (<1.87 user code)
io.AddKeyEvent(imgui_key, press);
io.SetKeyEventNativeData(imgui_key, (int)keycode, scancode); // To support legacy indexing (<1.87 user code)
} }
void ImGui_ImplGlfw_WindowFocusCallback(int focused) { void ImGui_ImplGlfw_WindowFocusCallback(GLFWwindow* window, int focused)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackWindowFocus != nullptr && window == bd->Window)
bd->PrevUserCallbackWindowFocus(window, focused);
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.AddFocusEvent(focused != 0); io.AddFocusEvent(focused != 0);
} }
void ImGui_ImplGlfw_CursorPosCallback(double x, double y, bool cursorVisible) { void ImGui_ImplGlfw_CursorPosCallback(GLFWwindow* window, double x, double y)
if (!cursorVisible) {
return; ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
ImGuiIO& io = ImGui::GetIO(); if (bd->PrevUserCallbackCursorPos != nullptr && window == bd->Window)
io.AddMousePosEvent((float)x, (float)y); bd->PrevUserCallbackCursorPos(window, x, y);
} if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
ImVec2 LastValidMousePos {0, 0};
// Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position,
// so we back it up and restore on Leave/Enter (see https://github.com/ocornut/imgui/issues/4984)
void ImGui_ImplGlfw_CursorEnterCallback(int entered, bool cursorVisible) {
if (!cursorVisible)
return; return;
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
if (entered) { io.AddMousePosEvent((float)x, (float)y);
io.AddMousePosEvent(LastValidMousePos.x, LastValidMousePos.y); bd->LastValidMousePos = ImVec2((float)x, (float)y);
} else { }
LastValidMousePos = io.MousePos;
// Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position,
// so we back it up and restore on Leave/Enter (see https://github.com/ocornut/imgui/issues/4984)
void ImGui_ImplGlfw_CursorEnterCallback(GLFWwindow* window, int entered)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackCursorEnter != nullptr && window == bd->Window)
bd->PrevUserCallbackCursorEnter(window, entered);
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
return;
ImGuiIO& io = ImGui::GetIO();
if (entered)
{
bd->MouseWindow = window;
io.AddMousePosEvent(bd->LastValidMousePos.x, bd->LastValidMousePos.y);
}
else if (!entered && bd->MouseWindow == window)
{
bd->LastValidMousePos = io.MousePos;
bd->MouseWindow = nullptr;
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
} }
} }
void ImGui_ImplGlfw_CharCallback(unsigned int c) { void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if (bd->PrevUserCallbackChar != nullptr && window == bd->Window)
bd->PrevUserCallbackChar(window, c);
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.AddInputCharacter(c); io.AddInputCharacter(c);
} }
void ImGui_ImplGlfw_MonitorCallback(int) { void ImGui_ImplGlfw_MonitorCallback(GLFWmonitor*, int)
{
// Unused in 'master' branch but 'docking' branch will use this, so we declare it ahead of it so if you have to install callbacks you can install this one too. // Unused in 'master' branch but 'docking' branch will use this, so we declare it ahead of it so if you have to install callbacks you can install this one too.
} }
void ImGui_ImplGlfw_InstallCallbacks() { void ImGui_ImplGlfw_InstallCallbacks(GLFWwindow* window)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
IM_ASSERT(bd->InstalledCallbacks == false && "Callbacks already installed!");
IM_ASSERT(bd->Window == window);
bd->PrevUserCallbackWindowFocus = glfwSetWindowFocusCallback(window, ImGui_ImplGlfw_WindowFocusCallback);
bd->PrevUserCallbackCursorEnter = glfwSetCursorEnterCallback(window, ImGui_ImplGlfw_CursorEnterCallback);
bd->PrevUserCallbackCursorPos = glfwSetCursorPosCallback(window, ImGui_ImplGlfw_CursorPosCallback);
bd->PrevUserCallbackMousebutton = glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
bd->PrevUserCallbackScroll = glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
bd->PrevUserCallbackKey = glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
bd->PrevUserCallbackChar = glfwSetCharCallback(window, ImGui_ImplGlfw_CharCallback);
bd->PrevUserCallbackMonitor = glfwSetMonitorCallback(ImGui_ImplGlfw_MonitorCallback);
bd->InstalledCallbacks = true;
} }
void ImGui_ImplGlfw_RestoreCallbacks() { void ImGui_ImplGlfw_RestoreCallbacks(GLFWwindow* window)
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
IM_ASSERT(bd->InstalledCallbacks == true && "Callbacks not installed!");
IM_ASSERT(bd->Window == window);
glfwSetWindowFocusCallback(window, bd->PrevUserCallbackWindowFocus);
glfwSetCursorEnterCallback(window, bd->PrevUserCallbackCursorEnter);
glfwSetCursorPosCallback(window, bd->PrevUserCallbackCursorPos);
glfwSetMouseButtonCallback(window, bd->PrevUserCallbackMousebutton);
glfwSetScrollCallback(window, bd->PrevUserCallbackScroll);
glfwSetKeyCallback(window, bd->PrevUserCallbackKey);
glfwSetCharCallback(window, bd->PrevUserCallbackChar);
glfwSetMonitorCallback(bd->PrevUserCallbackMonitor);
bd->InstalledCallbacks = false;
bd->PrevUserCallbackWindowFocus = nullptr;
bd->PrevUserCallbackCursorEnter = nullptr;
bd->PrevUserCallbackCursorPos = nullptr;
bd->PrevUserCallbackMousebutton = nullptr;
bd->PrevUserCallbackScroll = nullptr;
bd->PrevUserCallbackKey = nullptr;
bd->PrevUserCallbackChar = nullptr;
bd->PrevUserCallbackMonitor = nullptr;
} }
bool ImGui_ImplGlfw_Init() { static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, GlfwClientApi client_api)
{
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!"); IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
//printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED); //printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED);
// Setup backend capabilities flags // Setup backend capabilities flags
ImGui_ImplGlfw_Data* bd = IM_NEW(ImGui_ImplGlfw_Data)();
io.BackendPlatformUserData = (void*)bd;
io.BackendPlatformName = "imgui_impl_glfw"; io.BackendPlatformName = "imgui_impl_glfw";
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional) io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used) io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
// TODO bd->Window = window;
//io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText; bd->Time = 0.0;
//io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
//io.ClipboardUserData = bd->Window; io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText;
io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText;
io.ClipboardUserData = bd->Window;
// Set platform dependent data in viewport
#if defined(_WIN32)
ImGui::GetMainViewport()->PlatformHandleRaw = (void*)glfwGetWin32Window(bd->Window);
#endif
// Create mouse cursors // Create mouse cursors
// (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist, // (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
// GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting. // GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
// Missing cursors will return nullptr and our _UpdateMouseCursor() function will use the Arrow cursor instead.) // Missing cursors will return nullptr and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
/* GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr); GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr);
bd->MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); bd->MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR); bd->MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR); bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
@ -356,46 +494,88 @@ bool ImGui_ImplGlfw_Init() {
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR); bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
#endif*/ #endif
#if (GLFW_VERSION_COMBINED >= 3300) // Eat errors (see #5785)
(void)glfwGetError(NULL);
#endif
glfwSetErrorCallback(prev_error_callback);
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any. // Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
if (install_callbacks)
ImGui_ImplGlfw_InstallCallbacks(window);
bd->ClientApi = client_api;
return true; return true;
} }
bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks)
{
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_OpenGL);
}
bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks)
{
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Vulkan);
}
bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks)
{
return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Unknown);
}
void ImGui_ImplGlfw_Shutdown() void ImGui_ImplGlfw_Shutdown()
{ {
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
IM_ASSERT(bd != nullptr && "No platform backend to shutdown, or already shutdown?");
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
if (bd->InstalledCallbacks)
ImGui_ImplGlfw_RestoreCallbacks(bd->Window);
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
glfwDestroyCursor(bd->MouseCursors[cursor_n]);
io.BackendPlatformName = nullptr; io.BackendPlatformName = nullptr;
io.BackendPlatformUserData = nullptr; io.BackendPlatformUserData = nullptr;
IM_DELETE(bd);
} }
void ImGui_ImplGlfw_UpdateMouseData(bool cursorVisible, bool focused) { static void ImGui_ImplGlfw_UpdateMouseData()
{
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
if (!cursorVisible) { if (glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
{
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX); io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
return; return;
} }
if (focused) {
// TODO: #ifdef __EMSCRIPTEN__
const bool is_app_focused = true;
#else
const bool is_app_focused = glfwGetWindowAttrib(bd->Window, GLFW_FOCUSED) != 0;
#endif
if (is_app_focused)
{
// (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user) // (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
//if (io.WantSetMousePos) if (io.WantSetMousePos)
// glfwSetCursorPos(bd->Window, (double)io.MousePos.x, (double)io.MousePos.y); glfwSetCursorPos(bd->Window, (double)io.MousePos.x, (double)io.MousePos.y);
// (Optional) Fallback to provide mouse position when focused (ImGui_ImplGlfw_CursorPosCallback already provides this when hovered or captured) // (Optional) Fallback to provide mouse position when focused (ImGui_ImplGlfw_CursorPosCallback already provides this when hovered or captured)
/*if (is_app_focused && bd->MouseWindow == nullptr) if (is_app_focused && bd->MouseWindow == nullptr)
{ {
double mouse_x, mouse_y; double mouse_x, mouse_y;
glfwGetCursorPos(bd->Window, &mouse_x, &mouse_y); glfwGetCursorPos(bd->Window, &mouse_x, &mouse_y);
io.AddMousePosEvent((float)mouse_x, (float)mouse_y); io.AddMousePosEvent((float)mouse_x, (float)mouse_y);
bd->LastValidMousePos = ImVec2((float)mouse_x, (float)mouse_y); bd->LastValidMousePos = ImVec2((float)mouse_x, (float)mouse_y);
}*/ }
} }
} }
void ImGui_ImplGlfw_UpdateMouseCursor() { static void ImGui_ImplGlfw_UpdateMouseCursor()
// TODO: {
/*ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData(); ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
return; return;
@ -412,23 +592,89 @@ void ImGui_ImplGlfw_UpdateMouseCursor() {
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here. // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
glfwSetCursor(bd->Window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]); glfwSetCursor(bd->Window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
glfwSetInputMode(bd->Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); glfwSetInputMode(bd->Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}*/ }
} }
double DTime = 0; // Update gamepad inputs
static inline float Saturate(float v) { return v < 0.0f ? 0.0f : v > 1.0f ? 1.0f : v; }
void ImGui_ImplGlfw_NewFrame(double time, int display_w, int display_h, int w, int h) { static void ImGui_ImplGlfw_UpdateGamepads()
{
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0) // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
return;
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
#if GLFW_HAS_GAMEPAD_API
GLFWgamepadstate gamepad;
if (!glfwGetGamepadState(GLFW_JOYSTICK_1, &gamepad))
return;
#define MAP_BUTTON(KEY_NO, BUTTON_NO, _UNUSED) do { io.AddKeyEvent(KEY_NO, gamepad.buttons[BUTTON_NO] != 0); } while (0)
#define MAP_ANALOG(KEY_NO, AXIS_NO, _UNUSED, V0, V1) do { float v = gamepad.axes[AXIS_NO]; v = (v - V0) / (V1 - V0); io.AddKeyAnalogEvent(KEY_NO, v > 0.10f, Saturate(v)); } while (0)
#else
int axes_count = 0, buttons_count = 0;
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axes_count);
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &buttons_count);
if (axes_count == 0 || buttons_count == 0)
return;
#define MAP_BUTTON(KEY_NO, _UNUSED, BUTTON_NO) do { io.AddKeyEvent(KEY_NO, (buttons_count > BUTTON_NO && buttons[BUTTON_NO] == GLFW_PRESS)); } while (0)
#define MAP_ANALOG(KEY_NO, _UNUSED, AXIS_NO, V0, V1) do { float v = (axes_count > AXIS_NO) ? axes[AXIS_NO] : V0; v = (v - V0) / (V1 - V0); io.AddKeyAnalogEvent(KEY_NO, v > 0.10f, Saturate(v)); } while (0)
#endif
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
MAP_BUTTON(ImGuiKey_GamepadStart, GLFW_GAMEPAD_BUTTON_START, 7);
MAP_BUTTON(ImGuiKey_GamepadBack, GLFW_GAMEPAD_BUTTON_BACK, 6);
MAP_BUTTON(ImGuiKey_GamepadFaceLeft, GLFW_GAMEPAD_BUTTON_X, 2); // Xbox X, PS Square
MAP_BUTTON(ImGuiKey_GamepadFaceRight, GLFW_GAMEPAD_BUTTON_B, 1); // Xbox B, PS Circle
MAP_BUTTON(ImGuiKey_GamepadFaceUp, GLFW_GAMEPAD_BUTTON_Y, 3); // Xbox Y, PS Triangle
MAP_BUTTON(ImGuiKey_GamepadFaceDown, GLFW_GAMEPAD_BUTTON_A, 0); // Xbox A, PS Cross
MAP_BUTTON(ImGuiKey_GamepadDpadLeft, GLFW_GAMEPAD_BUTTON_DPAD_LEFT, 13);
MAP_BUTTON(ImGuiKey_GamepadDpadRight, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT, 11);
MAP_BUTTON(ImGuiKey_GamepadDpadUp, GLFW_GAMEPAD_BUTTON_DPAD_UP, 10);
MAP_BUTTON(ImGuiKey_GamepadDpadDown, GLFW_GAMEPAD_BUTTON_DPAD_DOWN, 12);
MAP_BUTTON(ImGuiKey_GamepadL1, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER, 4);
MAP_BUTTON(ImGuiKey_GamepadR1, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER, 5);
MAP_ANALOG(ImGuiKey_GamepadL2, GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, 4, -0.75f, +1.0f);
MAP_ANALOG(ImGuiKey_GamepadR2, GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, 5, -0.75f, +1.0f);
MAP_BUTTON(ImGuiKey_GamepadL3, GLFW_GAMEPAD_BUTTON_LEFT_THUMB, 8);
MAP_BUTTON(ImGuiKey_GamepadR3, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB, 9);
MAP_ANALOG(ImGuiKey_GamepadLStickLeft, GLFW_GAMEPAD_AXIS_LEFT_X, 0, -0.25f, -1.0f);
MAP_ANALOG(ImGuiKey_GamepadLStickRight, GLFW_GAMEPAD_AXIS_LEFT_X, 0, +0.25f, +1.0f);
MAP_ANALOG(ImGuiKey_GamepadLStickUp, GLFW_GAMEPAD_AXIS_LEFT_Y, 1, -0.25f, -1.0f);
MAP_ANALOG(ImGuiKey_GamepadLStickDown, GLFW_GAMEPAD_AXIS_LEFT_Y, 1, +0.25f, +1.0f);
MAP_ANALOG(ImGuiKey_GamepadRStickLeft, GLFW_GAMEPAD_AXIS_RIGHT_X, 2, -0.25f, -1.0f);
MAP_ANALOG(ImGuiKey_GamepadRStickRight, GLFW_GAMEPAD_AXIS_RIGHT_X, 2, +0.25f, +1.0f);
MAP_ANALOG(ImGuiKey_GamepadRStickUp, GLFW_GAMEPAD_AXIS_RIGHT_Y, 3, -0.25f, -1.0f);
MAP_ANALOG(ImGuiKey_GamepadRStickDown, GLFW_GAMEPAD_AXIS_RIGHT_Y, 3, +0.25f, +1.0f);
#undef MAP_BUTTON
#undef MAP_ANALOG
}
void ImGui_ImplGlfw_NewFrame()
{
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
IM_ASSERT(bd != nullptr && "Did you call ImGui_ImplGlfw_InitForXXX()?");
// Setup display size (every frame to accommodate for window resizing) // Setup display size (every frame to accommodate for window resizing)
int w, h;
int display_w, display_h;
glfwGetWindowSize(bd->Window, &w, &h);
glfwGetFramebufferSize(bd->Window, &display_w, &display_h);
io.DisplaySize = ImVec2((float)w, (float)h); io.DisplaySize = ImVec2((float)w, (float)h);
if (w > 0 && h > 0) if (w > 0 && h > 0)
io.DisplayFramebufferScale = ImVec2((float)display_w / (float)w, (float)display_h / (float)h); io.DisplayFramebufferScale = ImVec2((float)display_w / (float)w, (float)display_h / (float)h);
// Setup time step // Setup time step
double current_time = time / 1000.0; double current_time = glfwGetTime();
io.DeltaTime = DTime > 0.0 ? (float)(current_time - DTime) : (float)(1.0f / 60.0f); io.DeltaTime = bd->Time > 0.0 ? (float)(current_time - bd->Time) : (float)(1.0f / 60.0f);
DTime = current_time; bd->Time = current_time;
ImGui_ImplGlfw_UpdateMouseData();
ImGui_ImplGlfw_UpdateMouseCursor(); ImGui_ImplGlfw_UpdateMouseCursor();
// Update game controllers (if enabled and available)
ImGui_ImplGlfw_UpdateGamepads();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -0,0 +1,434 @@
/*
* Created by Brett Terpstra 6920201 on 25/10/22.
* Copyright (c) 2022 Brett Terpstra. All Rights Reserved.
*
*
* I HAVE MODIFIED THIS FILE SIGNIFICANTLY!
* I AM NOT USING GLFW
* BUT HAVE TAKEN THE BACKEND FOR IT AND ADAPTED IT FOR RAW X11
*
*/
// dear imgui: Platform Backend for GLFW
// This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan, WebGPU..)
// (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.)
// (Requires: GLFW 3.1+)
// Implemented features:
// [X] Platform: Clipboard support.
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy GLFW_KEY_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
// [X] Platform: Gamepad support. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange' (note: the resizing cursors requires GLFW 3.4+).
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs
#include "graphics/imgui/imgui.h"
#include "graphics/imgui/imgui_impl_x11.h"
#define XK_LATIN1
#define XK_MISCELLANY
#include <graphics/keys.h>
#include <engine/util/logging.h>
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
// FIXME: multi-context support is not well tested and probably dysfunctional in this backend.
// - Because glfwPollEvents() process all windows and some events may be called outside of it, you will need to register your own callbacks
// (passing install_callbacks=false in ImGui_ImplX11_InitXXX functions), set the current dear imgui context and then call our callbacks.
// - Otherwise we may need to store a GLFWWindow* -> ImGuiContext* map and handle this in the backend, adding a little bit of extra complexity to it.
// FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.
//// Functions
//static const char* ImGui_ImplX11_GetClipboardText(void* data) {
//// auto sel = XInternAtom(display, "CLIPBOARD", false);
//// auto utf = XInternAtom(display, "UTF8_STRING", false);
//// Window WindowWithSelection = XGetSelectionOwner(display, sel);
//// if (WindowWithSelection == None)
//// return "";
//// auto fake = XCreateSimpleWindow(display, root, -10, -10, 1, 1, 0, 0, 0);
//// auto fakeProperty = XInternAtom(display, "UGHX11", false);
//// XConvertSelection(display, sel, utf, fakeProperty, fake, CurrentTime);
//// int di;
//// unsigned long size, dul;
//// unsigned char* clipboard;
//// XGetWindowProperty(display, fake, fakeProperty, 0, 0, false, AnyPropertyType, &type, )
//// TODO:
// return "\0";
//}
//
//void ImGui_ImplX11_SetClipboardText(void* data) {
// // TODO:
// //glfwSetClipboardString((GLFWwindow*)user_data, text);
//}
static ImGuiKey ImGui_ImplX11_KeyToImGuiKey(unsigned int key) {
switch (key) {
case XK_Tab: return ImGuiKey_Tab;
case XK_Left: return ImGuiKey_LeftArrow;
case XK_Right: return ImGuiKey_RightArrow;
case XK_Up: return ImGuiKey_UpArrow;
case XK_Down: return ImGuiKey_DownArrow;
case XK_Page_Up: return ImGuiKey_PageUp;
case XK_Page_Down: return ImGuiKey_PageDown;
case XK_Home: return ImGuiKey_Home;
case XK_End: return ImGuiKey_End;
case XK_Insert: return ImGuiKey_Insert;
case XK_Delete: return ImGuiKey_Delete;
case XK_BackSpace: return ImGuiKey_Backspace;
case XK_space: return ImGuiKey_Space;
case XK_Return: return ImGuiKey_Enter;
case XK_Escape: return ImGuiKey_Escape;
case XK_apostrophe: return ImGuiKey_Apostrophe;
case XK_comma: return ImGuiKey_Comma;
case XK_minus: return ImGuiKey_Minus;
case XK_period: return ImGuiKey_Period;
case XK_slash: return ImGuiKey_Slash;
case XK_semicolon: return ImGuiKey_Semicolon;
case XK_equal: return ImGuiKey_Equal;
case XK_bracketleft: return ImGuiKey_LeftBracket;
case XK_backslash: return ImGuiKey_Backslash;
case XK_bracketright: return ImGuiKey_RightBracket;
case XK_grave: return ImGuiKey_GraveAccent;
case XK_Caps_Lock: return ImGuiKey_CapsLock;
case XK_Scroll_Lock: return ImGuiKey_ScrollLock;
case XK_Num_Lock: return ImGuiKey_NumLock;
case XK_Print: return ImGuiKey_PrintScreen;
case XK_Pause: return ImGuiKey_Pause;
case XK_KP_0: return ImGuiKey_Keypad0;
case XK_KP_1: return ImGuiKey_Keypad1;
case XK_KP_2: return ImGuiKey_Keypad2;
case XK_KP_3: return ImGuiKey_Keypad3;
case XK_KP_4: return ImGuiKey_Keypad4;
case XK_KP_5: return ImGuiKey_Keypad5;
case XK_KP_6: return ImGuiKey_Keypad6;
case XK_KP_7: return ImGuiKey_Keypad7;
case XK_KP_8: return ImGuiKey_Keypad8;
case XK_KP_9: return ImGuiKey_Keypad9;
case XK_KP_Decimal: return ImGuiKey_KeypadDecimal;
case XK_KP_Divide: return ImGuiKey_KeypadDivide;
case XK_KP_Multiply: return ImGuiKey_KeypadMultiply;
case XK_KP_Subtract: return ImGuiKey_KeypadSubtract;
case XK_KP_Add: return ImGuiKey_KeypadAdd;
case XK_KP_Enter: return ImGuiKey_KeypadEnter;
case XK_KP_Equal: return ImGuiKey_KeypadEqual;
case XK_Shift_L: return ImGuiKey_LeftShift;
case XK_Control_L: return ImGuiKey_LeftCtrl;
case XK_Alt_L: return ImGuiKey_LeftAlt;
case XK_Super_L: return ImGuiKey_LeftSuper;
case XK_Shift_R: return ImGuiKey_RightShift;
case XK_Control_R: return ImGuiKey_RightCtrl;
case XK_Alt_R: return ImGuiKey_RightAlt;
case XK_Super_R: return ImGuiKey_RightSuper;
case XK_Menu: return ImGuiKey_Menu;
case XK_0: return ImGuiKey_0;
case XK_1: return ImGuiKey_1;
case XK_2: return ImGuiKey_2;
case XK_3: return ImGuiKey_3;
case XK_4: return ImGuiKey_4;
case XK_5: return ImGuiKey_5;
case XK_6: return ImGuiKey_6;
case XK_7: return ImGuiKey_7;
case XK_8: return ImGuiKey_8;
case XK_9: return ImGuiKey_9;
case XK_A: return ImGuiKey_A;
case XK_B: return ImGuiKey_B;
case XK_C: return ImGuiKey_C;
case XK_D: return ImGuiKey_D;
case XK_E: return ImGuiKey_E;
case XK_F: return ImGuiKey_F;
case XK_G: return ImGuiKey_G;
case XK_H: return ImGuiKey_H;
case XK_I: return ImGuiKey_I;
case XK_J: return ImGuiKey_J;
case XK_K: return ImGuiKey_K;
case XK_L: return ImGuiKey_L;
case XK_M: return ImGuiKey_M;
case XK_N: return ImGuiKey_N;
case XK_O: return ImGuiKey_O;
case XK_P: return ImGuiKey_P;
case XK_Q: return ImGuiKey_Q;
case XK_R: return ImGuiKey_R;
case XK_S: return ImGuiKey_S;
case XK_T: return ImGuiKey_T;
case XK_U: return ImGuiKey_U;
case XK_V: return ImGuiKey_V;
case XK_W: return ImGuiKey_W;
case XK_X: return ImGuiKey_X;
case XK_Y: return ImGuiKey_Y;
case XK_Z: return ImGuiKey_Z;
case XK_a: return ImGuiKey_A;
case XK_b: return ImGuiKey_B;
case XK_c: return ImGuiKey_C;
case XK_d: return ImGuiKey_D;
case XK_e: return ImGuiKey_E;
case XK_f: return ImGuiKey_F;
case XK_g: return ImGuiKey_G;
case XK_h: return ImGuiKey_H;
case XK_i: return ImGuiKey_I;
case XK_j: return ImGuiKey_J;
case XK_k: return ImGuiKey_K;
case XK_l: return ImGuiKey_L;
case XK_m: return ImGuiKey_M;
case XK_n: return ImGuiKey_N;
case XK_o: return ImGuiKey_O;
case XK_p: return ImGuiKey_P;
case XK_q: return ImGuiKey_Q;
case XK_r: return ImGuiKey_R;
case XK_s: return ImGuiKey_S;
case XK_t: return ImGuiKey_T;
case XK_u: return ImGuiKey_U;
case XK_v: return ImGuiKey_V;
case XK_w: return ImGuiKey_W;
case XK_x: return ImGuiKey_X;
case XK_y: return ImGuiKey_Y;
case XK_z: return ImGuiKey_Z;
case XK_F1: return ImGuiKey_F1;
case XK_F2: return ImGuiKey_F2;
case XK_F3: return ImGuiKey_F3;
case XK_F4: return ImGuiKey_F4;
case XK_F5: return ImGuiKey_F5;
case XK_F6: return ImGuiKey_F6;
case XK_F7: return ImGuiKey_F7;
case XK_F8: return ImGuiKey_F8;
case XK_F9: return ImGuiKey_F9;
case XK_F10: return ImGuiKey_F10;
case XK_F11: return ImGuiKey_F11;
case XK_F12: return ImGuiKey_F12;
default: return ImGuiKey_None;
}
}
int ImGui_ImplX11_KeyToModifier(unsigned int key) {
if (key == XK_Control_L || key == XK_Control_R)
return RT_CONTROL;
if (key == XK_Shift_L || key == XK_Shift_R)
return RT_SHIFT;
if (key == XK_Alt_L || key == XK_Alt_R)
return RT_ALT;
if (key == XK_Super_L || key == XK_Super_R)
return RT_SUPER;
return 0;
}
void ImGui_ImplX11_UpdateKeyModifiers(int mods)
{
ImGuiIO& io = ImGui::GetIO();
io.AddKeyEvent(ImGuiModFlags_Ctrl, (mods & RT_CONTROL) != 0);
io.AddKeyEvent(ImGuiModFlags_Shift, (mods & RT_SHIFT) != 0);
io.AddKeyEvent(ImGuiModFlags_Alt, (mods & RT_ALT) != 0);
io.AddKeyEvent(ImGuiModFlags_Super, (mods & RT_SUPER) != 0);
}
void ImGui_ImplX11_MouseButtonCallback(unsigned int button, bool press, int mods) {
ImGuiIO& io = ImGui::GetIO();
if (button < ImGuiMouseButton_COUNT)
io.AddMouseButtonEvent((int)button, press);
}
void ImGui_ImplX11_ScrollCallback(double xoffset, double yoffset) {
ImGuiIO& io = ImGui::GetIO();
io.AddMouseWheelEvent((float)xoffset, (float)yoffset);
}
static int ImGui_ImplX11_TranslateUntranslatedKey(unsigned int key, int scancode) {
#if GLFW_HAS_GETKEYNAME && !defined(__EMSCRIPTEN__)
// GLFW 3.1+ attempts to "untranslate" keys, which goes the opposite of what every other framework does, making using lettered shortcuts difficult.
// (It had reasons to do so: namely GLFW is/was more likely to be used for WASD-type game controls rather than lettered shortcuts, but IHMO the 3.1 change could have been done differently)
// See https://github.com/glfw/glfw/issues/1502 for details.
// Adding a workaround to undo this (so our keys are translated->untranslated->translated, likely a lossy process).
// This won't cover edge cases but this is at least going to cover common cases.
if (key >= GLFW_KEY_KP_0 && key <= GLFW_KEY_KP_EQUAL)
return key;
const char* key_name = glfwGetKeyName(key, scancode);
if (key_name && key_name[0] != 0 && key_name[1] == 0)
{
const char char_names[] = "`-=[]\\,;\'./";
const int char_keys[] = { GLFW_KEY_GRAVE_ACCENT, GLFW_KEY_MINUS, GLFW_KEY_EQUAL, GLFW_KEY_LEFT_BRACKET, GLFW_KEY_RIGHT_BRACKET, GLFW_KEY_BACKSLASH, GLFW_KEY_COMMA, GLFW_KEY_SEMICOLON, GLFW_KEY_APOSTROPHE, GLFW_KEY_PERIOD, GLFW_KEY_SLASH, 0 };
IM_ASSERT(IM_ARRAYSIZE(char_names) == IM_ARRAYSIZE(char_keys));
if (key_name[0] >= '0' && key_name[0] <= '9') { key = GLFW_KEY_0 + (key_name[0] - '0'); }
else if (key_name[0] >= 'A' && key_name[0] <= 'Z') { key = GLFW_KEY_A + (key_name[0] - 'A'); }
else if (key_name[0] >= 'a' && key_name[0] <= 'z') { key = GLFW_KEY_A + (key_name[0] - 'a'); }
else if (const char* p = strchr(char_names, key_name[0])) { key = char_keys[p - char_names]; }
}
// if (action == GLFW_PRESS) printf("key %d scancode %d name '%s'\n", key, scancode, key_name);
#else
IM_UNUSED(scancode);
#endif
return key;
}
void ImGui_ImplX11_KeyCallback(unsigned int keycode, int scancode, bool press, int mods) {
// Workaround: X11 does not include current pressed/released modifier key in 'mods' flags. https://github.com/glfw/glfw/issues/1630
if (int keycode_to_mod = ImGui_ImplX11_KeyToModifier(keycode))
mods = (press) ? (mods | keycode_to_mod) : (mods & ~keycode_to_mod);
ImGui_ImplX11_UpdateKeyModifiers(mods);
//keycode = ImGui_ImplX11_TranslateUntranslatedKey(keycode, scancode);
ImGuiIO& io = ImGui::GetIO();
ImGuiKey imgui_key = ImGui_ImplX11_KeyToImGuiKey(keycode);
if (!press && ((keycode < 127 && keycode > 80) || (keycode < 64 && keycode > 31)))
io.AddInputCharacter(keycode);
io.AddKeyEvent(imgui_key, press);
io.SetKeyEventNativeData(imgui_key, (int)keycode, scancode); // To support legacy indexing (<1.87 user code)
}
void ImGui_ImplX11_WindowFocusCallback(int focused) {
ImGuiIO& io = ImGui::GetIO();
io.AddFocusEvent(focused != 0);
}
void ImGui_ImplX11_CursorPosCallback(double x, double y, bool cursorVisible) {
if (!cursorVisible)
return;
ImGuiIO& io = ImGui::GetIO();
io.AddMousePosEvent((float)x, (float)y);
}
ImVec2 LastValidMousePos {0, 0};
// Workaround: X11 seems to send spurious Leave/Enter events which would make us lose our position,
// so we back it up and restore on Leave/Enter (see https://github.com/ocornut/imgui/issues/4984)
void ImGui_ImplX11_CursorEnterCallback(int entered, bool cursorVisible) {
if (!cursorVisible)
return;
ImGuiIO& io = ImGui::GetIO();
if (entered) {
io.AddMousePosEvent(LastValidMousePos.x, LastValidMousePos.y);
} else {
LastValidMousePos = io.MousePos;
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
}
}
void ImGui_ImplX11_CharCallback(unsigned int c) {
ImGuiIO& io = ImGui::GetIO();
io.AddInputCharacter(c);
}
void ImGui_ImplX11_MonitorCallback(int) {
// Unused in 'master' branch but 'docking' branch will use this, so we declare it ahead of it so if you have to install callbacks you can install this one too.
}
void ImGui_ImplX11_InstallCallbacks() {
}
void ImGui_ImplX11_RestoreCallbacks() {
}
bool ImGui_ImplX11_Init() {
ImGuiIO& io = ImGui::GetIO();
IM_ASSERT(io.BackendPlatformUserData == nullptr && "Already initialized a platform backend!");
//printf("GLFW_VERSION: %d.%d.%d (%d)", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVISION, GLFW_VERSION_COMBINED);
// Setup backend capabilities flags
io.BackendPlatformName = "imgui_impl_glfw";
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
// TODO
//io.SetClipboardTextFn = ImGui_ImplX11_SetClipboardText;
//io.GetClipboardTextFn = ImGui_ImplX11_GetClipboardText;
//io.ClipboardUserData = bd->Window;
// Create mouse cursors
// (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
// GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
// Missing cursors will return nullptr and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
/* GLFWerrorfun prev_error_callback = glfwSetErrorCallback(nullptr);
bd->MouseCursors[ImGuiMouseCursor_Arrow] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_TextInput] = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNS] = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeEW] = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_Hand] = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
#if GLFW_HAS_NEW_CURSORS
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_RESIZE_ALL_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_RESIZE_NESW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_RESIZE_NWSE_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_NOT_ALLOWED_CURSOR);
#else
bd->MouseCursors[ImGuiMouseCursor_ResizeAll] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNESW] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_ResizeNWSE] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
bd->MouseCursors[ImGuiMouseCursor_NotAllowed] = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
#endif*/
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
return true;
}
void ImGui_ImplX11_Shutdown()
{
ImGuiIO& io = ImGui::GetIO();
io.BackendPlatformName = nullptr;
io.BackendPlatformUserData = nullptr;
}
void ImGui_ImplX11_UpdateMouseData(bool cursorVisible, bool focused) {
ImGuiIO& io = ImGui::GetIO();
if (!cursorVisible) {
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
return;
}
if (focused) {
// TODO:
// (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
//if (io.WantSetMousePos)
// glfwSetCursorPos(bd->Window, (double)io.MousePos.x, (double)io.MousePos.y);
// (Optional) Fallback to provide mouse position when focused (ImGui_ImplX11_CursorPosCallback already provides this when hovered or captured)
/*if (is_app_focused && bd->MouseWindow == nullptr)
{
double mouse_x, mouse_y;
glfwGetCursorPos(bd->Window, &mouse_x, &mouse_y);
io.AddMousePosEvent((float)mouse_x, (float)mouse_y);
bd->LastValidMousePos = ImVec2((float)mouse_x, (float)mouse_y);
}*/
}
}
void ImGui_ImplX11_UpdateMouseCursor() {
// TODO:
/*ImGuiIO& io = ImGui::GetIO();
ImGui_ImplX11_Data* bd = ImGui_ImplX11_GetBackendData();
if ((io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) || glfwGetInputMode(bd->Window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
return;
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)
{
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
glfwSetInputMode(bd->Window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
}
else
{
// Show OS mouse cursor
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
glfwSetCursor(bd->Window, bd->MouseCursors[imgui_cursor] ? bd->MouseCursors[imgui_cursor] : bd->MouseCursors[ImGuiMouseCursor_Arrow]);
glfwSetInputMode(bd->Window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}*/
}
double DTime = 0;
void ImGui_ImplX11_NewFrame(double time, int display_w, int display_h, int w, int h) {
ImGuiIO& io = ImGui::GetIO();
// Setup display size (every frame to accommodate for window resizing)
io.DisplaySize = ImVec2((float)w, (float)h);
if (w > 0 && h > 0)
io.DisplayFramebufferScale = ImVec2((float)display_w / (float)w, (float)display_h / (float)h);
// Setup time step
double current_time = time / 1000.0;
io.DeltaTime = DTime > 0.0 ? (float)(current_time - DTime) : (float)(1.0f / 60.0f);
DTime = current_time;
ImGui_ImplX11_UpdateMouseCursor();
}