├── .clang-format ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── bwidgets ├── CMakeLists.txt ├── COPYING ├── bwContext.h ├── bwEvent.cc ├── bwEvent.h ├── bwEventDispatcher.cc ├── bwEventDispatcher.h ├── bwIconInterface.h ├── bwLayoutInterface.h ├── bwPaintEngine.h ├── bwPainter.cc ├── bwPainter.h ├── generics │ ├── CMakeLists.txt │ ├── bwColor.cc │ ├── bwColor.h │ ├── bwDistance.h │ ├── bwFunctorInterface.h │ ├── bwGradient.cc │ ├── bwGradient.h │ ├── bwPoint.cc │ ├── bwPoint.h │ ├── bwPolygon.cc │ ├── bwPolygon.h │ ├── bwRange.h │ └── bwRectangle.h ├── gpl2_license.txt ├── mit_license.txt ├── screen_graph │ ├── Builder.cc │ ├── Builder.h │ ├── Drawer.cc │ ├── Drawer.h │ ├── EventHandler.cc │ ├── EventHandler.h │ ├── Iterators.cc │ ├── Iterators.h │ ├── Node.h │ └── ScreenGraph.h ├── styling │ ├── bwStyle.cc │ ├── bwStyle.h │ ├── bwStyleCSS.cc │ ├── bwStyleCSS.h │ ├── bwStyleManager.cc │ ├── bwStyleManager.h │ ├── bwStyleProperties.cc │ ├── bwStyleProperties.h │ ├── bwWidgetBaseStyle.cc │ ├── bwWidgetBaseStyle.h │ └── styles │ │ ├── bwStyleClassic.cc │ │ ├── bwStyleClassic.h │ │ ├── bwStyleFlatDark.cc │ │ ├── bwStyleFlatDark.h │ │ ├── bwStyleFlatGrey.cc │ │ ├── bwStyleFlatGrey.h │ │ ├── bwStyleFlatLight.cc │ │ └── bwStyleFlatLight.h ├── utils │ ├── CMakeLists.txt │ └── bwUtil.h └── widgets │ ├── CMakeLists.txt │ ├── builtin_widgets.h │ ├── bwAbstractButton.cc │ ├── bwAbstractButton.h │ ├── bwCheckbox.cc │ ├── bwCheckbox.h │ ├── bwContainerWidget.cc │ ├── bwContainerWidget.h │ ├── bwLabel.cc │ ├── bwLabel.h │ ├── bwNumberSlider.cc │ ├── bwNumberSlider.h │ ├── bwPanel.cc │ ├── bwPanel.h │ ├── bwPushButton.cc │ ├── bwPushButton.h │ ├── bwRadioButton.cc │ ├── bwRadioButton.h │ ├── bwScrollBar.cc │ ├── bwScrollBar.h │ ├── bwScrollView.cc │ ├── bwScrollView.h │ ├── bwTextBox.cc │ ├── bwTextBox.h │ ├── bwWidget.cc │ └── bwWidget.h ├── demo ├── Application.cc ├── Application.h ├── CMakeLists.txt ├── COPYING ├── File.cc ├── File.h ├── Pixmap.cc ├── Pixmap.h ├── RNAProperty.h ├── RNAScreenGraphBuilder.h ├── bwidgets_demo.cc ├── extern │ ├── .clang-format │ ├── CMakeLists.txt │ ├── gawain │ │ ├── CMakeLists.txt │ │ ├── gawain │ │ │ ├── gwn_attr_binding.h │ │ │ ├── gwn_attr_binding_private.h │ │ │ ├── gwn_batch.h │ │ │ ├── gwn_batch_private.h │ │ │ ├── gwn_buffer_id.h │ │ │ ├── gwn_common.h │ │ │ ├── gwn_context.h │ │ │ ├── gwn_element.h │ │ │ ├── gwn_imm_util.h │ │ │ ├── gwn_immediate.h │ │ │ ├── gwn_primitive.h │ │ │ ├── gwn_primitive_private.h │ │ │ ├── gwn_shader_interface.h │ │ │ ├── gwn_vertex_array_id.h │ │ │ ├── gwn_vertex_buffer.h │ │ │ ├── gwn_vertex_format.h │ │ │ └── gwn_vertex_format_private.h │ │ └── src │ │ │ ├── gwn_attr_binding.c │ │ │ ├── gwn_batch.c │ │ │ ├── gwn_buffer_id.cpp │ │ │ ├── gwn_element.c │ │ │ ├── gwn_imm_util.c │ │ │ ├── gwn_immediate.c │ │ │ ├── gwn_primitive.c │ │ │ ├── gwn_shader_interface.c │ │ │ ├── gwn_vertex_array_id.cpp │ │ │ ├── gwn_vertex_buffer.c │ │ │ └── gwn_vertex_format.c │ ├── glew │ │ ├── CMakeLists.txt │ │ ├── LICENSE.txt │ │ ├── include │ │ │ └── GL │ │ │ │ ├── eglew.h │ │ │ │ ├── glew.h │ │ │ │ ├── glxew.h │ │ │ │ └── wglew.h │ │ └── src │ │ │ ├── glew.c │ │ │ ├── glewinfo.c │ │ │ └── visualinfo.c │ ├── glfw │ │ ├── CMake │ │ │ ├── GenerateMappings.cmake │ │ │ ├── MacOSXBundleInfo.plist.in │ │ │ ├── i686-w64-mingw32-clang.cmake │ │ │ ├── i686-w64-mingw32.cmake │ │ │ ├── modules │ │ │ │ ├── FindEpollShim.cmake │ │ │ │ ├── FindOSMesa.cmake │ │ │ │ ├── FindWaylandProtocols.cmake │ │ │ │ └── FindXKBCommon.cmake │ │ │ ├── x86_64-w64-mingw32-clang.cmake │ │ │ └── x86_64-w64-mingw32.cmake │ │ ├── CMakeLists.txt │ │ ├── LICENSE.md │ │ ├── cmake_uninstall.cmake.in │ │ ├── deps │ │ │ ├── getopt.c │ │ │ ├── getopt.h │ │ │ ├── glad │ │ │ │ ├── gl.h │ │ │ │ ├── khrplatform.h │ │ │ │ ├── vk_platform.h │ │ │ │ └── vulkan.h │ │ │ ├── glad_gl.c │ │ │ ├── glad_vulkan.c │ │ │ ├── linmath.h │ │ │ ├── mingw │ │ │ │ ├── _mingw_dxhelper.h │ │ │ │ ├── dinput.h │ │ │ │ └── xinput.h │ │ │ ├── nuklear.h │ │ │ ├── nuklear_glfw_gl2.h │ │ │ ├── stb_image_write.h │ │ │ ├── tinycthread.c │ │ │ ├── tinycthread.h │ │ │ └── vs2008 │ │ │ │ └── stdint.h │ │ ├── include │ │ │ └── GLFW │ │ │ │ ├── glfw3.h │ │ │ │ └── glfw3native.h │ │ └── src │ │ │ ├── CMakeLists.txt │ │ │ ├── cocoa_init.m │ │ │ ├── cocoa_joystick.h │ │ │ ├── cocoa_joystick.m │ │ │ ├── cocoa_monitor.m │ │ │ ├── cocoa_platform.h │ │ │ ├── cocoa_time.c │ │ │ ├── cocoa_window.m │ │ │ ├── context.c │ │ │ ├── egl_context.c │ │ │ ├── egl_context.h │ │ │ ├── glfw3.pc.in │ │ │ ├── glfw3Config.cmake.in │ │ │ ├── glfw_config.h.in │ │ │ ├── glx_context.c │ │ │ ├── glx_context.h │ │ │ ├── init.c │ │ │ ├── input.c │ │ │ ├── internal.h │ │ │ ├── linux_joystick.c │ │ │ ├── linux_joystick.h │ │ │ ├── mappings.h │ │ │ ├── mappings.h.in │ │ │ ├── monitor.c │ │ │ ├── nsgl_context.h │ │ │ ├── nsgl_context.m │ │ │ ├── null_init.c │ │ │ ├── null_joystick.c │ │ │ ├── null_joystick.h │ │ │ ├── null_monitor.c │ │ │ ├── null_platform.h │ │ │ ├── null_window.c │ │ │ ├── osmesa_context.c │ │ │ ├── osmesa_context.h │ │ │ ├── posix_thread.c │ │ │ ├── posix_thread.h │ │ │ ├── posix_time.c │ │ │ ├── posix_time.h │ │ │ ├── vulkan.c │ │ │ ├── wgl_context.c │ │ │ ├── wgl_context.h │ │ │ ├── win32_init.c │ │ │ ├── win32_joystick.c │ │ │ ├── win32_joystick.h │ │ │ ├── win32_monitor.c │ │ │ ├── win32_platform.h │ │ │ ├── win32_thread.c │ │ │ ├── win32_time.c │ │ │ ├── win32_window.c │ │ │ ├── window.c │ │ │ ├── wl_init.c │ │ │ ├── wl_monitor.c │ │ │ ├── wl_platform.h │ │ │ ├── wl_window.c │ │ │ ├── x11_init.c │ │ │ ├── x11_monitor.c │ │ │ ├── x11_platform.h │ │ │ ├── x11_window.c │ │ │ ├── xkb_unicode.c │ │ │ └── xkb_unicode.h │ ├── glm │ │ ├── CMakeLists.txt │ │ ├── LICENSE.txt │ │ ├── common.hpp │ │ ├── detail │ │ │ ├── _features.hpp │ │ │ ├── _fixes.hpp │ │ │ ├── _noise.hpp │ │ │ ├── _swizzle.hpp │ │ │ ├── _swizzle_func.hpp │ │ │ ├── _vectorize.hpp │ │ │ ├── dummy.cpp │ │ │ ├── func_common.hpp │ │ │ ├── func_common.inl │ │ │ ├── func_common_simd.inl │ │ │ ├── func_exponential.hpp │ │ │ ├── func_exponential.inl │ │ │ ├── func_exponential_simd.inl │ │ │ ├── func_geometric.hpp │ │ │ ├── func_geometric.inl │ │ │ ├── func_geometric_simd.inl │ │ │ ├── func_integer.hpp │ │ │ ├── func_integer.inl │ │ │ ├── func_integer_simd.inl │ │ │ ├── func_matrix.hpp │ │ │ ├── func_matrix.inl │ │ │ ├── func_matrix_simd.inl │ │ │ ├── func_packing.hpp │ │ │ ├── func_packing.inl │ │ │ ├── func_packing_simd.inl │ │ │ ├── func_trigonometric.hpp │ │ │ ├── func_trigonometric.inl │ │ │ ├── func_trigonometric_simd.inl │ │ │ ├── func_vector_relational.hpp │ │ │ ├── func_vector_relational.inl │ │ │ ├── func_vector_relational_simd.inl │ │ │ ├── glm.cpp │ │ │ ├── precision.hpp │ │ │ ├── setup.hpp │ │ │ ├── type_float.hpp │ │ │ ├── type_gentype.hpp │ │ │ ├── type_gentype.inl │ │ │ ├── type_half.hpp │ │ │ ├── type_half.inl │ │ │ ├── type_int.hpp │ │ │ ├── type_mat.hpp │ │ │ ├── type_mat.inl │ │ │ ├── type_mat2x2.hpp │ │ │ ├── type_mat2x2.inl │ │ │ ├── type_mat2x3.hpp │ │ │ ├── type_mat2x3.inl │ │ │ ├── type_mat2x4.hpp │ │ │ ├── type_mat2x4.inl │ │ │ ├── type_mat3x2.hpp │ │ │ ├── type_mat3x2.inl │ │ │ ├── type_mat3x3.hpp │ │ │ ├── type_mat3x3.inl │ │ │ ├── type_mat3x4.hpp │ │ │ ├── type_mat3x4.inl │ │ │ ├── type_mat4x2.hpp │ │ │ ├── type_mat4x2.inl │ │ │ ├── type_mat4x3.hpp │ │ │ ├── type_mat4x3.inl │ │ │ ├── type_mat4x4.hpp │ │ │ ├── type_mat4x4.inl │ │ │ ├── type_mat4x4_simd.inl │ │ │ ├── type_vec.hpp │ │ │ ├── type_vec.inl │ │ │ ├── type_vec1.hpp │ │ │ ├── type_vec1.inl │ │ │ ├── type_vec2.hpp │ │ │ ├── type_vec2.inl │ │ │ ├── type_vec3.hpp │ │ │ ├── type_vec3.inl │ │ │ ├── type_vec4.hpp │ │ │ ├── type_vec4.inl │ │ │ └── type_vec4_simd.inl │ │ ├── exponential.hpp │ │ ├── ext.hpp │ │ ├── fwd.hpp │ │ ├── geometric.hpp │ │ ├── glm.hpp │ │ ├── gtc │ │ │ ├── bitfield.hpp │ │ │ ├── bitfield.inl │ │ │ ├── color_encoding.inl │ │ │ ├── color_space.hpp │ │ │ ├── color_space.inl │ │ │ ├── constants.hpp │ │ │ ├── constants.inl │ │ │ ├── epsilon.hpp │ │ │ ├── epsilon.inl │ │ │ ├── functions.hpp │ │ │ ├── functions.inl │ │ │ ├── integer.hpp │ │ │ ├── integer.inl │ │ │ ├── matrix_access.hpp │ │ │ ├── matrix_access.inl │ │ │ ├── matrix_integer.hpp │ │ │ ├── matrix_inverse.hpp │ │ │ ├── matrix_inverse.inl │ │ │ ├── matrix_transform.hpp │ │ │ ├── matrix_transform.inl │ │ │ ├── noise.hpp │ │ │ ├── noise.inl │ │ │ ├── packing.hpp │ │ │ ├── packing.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── quaternion_simd.inl │ │ │ ├── random.hpp │ │ │ ├── random.inl │ │ │ ├── reciprocal.hpp │ │ │ ├── reciprocal.inl │ │ │ ├── round.hpp │ │ │ ├── round.inl │ │ │ ├── type_aligned.hpp │ │ │ ├── type_precision.hpp │ │ │ ├── type_precision.inl │ │ │ ├── type_ptr.hpp │ │ │ ├── type_ptr.inl │ │ │ ├── ulp.hpp │ │ │ ├── ulp.inl │ │ │ ├── vec1.hpp │ │ │ └── vec1.inl │ │ ├── gtx │ │ │ ├── associated_min_max.hpp │ │ │ ├── associated_min_max.inl │ │ │ ├── bit.hpp │ │ │ ├── bit.inl │ │ │ ├── closest_point.hpp │ │ │ ├── closest_point.inl │ │ │ ├── color_space.hpp │ │ │ ├── color_space.inl │ │ │ ├── color_space_YCoCg.hpp │ │ │ ├── color_space_YCoCg.inl │ │ │ ├── common.hpp │ │ │ ├── common.inl │ │ │ ├── compatibility.hpp │ │ │ ├── compatibility.inl │ │ │ ├── component_wise.hpp │ │ │ ├── component_wise.inl │ │ │ ├── dual_quaternion.hpp │ │ │ ├── dual_quaternion.inl │ │ │ ├── euler_angles.hpp │ │ │ ├── euler_angles.inl │ │ │ ├── extend.hpp │ │ │ ├── extend.inl │ │ │ ├── extended_min_max.hpp │ │ │ ├── extended_min_max.inl │ │ │ ├── fast_exponential.hpp │ │ │ ├── fast_exponential.inl │ │ │ ├── fast_square_root.hpp │ │ │ ├── fast_square_root.inl │ │ │ ├── fast_trigonometry.hpp │ │ │ ├── fast_trigonometry.inl │ │ │ ├── float_notmalize.inl │ │ │ ├── gradient_paint.hpp │ │ │ ├── gradient_paint.inl │ │ │ ├── handed_coordinate_space.hpp │ │ │ ├── handed_coordinate_space.inl │ │ │ ├── hash.hpp │ │ │ ├── hash.inl │ │ │ ├── integer.hpp │ │ │ ├── integer.inl │ │ │ ├── intersect.hpp │ │ │ ├── intersect.inl │ │ │ ├── io.hpp │ │ │ ├── io.inl │ │ │ ├── log_base.hpp │ │ │ ├── log_base.inl │ │ │ ├── matrix_cross_product.hpp │ │ │ ├── matrix_cross_product.inl │ │ │ ├── matrix_decompose.hpp │ │ │ ├── matrix_decompose.inl │ │ │ ├── matrix_interpolation.hpp │ │ │ ├── matrix_interpolation.inl │ │ │ ├── matrix_major_storage.hpp │ │ │ ├── matrix_major_storage.inl │ │ │ ├── matrix_operation.hpp │ │ │ ├── matrix_operation.inl │ │ │ ├── matrix_query.hpp │ │ │ ├── matrix_query.inl │ │ │ ├── matrix_transform_2d.hpp │ │ │ ├── matrix_transform_2d.inl │ │ │ ├── mixed_product.hpp │ │ │ ├── mixed_product.inl │ │ │ ├── norm.hpp │ │ │ ├── norm.inl │ │ │ ├── normal.hpp │ │ │ ├── normal.inl │ │ │ ├── normalize_dot.hpp │ │ │ ├── normalize_dot.inl │ │ │ ├── number_precision.hpp │ │ │ ├── number_precision.inl │ │ │ ├── optimum_pow.hpp │ │ │ ├── optimum_pow.inl │ │ │ ├── orthonormalize.hpp │ │ │ ├── orthonormalize.inl │ │ │ ├── perpendicular.hpp │ │ │ ├── perpendicular.inl │ │ │ ├── polar_coordinates.hpp │ │ │ ├── polar_coordinates.inl │ │ │ ├── projection.hpp │ │ │ ├── projection.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── range.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── raw_data.inl │ │ │ ├── rotate_normalized_axis.hpp │ │ │ ├── rotate_normalized_axis.inl │ │ │ ├── rotate_vector.hpp │ │ │ ├── rotate_vector.inl │ │ │ ├── scalar_multiplication.hpp │ │ │ ├── scalar_relational.hpp │ │ │ ├── scalar_relational.inl │ │ │ ├── simd_mat4.hpp │ │ │ ├── simd_mat4.inl │ │ │ ├── simd_quat.hpp │ │ │ ├── simd_quat.inl │ │ │ ├── simd_vec4.hpp │ │ │ ├── simd_vec4.inl │ │ │ ├── spline.hpp │ │ │ ├── spline.inl │ │ │ ├── std_based_type.hpp │ │ │ ├── std_based_type.inl │ │ │ ├── string_cast.hpp │ │ │ ├── string_cast.inl │ │ │ ├── transform.hpp │ │ │ ├── transform.inl │ │ │ ├── transform2.hpp │ │ │ ├── transform2.inl │ │ │ ├── type_aligned.hpp │ │ │ ├── type_aligned.inl │ │ │ ├── type_trait.hpp │ │ │ ├── type_trait.inl │ │ │ ├── vector_angle.hpp │ │ │ ├── vector_angle.inl │ │ │ ├── vector_query.hpp │ │ │ ├── vector_query.inl │ │ │ ├── wrap.hpp │ │ │ └── wrap.inl │ │ ├── integer.hpp │ │ ├── mat2x2.hpp │ │ ├── mat2x3.hpp │ │ ├── mat2x4.hpp │ │ ├── mat3x2.hpp │ │ ├── mat3x3.hpp │ │ ├── mat3x4.hpp │ │ ├── mat4x2.hpp │ │ ├── mat4x3.hpp │ │ ├── mat4x4.hpp │ │ ├── matrix.hpp │ │ ├── packing.hpp │ │ ├── simd │ │ │ ├── common.h │ │ │ ├── exponential.h │ │ │ ├── geometric.h │ │ │ ├── integer.h │ │ │ ├── matrix.h │ │ │ ├── packing.h │ │ │ ├── platform.h │ │ │ ├── trigonometric.h │ │ │ └── vector_relational.h │ │ ├── trigonometric.hpp │ │ ├── vec2.hpp │ │ ├── vec3.hpp │ │ ├── vec4.hpp │ │ └── vector_relational.hpp │ └── katana-parser │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── THANKS │ │ ├── src │ │ ├── foundation.c │ │ ├── foundation.h │ │ ├── katana.h │ │ ├── katana.lex.c │ │ ├── katana.lex.h │ │ ├── katana.tab.c │ │ ├── katana.tab.h │ │ ├── parser.c │ │ ├── parser.h │ │ ├── selector.c │ │ ├── selector.h │ │ ├── tokenizer.c │ │ └── tokenizer.h │ │ └── visualc │ │ ├── include │ │ ├── strings.h │ │ ├── unistd.h │ │ └── util.h │ │ ├── katana.vcxproj │ │ ├── katana.vcxproj.filters │ │ └── katana.vcxproj.user ├── gpu │ ├── CMakeLists.txt │ ├── GPU.h │ ├── GPUShader.cc │ ├── GPUShader.h │ ├── GPU_glfw.h │ ├── gpu.cc │ ├── gpu_intern.h │ ├── gpu_matrix.cc │ └── shaders │ │ ├── pixel_alpha_mask_texture_uniform_color_frag.glsl │ │ ├── smooth_color_frag.glsl │ │ ├── smooth_color_vert.glsl │ │ ├── subpixel_alpha_mask_texture_uniform_color_frag.glsl │ │ ├── texture_frag.glsl │ │ ├── texture_vert.glsl │ │ ├── uniform_color_frag.glsl │ │ └── uniform_color_vert.glsl ├── resources │ ├── LICENSE-bfont.ttf.txt │ ├── bfont.ttf │ ├── blender_icon_defines.h │ ├── blender_icons.h │ ├── blender_icons16.png │ ├── classic_style.css │ ├── flat_dark.css │ └── flat_light.css ├── screen │ ├── CMakeLists.txt │ ├── DefaultStage.cc │ ├── DefaultStage.h │ ├── DefaultStageRNAFunctor.cc │ ├── DefaultStageRNAFunctor.h │ ├── Font.cc │ ├── Font.h │ ├── GawainPaintEngine.cc │ ├── GawainPaintEngine.h │ ├── IconMap.cc │ ├── IconMap.h │ ├── Layout.cc │ ├── Layout.h │ ├── Stage.cc │ └── Stage.h ├── stylesheet │ ├── CMakeLists.txt │ ├── PropertyParser.cc │ ├── PropertyParser.h │ ├── StyleSheet.cc │ ├── StyleSheet.h │ ├── StyleSheetTree.cc │ └── StyleSheetTree.h ├── utils │ ├── CMakeLists.txt │ └── FixedNum.h └── window_manager │ ├── CMakeLists.txt │ ├── Event.cc │ ├── Event.h │ ├── EventManager.cc │ ├── EventManager.h │ ├── Window.cc │ ├── Window.h │ ├── WindowManager.cc │ └── WindowManager.h ├── docs ├── Doxyfile ├── README.md ├── bWidgets │ ├── about.md │ ├── coding_style.md │ ├── design_overview.md │ └── design_principles.md ├── build_instructions.md ├── bwidgets_vs_existing_toolkits.md ├── current_ui_code_vs_bwidgets.md ├── custom.css ├── future_plans.md ├── local_index.html ├── mainpage.md └── resources │ └── images │ ├── bwidgets_mvc.png │ └── screen_graph_responsibilities.png └── tests ├── CMakeLists.txt ├── TestUtilClasses.h ├── TestUtilMacros.h ├── bWidgets ├── CMakeLists.txt ├── bwPolygon_test.cc ├── bwStyleProperties_test.cc └── screen_graph │ └── Iterator_test.cc ├── demo └── CMakeLists.txt ├── gtest ├── .clang-format ├── CMakeLists.txt ├── LICENSE ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── custom │ │ ├── gtest-port.h │ │ ├── gtest-printers.h │ │ └── gtest.h │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port-arch.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump └── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc └── testing_main.cc /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all dotfiles by default 2 | .* 3 | 4 | build 5 | CMakeLists.txt.user 6 | 7 | # Visual Studio 8 | CMakeSettings.json 9 | 10 | # Generated docs 11 | docs/doxygen_html_output/ 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docs/resources/doxygen-awesome"] 2 | path = docs/resources/doxygen-awesome 3 | url = https://github.com/jothepro/doxygen-awesome-css.git 4 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Julian Eisel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bwidgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(INC 2 | . 3 | generics 4 | styling 5 | styling/styles 6 | utils 7 | widgets 8 | ) 9 | 10 | set(SRC 11 | bwEvent.cc 12 | bwEventDispatcher.cc 13 | bwPainter.cc 14 | screen_graph/Builder.cc 15 | screen_graph/Drawer.cc 16 | screen_graph/EventHandler.cc 17 | screen_graph/Iterators.cc 18 | styling/bwStyle.cc 19 | styling/bwStyleCSS.cc 20 | styling/bwStyleManager.cc 21 | styling/bwStyleProperties.cc 22 | styling/bwWidgetBaseStyle.cc 23 | styling/styles/bwStyleClassic.cc 24 | styling/styles/bwStyleFlatGrey.cc 25 | styling/styles/bwStyleFlatDark.cc 26 | styling/styles/bwStyleFlatLight.cc 27 | 28 | bwContext.h 29 | bwEvent.h 30 | bwEventDispatcher.h 31 | bwIconInterface.h 32 | bwLayoutInterface.h 33 | bwPaintEngine.h 34 | bwPainter.h 35 | screen_graph/Builder.h 36 | screen_graph/Drawer.h 37 | screen_graph/EventHandler.h 38 | screen_graph/Iterators.h 39 | screen_graph/Node.h 40 | screen_graph/ScreenGraph.h 41 | styling/bwStyle.h 42 | styling/bwStyleCSS.h 43 | styling/bwStyleManager.h 44 | styling/bwStyleProperties.h 45 | styling/bwWidgetBaseStyle.h 46 | styling/styles/bwStyleClassic.h 47 | styling/styles/bwStyleFlatGrey.h 48 | styling/styles/bwStyleFlatDark.h 49 | styling/styles/bwStyleFlatLight.h 50 | ) 51 | 52 | set(LIB 53 | bw_generics 54 | bw_widgets 55 | ) 56 | 57 | add_library(bWidgets) 58 | target_sources(bWidgets PRIVATE ${SRC}) 59 | include_directories(${INC}) 60 | target_link_libraries(bWidgets ${LIB}) 61 | 62 | add_subdirectory(generics) 63 | add_subdirectory(utils) 64 | add_subdirectory(widgets) 65 | -------------------------------------------------------------------------------- /bwidgets/COPYING: -------------------------------------------------------------------------------- 1 | Until further notice, files in this directory and sub-directories are licensed 2 | under the GNU General Public License (GPL) 2 or later (see gpl2_license.txt). 3 | Further modifications will be dual-licensed under the GPL 2 (or later) and the 4 | MIT license (see mit_license.txt) 5 | -------------------------------------------------------------------------------- /bwidgets/bwContext.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | class bwWidget; 6 | namespace bwScreenGraph { 7 | class Node; 8 | } 9 | 10 | /** 11 | * \brief Important state information for the screen-graph. 12 | * 13 | * Blender used to manage special states of widgets (e.g. hovered, active, 14 | * etc.) mostly using per widget flags. To query these special widgets (i.e. 15 | * the currently hovered widget), a lookup had to be performed. 16 | * Rather than requiring lookups, bWidgets uses this context data-struture for 17 | * access to special state widgets. 18 | */ 19 | struct bwContext { 20 | /** The currently hovered node (if any). */ 21 | bwScreenGraph::Node* hovered = nullptr; 22 | 23 | /** The currently active widget which gets any input (if any). */ 24 | bwScreenGraph::Node* active = nullptr; 25 | }; 26 | 27 | } // namespace bWidgets 28 | -------------------------------------------------------------------------------- /bwidgets/bwEvent.cc: -------------------------------------------------------------------------------- 1 | #include "bwEvent.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwEvent::bwEvent(bwPoint _location) : location(_location) 6 | { 7 | } 8 | 9 | void bwEvent::swallow() 10 | { 11 | is_swallowed = true; 12 | } 13 | 14 | void bwEvent::unswallow() 15 | { 16 | is_swallowed = false; 17 | } 18 | 19 | auto bwEvent::isSwallowed() const -> bool 20 | { 21 | return is_swallowed; 22 | } 23 | 24 | bwMouseButtonEvent::bwMouseButtonEvent(Button _button, bwPoint _location) 25 | : bwEvent(_location), button(_button) 26 | { 27 | } 28 | 29 | bwMouseButtonDragEvent::bwMouseButtonDragEvent(Button _button, bwPoint _location) 30 | : bwMouseButtonEvent(_button, _location), drag_state(DRAGGING_BELOW_THRESHOLD) 31 | { 32 | } 33 | 34 | void bwMouseButtonDragEvent::addMouseMovement(bwPoint new_location) 35 | { 36 | if (drag_state == DRAGGING_BELOW_THRESHOLD && 37 | distance(location, new_location) > DRAG_THRESHOLD) { 38 | drag_state = DRAGGING; 39 | } 40 | 41 | drag_distance = new_location - location; 42 | } 43 | 44 | bwMouseWheelEvent::bwMouseWheelEvent(Direction _direction, bwPoint _location) 45 | : bwMouseButtonEvent(Button::WHEEL, _location), direction(_direction) 46 | { 47 | } 48 | 49 | auto bwMouseWheelEvent::getDirection() const -> Direction 50 | { 51 | return direction; 52 | } 53 | 54 | } // namespace bWidgets 55 | -------------------------------------------------------------------------------- /bwidgets/bwEvent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwDistance.h" 4 | #include "bwPoint.h" 5 | 6 | namespace bWidgets { 7 | 8 | class bwEvent { 9 | public: 10 | bwEvent(bwPoint _location); 11 | virtual ~bwEvent() = default; 12 | 13 | void swallow(); 14 | void unswallow(); 15 | auto isSwallowed() const -> bool; 16 | 17 | /** Where did the event happen? */ 18 | const bwPoint location; 19 | 20 | private: 21 | bool is_swallowed{false}; 22 | }; 23 | 24 | class bwMouseButtonEvent : public bwEvent { 25 | public: 26 | enum class Button { 27 | LEFT, 28 | RIGHT, 29 | WHEEL, 30 | 31 | UNKNOWN 32 | }; 33 | 34 | bwMouseButtonEvent(Button _button, bwPoint _location); 35 | 36 | const Button button; 37 | }; 38 | 39 | class bwMouseButtonDragEvent : public bwMouseButtonEvent { 40 | public: 41 | enum DragState { 42 | DRAGGING_BELOW_THRESHOLD, 43 | DRAGGING, 44 | }; 45 | 46 | bwMouseButtonDragEvent(Button _button, bwPoint _location); 47 | 48 | void addMouseMovement(bwPoint new_location); 49 | 50 | const static short DRAG_THRESHOLD = 3; 51 | 52 | bwDistance drag_distance; 53 | DragState drag_state; 54 | }; 55 | 56 | class bwMouseWheelEvent : public bwMouseButtonEvent { 57 | public: 58 | enum class Direction { UP, DOWN }; 59 | 60 | bwMouseWheelEvent(Direction _direction, bwPoint _location); 61 | 62 | auto getDirection() const -> Direction; 63 | 64 | private: 65 | Direction direction; 66 | }; 67 | 68 | } // namespace bWidgets 69 | -------------------------------------------------------------------------------- /bwidgets/bwEventDispatcher.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwEvent.h" 6 | #include "bwPoint.h" 7 | 8 | namespace bWidgets { 9 | 10 | struct bwContext; 11 | namespace bwScreenGraph { 12 | class ScreenGraph; 13 | class Node; 14 | } // namespace bwScreenGraph 15 | 16 | /** 17 | * \brief Mangages sending events to screen-graph nodes based on current state. 18 | * 19 | * Based on the \link bWidgets::bwScreenGraph::ScreenGraph::context screen-graph 20 | * context as state, the event dispatcher sends events to the screen-graph nodes 21 | * in user focus (i.e. hovered or active node). That means, it calls the nodes 22 | * event listener corresponding to the determined event. 23 | */ 24 | class bwEventDispatcher { 25 | public: 26 | bwEventDispatcher(bwScreenGraph::ScreenGraph& _screen_graph); 27 | 28 | void dispatchMouseMovement(bwEvent); 29 | void dispatchMouseButtonPress(bwMouseButtonEvent&); 30 | void dispatchMouseButtonRelease(bwMouseButtonEvent&); 31 | void dispatchMouseWheelScroll(bwMouseWheelEvent&); 32 | 33 | private: 34 | auto isDragging() -> bool; 35 | void changeContextHovered(bwScreenGraph::Node*, bwEvent&); 36 | 37 | /** Reference back to the screen-graph owning this dispatcher */ 38 | bwScreenGraph::ScreenGraph& screen_graph; 39 | /** Reference to the screen-graph's context (convenience). */ 40 | bwContext& context; 41 | 42 | std::optional drag_event; 43 | }; 44 | 45 | } // namespace bWidgets 46 | -------------------------------------------------------------------------------- /bwidgets/bwIconInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | /** 6 | * \brief Interface to reference icons from within bWidgets. 7 | * 8 | * Using this interface, bWidgets can reference icon objects of which it 9 | * doesn't know any implementation details. 10 | * 11 | * To get icon drawing to work you have to: 12 | * * implement this interface as some class for storing icon data (e.g. a 13 | * bitmap wrapper), 14 | * * implement the \link bWidgets::bwPaintEngine::drawIcon 15 | * bwPaintEngine::drawIcon() function for drawing the icon data, 16 | * * call the `setIcon` function of a widget (if available) to set the icon 17 | * reference. 18 | * 19 | * \note Managing icons, including their memory, has to be done outside of 20 | * bWidgets. At no point does bWidgets take ownership over icon data. 21 | */ 22 | class bwIconInterface { 23 | public: 24 | constexpr static float ICON_DEFAULT_SIZE = 16; 25 | virtual auto isValid() const -> bool = 0; 26 | }; 27 | 28 | } // namespace bWidgets 29 | -------------------------------------------------------------------------------- /bwidgets/bwLayoutInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwRectangle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwLayoutInterface { 8 | public: 9 | virtual ~bwLayoutInterface() = default; 10 | 11 | virtual auto getRectangle() -> bwRectanglePixel = 0; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /bwidgets/generics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SRC 2 | bwColor.cc 3 | bwGradient.cc 4 | bwPoint.cc 5 | bwPolygon.cc 6 | 7 | bwColor.h 8 | bwDistance.h 9 | bwGradient.h 10 | bwFunctorInterface.h 11 | bwPoint.h 12 | bwPolygon.h 13 | bwRange.h 14 | bwRectangle.h 15 | ) 16 | 17 | add_library(bw_generics) 18 | target_sources(bw_generics PRIVATE ${SRC}) 19 | -------------------------------------------------------------------------------- /bwidgets/generics/bwColor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | class bwColor { 6 | public: 7 | bwColor(float red, float green, float blue, float alpha = 1.0f); 8 | bwColor(float rgb, float alpha = 1.0f); 9 | bwColor(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha = 255); 10 | bwColor(unsigned int rgb, unsigned int alpha = 255); 11 | bwColor() = default; 12 | ~bwColor() = default; 13 | bwColor(const bwColor&); 14 | 15 | auto shade(float rgb_shade, float alpha_shade = 0.0f) -> bwColor&; 16 | auto shade(unsigned int rgb_shade, unsigned int alpha_shade = 0.0f) -> bwColor&; 17 | 18 | void setColor(float red, float green, float blue, float alpha = 1.0f); 19 | void setColor(float rgb, float alpha = 1.0f); 20 | void setColor(const float rgba[4]); 21 | auto getColor() const -> const float*; 22 | auto operator=(const float* rgb) -> bwColor&; 23 | auto operator=(const bwColor& other_color) -> bwColor&; 24 | 25 | auto operator==(const bwColor& compare_color) const -> bool; 26 | auto operator[](const int index) -> float&; 27 | // Implicit conversion to float* 28 | operator const float*() const; 29 | 30 | private: 31 | enum class Component { 32 | RED = 0, 33 | GREEN = 1, 34 | BLUE = 2, 35 | ALPHA = 3, 36 | }; 37 | 38 | auto operator[](const Component component) -> float& 39 | { 40 | return rgba[static_cast(component)]; 41 | } 42 | 43 | void clamp(const Component component); 44 | 45 | float rgba[4]{0, 0, 0, 1}; 46 | }; 47 | 48 | } // namespace bWidgets 49 | -------------------------------------------------------------------------------- /bwidgets/generics/bwDistance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwPoint.h" 4 | 5 | namespace bWidgets { 6 | 7 | using bwDistance = bwPoint; 8 | 9 | } // namespace bWidgets 10 | -------------------------------------------------------------------------------- /bwidgets/generics/bwFunctorInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | /** 6 | * \brief Abstract function object class. 7 | * 8 | * We use this to avoid having to use function pointers with ugly void 9 | * pointers to pass type-generic data. Instead, just derive from this 10 | * interface and add needed data to the derived class. 11 | * 12 | * Example implementation: 13 | * \code{.cc} 14 | * class WidgetApplyFunctor : public bwFunctorInterface 15 | * { 16 | * bwWidget& some_widget; 17 | * 18 | * public: 19 | * WidgetApplyFunctor(bwWidget& widget) : 20 | * some_widget(widget) 21 | * { 22 | * } 23 | * 24 | * inline void operator()() override 25 | * { 26 | * some_widget.do_stuff(); 27 | * } 28 | * }; 29 | * \endcode 30 | */ 31 | class bwFunctorInterface { 32 | public: 33 | virtual void operator()() = 0; 34 | virtual ~bwFunctorInterface() = default; 35 | }; 36 | 37 | } // namespace bWidgets 38 | -------------------------------------------------------------------------------- /bwidgets/generics/bwGradient.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "bwPoint.h" 5 | 6 | #include "bwGradient.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwGradient::bwGradient(const bwColor& base_color, 11 | float shade_begin, 12 | float shade_end, 13 | Direction direction) 14 | : direction(direction) 15 | { 16 | begin = base_color; 17 | begin.shade(shade_begin); 18 | end = base_color; 19 | end.shade(shade_end); 20 | } 21 | 22 | auto bwGradient::calcPointColor(const bwPoint& point, const bwRectanglePixel& bounding_box) const 23 | -> bwColor 24 | { 25 | const float pos_fac = (direction == bwGradient::Direction::TOP_BOTTOM) ? 26 | ((point.y - bounding_box.ymin) / (float)bounding_box.height()) : 27 | ((bounding_box.xmax - point.x) / (float)bounding_box.width()); 28 | const float pos_fac_inv = 1.0f - pos_fac; 29 | 30 | assert((pos_fac > -1e-5f) && ((pos_fac - 1.0f) <= 1e-6f)); 31 | 32 | return bwColor((begin[0] * pos_fac) + (end[0] * pos_fac_inv), 33 | (begin[1] * pos_fac) + (end[1] * pos_fac_inv), 34 | (begin[2] * pos_fac) + (end[2] * pos_fac_inv), 35 | (begin[3] * pos_fac) + (end[3] * pos_fac_inv)); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /bwidgets/generics/bwGradient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwColor.h" 4 | #include "bwRectangle.h" 5 | 6 | namespace bWidgets { 7 | 8 | /** 9 | * \brief Simple class for calculating colors for gradient fills. 10 | * 11 | * The implementation is currently pretty simple and limited, it's however all we need for 12 | * now. More features like unlimited stops at custom positions could be added if needed. 13 | */ 14 | class bwGradient { 15 | public: 16 | enum class Direction { 17 | TOP_BOTTOM, 18 | LEFT_RIGHT, 19 | }; 20 | 21 | bwGradient() = default; 22 | explicit bwGradient(const bwColor& base_color, 23 | float shade_begin, 24 | float shade_end, 25 | Direction direction = Direction::TOP_BOTTOM); 26 | 27 | auto calcPointColor(const class bwPoint& point, const bwRectanglePixel& bounding_box) const 28 | -> bwColor; 29 | 30 | bwColor begin, end; 31 | Direction direction{Direction::TOP_BOTTOM}; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPoint.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwPoint.h" 4 | 5 | namespace bWidgets { 6 | 7 | bwPoint::bwPoint(float x, float y) : x(x), y(y) 8 | { 9 | } 10 | 11 | auto bwPoint::operator==(const bwPoint& rhs) const -> bool 12 | { 13 | return (x == rhs.x) && (y == rhs.y); 14 | } 15 | 16 | auto operator*(const bwPoint& lhs, float factor) -> bwPoint 17 | { 18 | return {lhs.x * factor, lhs.y * factor}; 19 | } 20 | auto operator*(float factor, const bwPoint& rhs) -> bwPoint 21 | { 22 | return {rhs.x * factor, rhs.y * factor}; 23 | } 24 | auto operator+(const bwPoint& lhs, const bwPoint& rhs) -> bwPoint 25 | { 26 | return {lhs.x + rhs.x, lhs.y + rhs.y}; 27 | } 28 | auto operator-(const bwPoint& lhs, const bwPoint& rhs) -> bwPoint 29 | { 30 | return {lhs.x - rhs.x, lhs.y - rhs.y}; 31 | } 32 | 33 | auto distance(bwPoint a, bwPoint b) -> float 34 | { 35 | return std::sqrt(std::pow(a.x - b.x, 2.0f) + std::pow(a.y - b.y, 2.0f)); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace bWidgets { 6 | 7 | class bwPoint { 8 | public: 9 | bwPoint(float x = 0, float y = 0); 10 | 11 | auto operator==(const bwPoint& rhs) const -> bool; 12 | 13 | float x, y; 14 | }; 15 | 16 | auto operator*(const bwPoint&, float) -> bwPoint; 17 | auto operator*(float, const bwPoint&) -> bwPoint; 18 | auto operator+(const bwPoint&, const bwPoint&) -> bwPoint; 19 | auto operator-(const bwPoint&, const bwPoint&) -> bwPoint; 20 | 21 | auto distance(bwPoint a, bwPoint b) -> float; 22 | 23 | } // namespace bWidgets 24 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPolygon.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "bwPoint.h" 5 | 6 | #include "bwPolygon.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwPolygon::bwPolygon(const bwPointVec& vertices) : vertices(vertices), vert_count(vertices.size()) 11 | { 12 | } 13 | 14 | bwPolygon::bwPolygon(const unsigned int reserve_vertex_count) 15 | { 16 | vertices.reserve(reserve_vertex_count); 17 | } 18 | 19 | void bwPolygon::addVertex(bwPoint vertex) 20 | { 21 | vertices.push_back(vertex); 22 | vert_count++; 23 | } 24 | 25 | void bwPolygon::addVertex(const float x, const float y) 26 | { 27 | addVertex(bwPoint(x, y)); 28 | } 29 | 30 | void bwPolygon::addVertex(const int x, const int y) 31 | { 32 | addVertex({std::roundf(x), std::roundf(y)}); 33 | } 34 | 35 | void bwPolygon::reserve(const unsigned int count) 36 | { 37 | vertices.reserve(count); 38 | } 39 | 40 | auto bwPolygon::getVertices() const -> const bwPointVec& 41 | { 42 | return vertices; 43 | } 44 | 45 | auto bwPolygon::operator[](const unsigned int index) -> bwPoint& 46 | { 47 | return vertices[index]; 48 | } 49 | 50 | auto bwPolygon::isDrawable() const -> bool 51 | { 52 | return (vert_count > 0); 53 | } 54 | 55 | } // namespace bWidgets 56 | -------------------------------------------------------------------------------- /bwidgets/generics/bwPolygon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace bWidgets { 6 | 7 | /* TODO for (2D-)polygons, we should actually use ints, not floats. Prevents precision and rounding 8 | * errors. */ 9 | using bwPointVec = std::vector; 10 | 11 | class bwPolygon { 12 | public: 13 | bwPolygon() = default; 14 | bwPolygon(const bwPolygon& poly) = default; 15 | bwPolygon(const bwPointVec& vertices); 16 | explicit bwPolygon(const unsigned int reserve_vertex_count); 17 | 18 | void addVertex(class bwPoint vertex); 19 | void addVertex(const float x, const float y); 20 | void addVertex(const int x, const int y); 21 | void reserve(const unsigned int count); 22 | auto getVertices() const -> const bwPointVec&; 23 | 24 | auto operator[](const unsigned int index) -> bwPoint&; 25 | 26 | auto isDrawable() const -> bool; 27 | 28 | protected: 29 | bwPointVec vertices{}; 30 | size_t vert_count{0}; 31 | }; 32 | 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/generics/bwRange.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace bWidgets { 4 | 5 | template class bwRange { 6 | public: 7 | bwRange(T _min, T _max) : min(_min), max(_max) 8 | { 9 | } 10 | 11 | void clampValue(T& value) 12 | { 13 | value = (value < min) ? min : ((value > max) ? max : value); 14 | } 15 | static void clampValue(T& value, const T& min, const T& max) 16 | { 17 | bwRange(min, max).clampValue(value); 18 | } 19 | 20 | bool isInside(const T& value, const bool including_min_max = false) const 21 | { 22 | if (including_min_max) { 23 | return (value >= min) && (value <= max); 24 | } 25 | else { 26 | return (value > min) && (value < max); 27 | } 28 | } 29 | static bool isInside(const T& value, 30 | const T& min, 31 | const T& max, 32 | const bool including_min_max = false) 33 | { 34 | return bwRange(min, max).isInside(value, including_min_max); 35 | } 36 | 37 | T min, max; 38 | }; 39 | 40 | } // namespace bWidgets 41 | -------------------------------------------------------------------------------- /bwidgets/mit_license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Julian Eisel 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/Builder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "Builder.h" 4 | 5 | namespace bWidgets { 6 | namespace bwScreenGraph { 7 | 8 | Builder::Builder(LayoutNode& active_layout_node) : _active_layout_node(active_layout_node) 9 | { 10 | } 11 | 12 | Builder::Builder(ScreenGraph& screen_graph) : Builder(screen_graph.Root()) 13 | { 14 | } 15 | 16 | void Builder::setLayout(LayoutNode& node, std::unique_ptr layout) 17 | { 18 | node.layout = std::move(layout); 19 | } 20 | 21 | void Builder::setWidget(WidgetNode& node, std::unique_ptr widget) 22 | { 23 | node.widget = std::move(widget); 24 | node.handler = node.widget->createHandler(); 25 | } 26 | 27 | auto Builder::addWidget(LayoutNode& node, std::unique_ptr widget) -> bwWidget& 28 | { 29 | WidgetNode& node_ref = addChildNode(node); 30 | setWidget(node_ref, std::move(widget)); 31 | return *node_ref.widget; 32 | } 33 | 34 | /** 35 | * \brief Activate a layout node. 36 | * 37 | * Adding further items will add them as children to this node, until a 38 | * different layout node is activated. 39 | */ 40 | void Builder::setActiveLayout(LayoutNode& node) 41 | { 42 | _active_layout_node = node; 43 | } 44 | 45 | } // namespace bwScreenGraph 46 | } // namespace bWidgets 47 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/Drawer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwRectangle.h" 6 | 7 | namespace bWidgets { 8 | 9 | class bwStyle; 10 | 11 | namespace bwScreenGraph { 12 | class ScreenGraph; 13 | class Node; 14 | 15 | class Drawer { 16 | public: 17 | static void draw(ScreenGraph& screen_graph, bwStyle& style); 18 | static void drawSubtree(Node& subtree_root, bwStyle& style); 19 | 20 | private: 21 | Drawer(bwStyle& style); 22 | 23 | void drawSubtreeRecursive(Node& subtree_root); 24 | void drawNode(Node& node); 25 | void pushMask(const Node& node); 26 | void popMask(); 27 | 28 | bwStyle& style; 29 | std::stack maskrect_stack; 30 | }; 31 | 32 | } // namespace bwScreenGraph 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/EventHandler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "EventHandler.h" 5 | #include "Node.h" 6 | 7 | namespace bWidgets { 8 | namespace bwScreenGraph { 9 | 10 | void EventHandler::addEventListener(EventHandler::EventType event_type, EventListener listener) 11 | { 12 | assert(event_type < TOT_EVENT_TYPES); 13 | listeners[event_type].push_back(listener); 14 | } 15 | 16 | void EventHandler::onMouseMove(bwEvent&) 17 | { 18 | } 19 | 20 | void EventHandler::onMouseEnter(bwEvent&) 21 | { 22 | } 23 | 24 | void EventHandler::onMouseLeave(bwEvent&) 25 | { 26 | } 27 | 28 | void EventHandler::onMousePress(bwMouseButtonEvent&) 29 | { 30 | } 31 | 32 | void EventHandler::onMouseRelease(bwMouseButtonEvent&) 33 | { 34 | } 35 | 36 | void EventHandler::onMouseClick(bwMouseButtonEvent&) 37 | { 38 | } 39 | 40 | void EventHandler::onMouseDrag(bwMouseButtonDragEvent&) 41 | { 42 | } 43 | 44 | void EventHandler::onMouseWheel(bwMouseWheelEvent&) 45 | { 46 | } 47 | 48 | } // namespace bwScreenGraph 49 | } // namespace bWidgets 50 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/EventHandler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace bWidgets { 9 | 10 | class bwEvent; 11 | class bwMouseButtonEvent; 12 | class bwMouseButtonDragEvent; 13 | class bwMouseWheelEvent; 14 | 15 | namespace bwScreenGraph { 16 | 17 | class Node; 18 | 19 | // TODO bwHandlingContext 20 | using EventListener = std::function; 21 | 22 | /** 23 | * \brief API for registering and calling event-listeners 24 | * 25 | * TODO: 26 | * * Only default `onFoo()` style listeners are supported, custom `addEventListener()` doesn't work 27 | * yet. 28 | * * Many widget handlers are friend classes to the widgets to access internal data. Instead 29 | * widgets should have APIs to manipulate their state anyway, which they don't have yet. 30 | */ 31 | class EventHandler { 32 | public: 33 | enum EventType { 34 | MOUSE_ENTER, 35 | MOUSE_LEAVE, 36 | 37 | TOT_EVENT_TYPES, 38 | }; 39 | 40 | EventHandler() = default; 41 | virtual ~EventHandler() = default; 42 | 43 | void addEventListener(EventType event_type, EventListener listener); 44 | 45 | virtual void onMouseMove(bwEvent&); 46 | virtual void onMouseEnter(bwEvent&); 47 | virtual void onMouseLeave(bwEvent&); 48 | virtual void onMousePress(bwMouseButtonEvent&); 49 | virtual void onMouseRelease(bwMouseButtonEvent&); 50 | virtual void onMouseClick(bwMouseButtonEvent&); 51 | virtual void onMouseDrag(bwMouseButtonDragEvent&); 52 | virtual void onMouseWheel(bwMouseWheelEvent&); 53 | 54 | private: 55 | std::array, TOT_EVENT_TYPES> listeners; 56 | // std::unordered_map> listener_map; 57 | }; 58 | 59 | } // namespace bwScreenGraph 60 | } // namespace bWidgets 61 | -------------------------------------------------------------------------------- /bwidgets/screen_graph/ScreenGraph.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwContext.h" 4 | #include "bwEventDispatcher.h" 5 | 6 | namespace bWidgets { 7 | namespace bwScreenGraph { 8 | 9 | class Node; 10 | class LayoutNode; 11 | 12 | class ScreenGraph { 13 | public: 14 | template 15 | ScreenGraph(std::unique_ptr<_NodeType> _root_node) 16 | : event_dispatcher(*this), root_node(std::move(_root_node)) 17 | { 18 | } 19 | 20 | auto Root() const -> LayoutNode& 21 | { 22 | return *root_node; 23 | } 24 | 25 | /** The context describing the state of this screen-graph */ 26 | bwContext context; 27 | bwEventDispatcher event_dispatcher; 28 | 29 | private: 30 | std::unique_ptr root_node; 31 | }; 32 | 33 | } // namespace bwScreenGraph 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyle.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | unsigned int bwStyle::s_default_widget_size_hint = 20; 8 | 9 | bwStyle::bwStyle(TypeID type_id) : type_id(type_id) 10 | { 11 | } 12 | 13 | void bwStyle::polish(class bwWidget&) 14 | { 15 | /* Nothing by default. */ 16 | } 17 | 18 | } // namespace bWidgets 19 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace bWidgets { 7 | 8 | class bwWidget; 9 | 10 | class bwStyle { 11 | public: 12 | enum class TypeID { 13 | CLASSIC, 14 | CLASSIC_CSS, 15 | FLAT_GREY, 16 | FLAT_DARK, 17 | FLAT_LIGHT, 18 | 19 | BUILTIN_TOT, 20 | 21 | // STYLE_CUSTOM, // For the future 22 | }; 23 | 24 | struct StyleType { 25 | TypeID type_id; 26 | std::string name; 27 | }; 28 | 29 | virtual ~bwStyle() = default; 30 | 31 | virtual void setWidgetStyle(bwWidget& widget) = 0; 32 | virtual void polish(bwWidget&); 33 | 34 | static unsigned int s_default_widget_size_hint; 35 | 36 | TypeID type_id; 37 | float dpi_fac{1.0f}; 38 | 39 | protected: 40 | bwStyle(TypeID type_id); 41 | }; 42 | 43 | } // namespace bWidgets 44 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleCSS.cc: -------------------------------------------------------------------------------- 1 | #include "bwAbstractButton.h" 2 | #include "bwPainter.h" 3 | 4 | #include "bwStyleCSS.h" 5 | 6 | #include "builtin_widgets.h" 7 | 8 | namespace bWidgets { 9 | 10 | void (*bwStyleCSS::polish_cb)(class bwWidget&) = nullptr; 11 | 12 | bwStyleCSS::bwStyleCSS() : bwStyle(bwStyle::TypeID::CLASSIC_CSS) 13 | { 14 | } 15 | 16 | void bwStyleCSS::setWidgetStyle(bwWidget& widget) 17 | { 18 | polish(widget); 19 | 20 | if (auto* button = widget_cast(widget)) { 21 | button->base_style.roundbox_corners = button->rounded_corners; 22 | } 23 | else if (auto* container = widget_cast(widget)) { 24 | container->base_style.roundbox_corners = RoundboxCorner::ALL; 25 | } 26 | else if (auto* text_box = widget_cast(widget)) { 27 | text_box->base_style.roundbox_corners = 28 | RoundboxCorner::ALL; // XXX Incorrect, should set this in layout. 29 | } 30 | else { 31 | // base_style->roundbox_corners = RoundboxCorner::ALL; 32 | } 33 | } 34 | 35 | void bwStyleCSS::polish(bwWidget& widget) 36 | { 37 | if (polish_cb) { 38 | polish_cb(widget); 39 | } 40 | } 41 | 42 | } // namespace bWidgets 43 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleCSS.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwWidget; 8 | 9 | /** 10 | * \brief Style-class for CSS driven Styles. 11 | * 12 | * How CSS is applied to styles may have to be reworked a bit. For now it just 13 | * mattered to get something working (that is, making CSS control a style). 14 | * Maybe every style should have the ability to be manipulated via CSS? We 15 | * could for example store a CSS-Tree structure in each style that has priority 16 | * over hardcoded style. 17 | * It's also important to keep custom styles in mind. In the end, users should 18 | * be able to 'install' a new style via a CSS file. 19 | */ 20 | class bwStyleCSS : public bwStyle { 21 | public: 22 | bwStyleCSS(); 23 | 24 | void setWidgetStyle(bwWidget& widget); 25 | void polish(bwWidget& widget); 26 | 27 | static void (*polish_cb)(bwWidget& widget); 28 | }; 29 | 30 | } // namespace bWidgets 31 | -------------------------------------------------------------------------------- /bwidgets/styling/bwStyleManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "bwStyle.h" 7 | 8 | namespace bWidgets { 9 | 10 | /** 11 | * \brief Singleton class for managing styles through type ID's. 12 | */ 13 | class bwStyleManager { 14 | public: 15 | using StyleTypeArray = std::array; 16 | 17 | static auto getStyleManager() -> bwStyleManager&; 18 | static auto createStyleFromTypeID(bwStyle::TypeID type_id) -> std::unique_ptr; 19 | 20 | void registerDefaultStyleTypes(); 21 | 22 | auto getBuiltinStyleTypes() const -> const StyleTypeArray&; 23 | 24 | private: 25 | bwStyleManager() = default; 26 | bwStyleManager(bwStyleManager const&) = delete; 27 | 28 | void operator=(bwStyleManager const&) = delete; 29 | 30 | StyleTypeArray builtin_style_types; 31 | // std::vector custom_types; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /bwidgets/styling/bwWidgetBaseStyle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwColor.h" 4 | 5 | namespace bWidgets { 6 | 7 | enum class TextAlignment; 8 | class bwStyleProperties; 9 | 10 | /** 11 | * \class bwWidgetBaseStyle 12 | * \brief Properties for typical widgets with roundbox corners. 13 | */ 14 | class bwWidgetBaseStyle { 15 | public: 16 | bwWidgetBaseStyle(); 17 | 18 | void registerProperties(bwStyleProperties& style_properties); 19 | 20 | auto backgroundColor() const -> const bwColor&; 21 | auto textColor() const -> const bwColor&; 22 | auto borderColor() const -> const bwColor&; 23 | auto decorationColor() const -> const bwColor&; 24 | auto shadeTop() const -> float; 25 | auto shadeBottom() const -> float; 26 | 27 | auto isBorderVisible() const -> bool; 28 | 29 | bwColor background_color; 30 | bwColor text_color; 31 | bwColor border_color; 32 | bwColor decoration_color; 33 | 34 | int shade_top{0}; 35 | int shade_bottom{ 36 | 0}; // TODO could make this a char - or support gradient for background_color even. 37 | enum TextAlignment text_alignment; // Default value set in constructor. 38 | unsigned int roundbox_corners; // Default value set in constructor. 39 | float corner_radius{ 40 | 0.0f}; // TODO Utility function for calculating final radius (roundbox_radius * dpi_fac). 41 | }; 42 | 43 | } // namespace bWidgets 44 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleClassic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleClassic : public bwStyle { 8 | public: 9 | bwStyleClassic(); 10 | 11 | void setWidgetStyle(class bwWidget& widget) override; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatDark.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyleFlatDark.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwStyleFlatDark::bwStyleFlatDark() 6 | { 7 | type_id = TypeID::FLAT_DARK; 8 | } 9 | 10 | } // namespace bWidgets 11 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatDark.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyleCSS.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlatDark : public bwStyleCSS { 8 | public: 9 | bwStyleFlatDark(); 10 | }; 11 | 12 | } // namespace bWidgets 13 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatGrey.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyle.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlat : public bwStyle { 8 | public: 9 | bwStyleFlat(); 10 | 11 | void setWidgetStyle(class bwWidget& widget) override; 12 | }; 13 | 14 | } // namespace bWidgets 15 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatLight.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyleFlatLight.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwStyleFlatLight::bwStyleFlatLight() 6 | { 7 | type_id = TypeID::FLAT_LIGHT; 8 | } 9 | 10 | } // namespace bWidgets 11 | -------------------------------------------------------------------------------- /bwidgets/styling/styles/bwStyleFlatLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwStyleCSS.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwStyleFlatLight : public bwStyleCSS { 8 | public: 9 | bwStyleFlatLight(); 10 | }; 11 | 12 | } // namespace bWidgets 13 | -------------------------------------------------------------------------------- /bwidgets/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # No source files here, causing error on clang. 2 | if(False) 3 | set(SRC 4 | bwUtil.h 5 | ) 6 | 7 | add_library(bw_utils ${SRC}) 8 | set_target_properties(bw_utils PROPERTIES LINKER_LANGUAGE CXX) 9 | endif() 10 | -------------------------------------------------------------------------------- /bwidgets/utils/bwUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * Portable version of __PRETTY_FUNCTION__. 5 | */ 6 | #ifdef _MSC_VER 7 | # define PRETTY_FUNCTION __FUNCSIG__ 8 | #else 9 | # define PRETTY_FUNCTION __PRETTY_FUNCTION__ 10 | #endif 11 | -------------------------------------------------------------------------------- /bwidgets/widgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(INC 2 | ) 3 | 4 | set(SRC 5 | bwAbstractButton.cc 6 | bwCheckbox.cc 7 | bwContainerWidget.cc 8 | bwLabel.cc 9 | bwNumberSlider.cc 10 | bwPanel.cc 11 | bwPushButton.cc 12 | bwRadioButton.cc 13 | bwScrollBar.cc 14 | bwScrollView.cc 15 | bwTextBox.cc 16 | bwWidget.cc 17 | 18 | builtin_widgets.h 19 | bwAbstractButton.h 20 | bwCheckbox.h 21 | bwContainerWidget.h 22 | bwLabel.h 23 | bwNumberSlider.h 24 | bwPanel.h 25 | bwPushButton.h 26 | bwRadioButton.h 27 | bwScrollBar.h 28 | bwScrollView.h 29 | bwTextBox.h 30 | bwWidget.h 31 | ) 32 | 33 | set(LIB 34 | bWidgets 35 | ) 36 | 37 | add_library(bw_widgets) 38 | target_sources(bw_widgets PRIVATE ${SRC}) 39 | include_directories(${INC}) 40 | target_link_libraries(bw_widgets ${LIB}) 41 | -------------------------------------------------------------------------------- /bwidgets/widgets/builtin_widgets.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * Utility header to include all built-in widgets. 5 | */ 6 | 7 | #include "bwCheckbox.h" 8 | #include "bwLabel.h" 9 | #include "bwNumberSlider.h" 10 | #include "bwPanel.h" 11 | #include "bwPushButton.h" 12 | #include "bwRadioButton.h" 13 | #include "bwScrollBar.h" 14 | #include "bwScrollView.h" 15 | #include "bwTextBox.h" -------------------------------------------------------------------------------- /bwidgets/widgets/bwCheckbox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwAbstractButton.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwCheckbox : public bwAbstractButton { 8 | public: 9 | bwCheckbox(const std::string& text = "", 10 | std::optional width_hint = std::nullopt, 11 | std::optional height_hint = std::nullopt); 12 | 13 | auto getTypeIdentifier() const -> std::string_view override; 14 | 15 | void draw(class bwStyle& style) override; 16 | 17 | auto createHandler() -> std::unique_ptr override; 18 | 19 | auto isChecked() const -> bool; 20 | 21 | private: 22 | auto isInsideCheckbox(const bwPoint& point) const -> bool; 23 | 24 | auto getCheckboxRectangle() const -> bwRectanglePixel; 25 | auto getTextRectangle(const bwRectanglePixel& checkbox_rectangle) const -> bwRectanglePixel; 26 | }; 27 | 28 | } // namespace bWidgets 29 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwContainerWidget.cc: -------------------------------------------------------------------------------- 1 | #include "bwContainerWidget.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwContainerWidget::bwContainerWidget(const bwScreenGraph::ContainerNode& node, 6 | std::optional width_hint, 7 | std::optional height_hint) 8 | : bwWidget(width_hint, height_hint), node(node) 9 | { 10 | initialize(); 11 | } 12 | 13 | auto bwContainerWidget::getMaskRectangle() -> bwRectanglePixel 14 | { 15 | bwRectanglePixel maskrect = rectangle; 16 | 17 | if (base_style.isBorderVisible()) { 18 | /* With a visible border, we have to exclude the border size from the mask, so that content 19 | * appears clipped by the border. */ 20 | maskrect.resize(-1); 21 | } 22 | 23 | return maskrect; 24 | } 25 | 26 | auto bwContainerWidget::childrenVisible() const -> bool 27 | { 28 | /* By default, all children are visible, can be overriden if the container widget supports hiding 29 | * children. */ 30 | return true; 31 | } 32 | 33 | void bwContainerWidget::registerProperties() 34 | { 35 | base_style.registerProperties(style_properties); 36 | } 37 | 38 | } // namespace bWidgets 39 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwContainerWidget.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwWidget.h" 4 | #include "bwWidgetBaseStyle.h" 5 | 6 | namespace bWidgets { 7 | 8 | namespace bwScreenGraph { 9 | class ContainerNode; 10 | } 11 | 12 | class bwContainerWidget : public bwWidget { 13 | public: 14 | virtual auto getMaskRectangle() -> bwRectanglePixel; 15 | virtual auto childrenVisible() const -> bool; 16 | 17 | void registerProperties() override; 18 | 19 | protected: 20 | bwContainerWidget(const bwScreenGraph::ContainerNode& node, 21 | std::optional width_hint = std::nullopt, 22 | std::optional height_hint = std::nullopt); 23 | 24 | /** Reference to node owning this widget, for additional info queries. */ 25 | const bwScreenGraph::ContainerNode& node; 26 | 27 | public: 28 | bwWidgetBaseStyle 29 | base_style; // XXX public for setWidgetStyle. Should only be temporarily needed. 30 | }; 31 | 32 | } // namespace bWidgets 33 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwLabel.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "bwPainter.h" 4 | #include "bwStyle.h" 5 | 6 | #include "bwLabel.h" 7 | 8 | namespace bWidgets { 9 | 10 | bwLabel::bwLabel(std::string text, 11 | std::optional width_hint, 12 | std::optional height_hint) 13 | : bwWidget(width_hint, height_hint), text(std::move(text)) 14 | { 15 | initialize(); 16 | } 17 | 18 | auto bwLabel::getTypeIdentifier() const -> std::string_view 19 | { 20 | return "bwLabel"; 21 | } 22 | 23 | void bwLabel::draw(bwStyle& style) 24 | { 25 | bwPainter painter; 26 | 27 | painter.setContentMask(rectangle); 28 | painter.setActiveColor(text_color); 29 | painter.drawTextAndIcon(text, icon, rectangle, TextAlignment::LEFT, style.dpi_fac); 30 | } 31 | 32 | void bwLabel::registerProperties() 33 | { 34 | style_properties.addColor("color", text_color); 35 | } 36 | 37 | auto bwLabel::getLabel() const -> const std::string* 38 | { 39 | return &text; 40 | } 41 | 42 | auto bwLabel::setLabel(const std::string& label) -> bwLabel& 43 | { 44 | text = label; 45 | return *this; 46 | } 47 | 48 | auto bwLabel::createHandler() -> std::unique_ptr 49 | { 50 | return nullptr; 51 | } 52 | 53 | auto bwLabel::setIcon(const bwIconInterface& icon_interface) -> bwLabel& 54 | { 55 | icon = &icon_interface; 56 | return *this; 57 | } 58 | 59 | } // namespace bWidgets 60 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwLabel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwColor.h" 6 | #include "bwWidget.h" 7 | 8 | namespace bWidgets { 9 | 10 | class bwIconInterface; 11 | 12 | class bwLabel : public bwWidget { 13 | public: 14 | bwLabel(std::string text = "", 15 | std::optional width_hint = std::nullopt, 16 | std::optional height_hint = std::nullopt); 17 | 18 | auto getTypeIdentifier() const -> std::string_view override; 19 | 20 | void draw(bwStyle& style) override; 21 | void registerProperties() override; 22 | auto createHandler() -> std::unique_ptr override; 23 | 24 | auto getLabel() const -> const std::string* override; 25 | auto setLabel(const std::string&) -> bwLabel&; 26 | auto setIcon(const bwIconInterface& icon_interface) -> bwLabel&; 27 | 28 | private: 29 | std::string text; 30 | const class bwIconInterface* icon{nullptr}; 31 | 32 | bwColor text_color; 33 | }; 34 | 35 | } // namespace bWidgets 36 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwNumberSlider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwTextBox.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwPainter; 8 | class bwStyle; 9 | 10 | class bwNumberSlider : public bwTextBox { 11 | public: 12 | friend class bwNumberSliderHandler; 13 | 14 | bwNumberSlider(std::optional width_hint = std::nullopt, 15 | std::optional height_hint = std::nullopt); 16 | 17 | auto getTypeIdentifier() const -> std::string_view override; 18 | 19 | void draw(bwStyle& style) override; 20 | 21 | auto createHandler() -> std::unique_ptr override; 22 | 23 | auto setValue(float value) -> bwNumberSlider&; 24 | auto getValue() const -> float; 25 | auto setMinMax(float min, float max) -> bwNumberSlider&; 26 | 27 | std::unique_ptr apply_functor{nullptr}; 28 | 29 | private: 30 | auto valueToString(unsigned int precision) const -> std::string; 31 | void drawValueIndicator(bwPainter& painter, bwStyle& style) const; 32 | auto calcValueIndicatorWidth(class bwStyle& style) const -> float; 33 | 34 | /** 35 | * Support multiple numeric types. bwNumberSlider could be made 36 | * a template class for this, but using union is just fine. 37 | */ 38 | union { 39 | // float 40 | struct { 41 | float value; 42 | float min, max; 43 | unsigned int precision; 44 | }; 45 | // struct { int value; ...} 46 | // struct { char value; ...} 47 | // ... 48 | }; 49 | }; 50 | 51 | } // namespace bWidgets 52 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPanel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwContainerWidget.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwPanel : public bwContainerWidget { 8 | friend class bwPanelHandler; 9 | 10 | public: 11 | enum class State { 12 | OPEN, 13 | CLOSED, 14 | }; 15 | 16 | bwPanel(const bwScreenGraph::ContainerNode& node, 17 | std::string label, 18 | std::optional header_height_hint = std::nullopt); 19 | 20 | auto getTypeIdentifier() const -> std::string_view override; 21 | 22 | void draw(class bwStyle& style) override; 23 | 24 | void registerProperties() override; 25 | 26 | auto getLabel() const -> const std::string* override; 27 | auto childrenVisible() const -> bool override; 28 | 29 | auto createHandler() -> std::unique_ptr override; 30 | 31 | unsigned int getHeaderHeightHint() const; 32 | 33 | unsigned int header_height; 34 | State panel_state{State::OPEN}; 35 | 36 | private: 37 | void drawHeader(class bwStyle& style) const; 38 | auto getHeaderRectangle() const -> bwRectanglePixel; 39 | auto isCoordinateInsideHeader(const bwPoint& point) const -> bool; 40 | 41 | std::string label; 42 | 43 | public: 44 | bool draw_separator = false; 45 | }; 46 | 47 | } // namespace bWidgets 48 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPushButton.cc: -------------------------------------------------------------------------------- 1 | #include "bwPushButton.h" 2 | 3 | namespace bWidgets { 4 | 5 | bwPushButton::bwPushButton(const std::string& text, 6 | std::optional width_hint, 7 | std::optional height_hint) 8 | : bwAbstractButton(text, width_hint, height_hint) 9 | { 10 | } 11 | 12 | auto bwPushButton::getTypeIdentifier() const -> std::string_view 13 | { 14 | return "bwPushButton"; 15 | } 16 | 17 | auto bwPushButton::getIcon() const -> const bwIconInterface* 18 | { 19 | return icon; 20 | } 21 | 22 | auto bwPushButton::setIcon(const bwIconInterface& icon_interface) -> bwPushButton& 23 | { 24 | icon = &icon_interface; 25 | return *this; 26 | } 27 | 28 | auto bwPushButton::canAlign() const -> bool 29 | { 30 | return true; 31 | } 32 | 33 | } // namespace bWidgets 34 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwPushButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwAbstractButton.h" 6 | 7 | namespace bWidgets { 8 | 9 | class bwPushButton : public bwAbstractButton { 10 | public: 11 | bwPushButton(const std::string& text, 12 | std::optional width_hint = std::nullopt, 13 | std::optional height_hint = std::nullopt); 14 | 15 | auto getTypeIdentifier() const -> std::string_view override; 16 | 17 | auto getIcon() const -> const bwIconInterface* override; 18 | auto setIcon(const class bwIconInterface&) -> bwPushButton&; 19 | 20 | auto canAlign() const -> bool override; 21 | 22 | private: 23 | const class bwIconInterface* icon{nullptr}; 24 | }; 25 | 26 | } // namespace bWidgets 27 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwRadioButton.cc: -------------------------------------------------------------------------------- 1 | #include "bwRadioButton.h" 2 | #include "bwEvent.h" 3 | 4 | namespace bWidgets { 5 | 6 | bwRadioButton::bwRadioButton(const std::string& text, 7 | std::optional width_hint, 8 | std::optional height_hint) 9 | : bwAbstractButton(text, width_hint, height_hint) 10 | { 11 | } 12 | 13 | auto bwRadioButton::getTypeIdentifier() const -> std::string_view 14 | { 15 | return "bwRadioButton"; 16 | } 17 | 18 | auto bwRadioButton::canAlign() const -> bool 19 | { 20 | return true; 21 | } 22 | 23 | // ------------------ Handling ------------------ 24 | 25 | class bwRadioButtonHandler : public bwAbstractButtonHandler { 26 | public: 27 | bwRadioButtonHandler(bwRadioButton& button); 28 | ~bwRadioButtonHandler() = default; 29 | 30 | void onMousePress(bwMouseButtonEvent&) override; 31 | void onMouseRelease(bwMouseButtonEvent&) override; 32 | }; 33 | 34 | bwRadioButtonHandler::bwRadioButtonHandler(bwRadioButton& button) : bwAbstractButtonHandler(button) 35 | { 36 | } 37 | 38 | auto bwRadioButton::createHandler() -> std::unique_ptr 39 | { 40 | return std::make_unique(*this); 41 | } 42 | 43 | void bwRadioButtonHandler::onMousePress(bwMouseButtonEvent& event) 44 | { 45 | if (event.button == bwMouseButtonEvent::Button::LEFT) { 46 | button.setState(bwWidget::State::SUNKEN); 47 | apply(); 48 | event.swallow(); 49 | } 50 | } 51 | 52 | void bwRadioButtonHandler::onMouseRelease(bwMouseButtonEvent& event) 53 | { 54 | event.swallow(); 55 | } 56 | 57 | } // namespace bWidgets 58 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwRadioButton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwAbstractButton.h" 6 | 7 | namespace bWidgets { 8 | 9 | /** 10 | * \brief A radio-button like widget retaining a pressed state once pressed. 11 | * 12 | * \note: The way this works right now is not that nice. It's however made so it can work nicely 13 | * with Blender. 14 | * 15 | * Normally, there's a group of radio buttons, once one of them is pressed, the others get 16 | * un-pressed. It's an exclusive behavior: There should only ever be one pressed radio button in 17 | * the group. bWidgets doesn't ensure this behavior at all as of now. The host application needs to 18 | * do this. In future, there should be a group-widget that ensures the exclusive behavior within 19 | * bWidgets. We need to make Blender ready for it first, though (or make it optional). 20 | */ 21 | class bwRadioButton : public bwAbstractButton { 22 | public: 23 | bwRadioButton(const std::string& text, 24 | std::optional width_hint = std::nullopt, 25 | std::optional height_hint = std::nullopt); 26 | 27 | auto getTypeIdentifier() const -> std::string_view override; 28 | 29 | auto canAlign() const -> bool override; 30 | 31 | auto createHandler() -> std::unique_ptr override; 32 | }; 33 | 34 | } // namespace bWidgets 35 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwScrollBar.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwAbstractButton.h" 4 | 5 | namespace bWidgets { 6 | 7 | class bwScrollBar : public bwAbstractButton { 8 | public: 9 | bwScrollBar(unsigned int width_hint = 0, unsigned int height_hint = 0); 10 | 11 | auto getTypeIdentifier() const -> std::string_view override; 12 | 13 | void draw(bwStyle& style) override; 14 | 15 | auto createHandler() -> std::unique_ptr override; 16 | 17 | float ratio = 0.0f; // Ration between content and area height (max 1.0f). 18 | int scroll_offset = 0; 19 | 20 | private: 21 | void setScrollOffset(int value); 22 | }; 23 | 24 | } // namespace bWidgets 25 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwScrollView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "bwContainerWidget.h" 6 | 7 | namespace bWidgets { 8 | 9 | namespace bwScreenGraph { 10 | class WidgetNode; 11 | } 12 | class bwScrollBar; 13 | 14 | class bwScrollView : public bwContainerWidget { 15 | friend class bwScrollViewHandler; 16 | 17 | public: 18 | bwScrollView(bwScreenGraph::ContainerNode& node, 19 | unsigned int width = 0, 20 | unsigned int height = 0); 21 | 22 | auto getTypeIdentifier() const -> std::string_view override; 23 | 24 | void draw(bwStyle& style) override; 25 | 26 | auto createHandler() -> std::unique_ptr override; 27 | 28 | auto getScrollOffsetY() const -> int; 29 | auto getContentBounds(float interface_scale) const -> bwRectanglePixel; 30 | 31 | private: 32 | auto getVerticalScrollBar() const -> bwScrollBar&; 33 | auto getVerticalScrollbarRect(const bwStyle& style) const -> bwRectanglePixel; 34 | void drawScrollBars(bwStyle& style); 35 | auto isScrollable() const -> bool; 36 | void validizeScrollValues(); 37 | 38 | static auto getScrollbarWidth(float interface_scale) -> int; 39 | 40 | constexpr static int SCROLL_BAR_SIZE = 17; 41 | 42 | std::unique_ptr scrollbar_node; 43 | 44 | int vert_scroll{0}; 45 | }; 46 | 47 | } // namespace bWidgets 48 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwTextBox.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "bwWidget.h" 4 | #include "bwWidgetBaseStyle.h" 5 | 6 | namespace bWidgets { 7 | 8 | class bwTextBox : public bwWidget { 9 | friend class bwTextBoxHandler; 10 | 11 | public: 12 | bwTextBox(std::optional width_hint = std::nullopt, 13 | std::optional height_hint = std::nullopt); 14 | 15 | auto getTypeIdentifier() const -> std::string_view override; 16 | 17 | void draw(class bwStyle& style) override; 18 | void registerProperties() override; 19 | 20 | auto setText(const std::string& value) -> bwTextBox&; 21 | auto getLabel() const -> const std::string* override; 22 | 23 | bool canAlign() const override; 24 | 25 | auto createHandler() -> std::unique_ptr override; 26 | 27 | bwRectanglePixel selection_rectangle; 28 | 29 | protected: 30 | std::string text; 31 | bool is_text_editing = false; 32 | 33 | public: 34 | bwWidgetBaseStyle 35 | base_style; // XXX public for setWidgetStyle. Should only be temporarily needed. 36 | }; 37 | 38 | class bwTextBoxHandler : public bwScreenGraph::EventHandler { 39 | public: 40 | bwTextBoxHandler(bwTextBox& textbox); 41 | virtual ~bwTextBoxHandler() = default; 42 | 43 | void onMouseEnter(bwEvent&) override; 44 | void onMouseLeave(bwEvent&) override; 45 | void onMousePress(bwMouseButtonEvent&) override; 46 | 47 | protected: 48 | void startTextEditing(); 49 | void endTextEditing(); 50 | 51 | bwTextBox& textbox; 52 | bool is_dragging = false; 53 | }; 54 | 55 | } // namespace bWidgets 56 | -------------------------------------------------------------------------------- /bwidgets/widgets/bwWidget.cc: -------------------------------------------------------------------------------- 1 | #include "bwStyle.h" 2 | 3 | #include "bwWidget.h" 4 | 5 | namespace bWidgets { 6 | 7 | bwWidget::bwWidget(std::optional width_hint, std::optional height_hint) 8 | : state(State::NORMAL), 9 | rectangle(0, 0, 0, 0), 10 | width_hint(width_hint.value_or(bwStyle::s_default_widget_size_hint)), 11 | height_hint(height_hint.value_or(bwStyle::s_default_widget_size_hint)) 12 | { 13 | } 14 | 15 | auto bwWidget::getState() const -> State 16 | { 17 | return state; 18 | } 19 | 20 | auto bwWidget::setState(State value) -> bwWidget& 21 | { 22 | state = value; 23 | return *this; 24 | } 25 | 26 | auto bwWidget::hide(bool _hidden) -> bwWidget& 27 | { 28 | hidden = _hidden; 29 | return *this; 30 | } 31 | 32 | auto bwWidget::isHidden() -> bool 33 | { 34 | return hidden; 35 | } 36 | 37 | auto bwWidget::getLabel() const -> const std::string* 38 | { 39 | return nullptr; 40 | } 41 | 42 | auto bwWidget::canAlign() const -> bool 43 | { 44 | return false; 45 | } 46 | 47 | /** 48 | * \brief Additional initialization that can't be done in #bwWidget constructor. 49 | */ 50 | void bwWidget::initialize() 51 | { 52 | /* Has to be done in init, can't be called from bwWidget constructor (wouldn't call overwritten 53 | * function). */ 54 | registerProperties(); 55 | } 56 | 57 | void bwWidget::registerProperties() 58 | { 59 | } 60 | 61 | } // namespace bWidgets 62 | -------------------------------------------------------------------------------- /demo/Application.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #include 23 | 24 | #include "WindowManager.h" 25 | 26 | #include "Application.h" 27 | 28 | namespace bWidgetsDemo { 29 | 30 | Application& Application::ensureApplication() 31 | { 32 | static Application app; 33 | return app; 34 | } 35 | 36 | void Application::setup() 37 | { 38 | WindowManager& wm = WindowManager::getWindowManager(); 39 | wm.addWindow("bWidgets Demo"); 40 | } 41 | 42 | void Application::mainLoop() 43 | { 44 | WindowManager& wm = WindowManager::getWindowManager(); 45 | wm.mainLoop(); 46 | } 47 | 48 | void Application::exit() 49 | { 50 | } 51 | 52 | } // namespace bWidgetsDemo 53 | -------------------------------------------------------------------------------- /demo/Application.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace bWidgetsDemo { 25 | 26 | /** 27 | * Singleton class for general data of the bWidget Demo Application. 28 | */ 29 | class Application { 30 | public: 31 | static Application& ensureApplication(); 32 | 33 | void setup(); 34 | void mainLoop(); 35 | void exit(); 36 | 37 | static float interfaceScale(); 38 | 39 | private: 40 | Application() 41 | { 42 | } 43 | // Ensure uniqueness 44 | Application(Application const&) = delete; 45 | void operator=(Application const&) = delete; 46 | }; 47 | 48 | } // namespace bWidgetsDemo 49 | -------------------------------------------------------------------------------- /demo/File.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace bWidgetsDemo { 29 | 30 | class File { 31 | public: 32 | explicit File(const std::string& path, std::ios::openmode mode = std::ios::in); 33 | ~File() = default; 34 | 35 | std::string readIntoString(); 36 | bool readBytes(char*, const unsigned int, bool reset_cursor); 37 | 38 | friend std::ostream& operator<<(std::ostream&, const File&); 39 | 40 | private: 41 | const std::string _path; 42 | std::ifstream _file_stream; 43 | }; 44 | 45 | } // namespace bWidgetsDemo 46 | -------------------------------------------------------------------------------- /demo/Pixmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace bWidgetsDemo { 27 | 28 | class Pixmap { 29 | public: 30 | Pixmap(const int width, 31 | const int height, 32 | const unsigned int num_channels, 33 | const unsigned int bits_per_channel = 8, 34 | const unsigned int row_padding = 0); 35 | 36 | void fill(const unsigned char* bytes); 37 | 38 | std::vector& getBytes(); 39 | const std::vector& getBytes() const; 40 | int width() const; 41 | int height() const; 42 | unsigned int getBitDepth() const; 43 | unsigned int getNumChannels() const; 44 | 45 | private: 46 | std::vector _bytes; 47 | int _width, _height; 48 | unsigned int _num_channels; 49 | unsigned int _bits_per_channel; 50 | unsigned int _row_padding; 51 | }; 52 | 53 | } // namespace bWidgetsDemo 54 | -------------------------------------------------------------------------------- /demo/bwidgets_demo.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, see . 16 | * 17 | * Original work Copyright (c) 2018 Julian Eisel 18 | * 19 | * ***** END GPL LICENSE BLOCK ***** 20 | */ 21 | 22 | #include "Application.h" 23 | 24 | using namespace bWidgetsDemo; 25 | 26 | int main(int /*argc*/, char** /*argv*/) 27 | { 28 | Application& app = Application::ensureApplication(); 29 | 30 | app.setup(); 31 | app.mainLoop(); 32 | app.exit(); 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /demo/extern/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: false -------------------------------------------------------------------------------- /demo/extern/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) 21 | set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) 22 | set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) 23 | set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) 24 | 25 | set(GLM_STATIC_LIBRARY_ENABLE ON CACHE BOOL "" FORCE) 26 | 27 | # Disable all warnings for 3rd party libs. 28 | if (MSVC) 29 | add_compile_options(/W0) 30 | else() 31 | add_compile_options(-w) 32 | endif() 33 | 34 | add_subdirectory(gawain) 35 | add_subdirectory(glew) 36 | add_subdirectory(glfw) 37 | add_subdirectory(glm) 38 | add_subdirectory(katana-parser) 39 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_attr_binding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_attr_binding.h 27 | * \ingroup gpu 28 | * 29 | * Gawain vertex attribute binding 30 | */ 31 | 32 | #ifndef __GWN_ATTR_BINDING_H__ 33 | #define __GWN_ATTR_BINDING_H__ 34 | 35 | #include "gwn_common.h" 36 | 37 | typedef struct Gwn_AttrBinding { 38 | uint64_t loc_bits; /* store 4 bits for each of the 16 attribs */ 39 | uint16_t enabled_bits; /* 1 bit for each attrib */ 40 | } Gwn_AttrBinding; 41 | 42 | #endif /* __GWN_ATTR_BINDING_H__ */ 43 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_attr_binding_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_attr_binding_private.h 27 | * \ingroup gpu 28 | * 29 | * Gawain vertex attribute binding 30 | */ 31 | 32 | #ifndef __GWN_ATTR_BINDING_PRIVATE_H__ 33 | #define __GWN_ATTR_BINDING_PRIVATE_H__ 34 | 35 | #include "gwn_vertex_format.h" 36 | #include "gwn_shader_interface.h" 37 | 38 | void AttribBinding_clear(Gwn_AttrBinding*); 39 | 40 | void get_attrib_locations(const Gwn_VertFormat*, Gwn_AttrBinding*, const Gwn_ShaderInterface*); 41 | unsigned read_attrib_location(const Gwn_AttrBinding*, unsigned a_idx); 42 | 43 | #endif /* __GWN_ATTR_BINDING_PRIVATE_H__ */ 44 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_buffer_id.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_buffer_id.h 27 | * \ingroup gpu 28 | * 29 | * Gawain buffer IDs 30 | */ 31 | 32 | #ifndef __GWN_BUFFER_ID_H__ 33 | #define __GWN_BUFFER_ID_H__ 34 | 35 | /* Manage GL buffer IDs in a thread-safe way 36 | * Use these instead of glGenBuffers & its friends 37 | * - alloc must be called from main thread 38 | * - free can be called from any thread */ 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #include "gwn_common.h" 45 | 46 | GLuint GWN_buf_id_alloc(void); 47 | void GWN_buf_id_free(GLuint buffer_id); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __GWN_BUFFER_ID_H__ */ 54 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_context.h 27 | * \ingroup gpu 28 | * 29 | * This interface allow Gawain to manage VAOs for mutiple context and threads. 30 | */ 31 | 32 | #ifndef __GWN_CONTEXT_H__ 33 | #define __GWN_CONTEXT_H__ 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | #include "gwn_common.h" 40 | #include "gwn_batch.h" 41 | #include "gwn_shader_interface.h" 42 | 43 | typedef struct Gwn_Context Gwn_Context; 44 | 45 | Gwn_Context* GWN_context_create(void); 46 | void GWN_context_discard(Gwn_Context*); 47 | 48 | void GWN_context_active_set(Gwn_Context*); 49 | Gwn_Context* GWN_context_active_get(void); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* __GWN_CONTEXT_H__ */ 56 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_primitive_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_primitive_private.h 27 | * \ingroup gpu 28 | * 29 | * Gawain geometric primitives 30 | */ 31 | 32 | #ifndef __GWN_PRIMITIVE_PRIVATE_H__ 33 | #define __GWN_PRIMITIVE_PRIVATE_H__ 34 | 35 | GLenum convert_prim_type_to_gl(Gwn_PrimType); 36 | 37 | #endif /* __GWN_PRIMITIVE_PRIVATE_H__ */ 38 | -------------------------------------------------------------------------------- /demo/extern/gawain/gawain/gwn_vertex_format_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ***** BEGIN GPL LICENSE BLOCK ***** 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU General Public License 6 | * as published by the Free Software Foundation; either version 2 7 | * of the License, or (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | * 18 | * The Original Code is Copyright (C) 2016 by Mike Erwin. 19 | * All rights reserved. 20 | * 21 | * Contributor(s): Blender Foundation 22 | * 23 | * ***** END GPL LICENSE BLOCK ***** 24 | */ 25 | 26 | /** \file blender/gpu/gwn_vertex_format_private.h 27 | * \ingroup gpu 28 | * 29 | * Gawain vertex format 30 | */ 31 | 32 | #ifndef __GWN_VERTEX_FORMAT_PRIVATE_H__ 33 | #define __GWN_VERTEX_FORMAT_PRIVATE_H__ 34 | 35 | void VertexFormat_pack(Gwn_VertFormat*); 36 | uint padding(uint offset, uint alignment); 37 | uint vertex_buffer_size(const Gwn_VertFormat*, uint vertex_len); 38 | 39 | #endif /* __GWN_VERTEX_FORMAT_PRIVATE_H__ */ 40 | -------------------------------------------------------------------------------- /demo/extern/glew/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along 14 | # with this program; if not, see . 15 | # 16 | # Original work Copyright (c) 2018 Julian Eisel 17 | # 18 | # ***** END GPL LICENSE BLOCK ***** 19 | 20 | set(INC 21 | include 22 | ) 23 | 24 | set(SRC 25 | src/glew.c 26 | # src/glewinfo.c 27 | # src/visualinfo.c 28 | 29 | include/GL/eglew.h 30 | include/GL/glew.h 31 | include/GL/glxew.h 32 | include/GL/wglew.h 33 | ) 34 | 35 | set(LIB 36 | ${OPENGL_LIBRARIES} 37 | ) 38 | 39 | add_library(bwd_extern_glew) 40 | target_sources(bwd_extern_glew PRIVATE ${SRC}) 41 | include_directories(bwd_extern_glew ${INC}) 42 | target_link_libraries(bwd_extern_glew ${LIB}) 43 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/GenerateMappings.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # cmake -P GenerateMappings.cmake 3 | 4 | set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") 5 | set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") 6 | set(template_path "${CMAKE_ARGV3}") 7 | set(target_path "${CMAKE_ARGV4}") 8 | 9 | if (NOT EXISTS "${template_path}") 10 | message(FATAL_ERROR "Failed to find template file ${template_path}") 11 | endif() 12 | 13 | file(DOWNLOAD "${source_url}" "${source_path}" 14 | STATUS download_status 15 | TLS_VERIFY on) 16 | 17 | list(GET download_status 0 status_code) 18 | list(GET download_status 1 status_message) 19 | 20 | if (status_code) 21 | message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}") 22 | endif() 23 | 24 | file(STRINGS "${source_path}" lines) 25 | foreach(line ${lines}) 26 | if ("${line}" MATCHES "^[0-9a-fA-F].*$") 27 | set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") 28 | endif() 29 | endforeach() 30 | 31 | configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX) 32 | file(REMOVE "${source_path}") 33 | 34 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/MacOSXBundleInfo.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/i686-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/i686-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindEpollShim.cmake: -------------------------------------------------------------------------------- 1 | # Find EpollShim 2 | # Once done, this will define 3 | # 4 | # EPOLLSHIM_FOUND - System has EpollShim 5 | # EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories 6 | # EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim 7 | 8 | find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) 9 | find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) 10 | 11 | if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 12 | set(EPOLLSHIM_FOUND TRUE) 13 | endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 14 | 15 | include(FindPackageHandleStandardArgs) 16 | find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) 17 | mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) 18 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindOSMesa.cmake: -------------------------------------------------------------------------------- 1 | # Try to find OSMesa on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # OSMESA_LIBRARIES - Link these to use OSMesa 6 | # OSMESA_INCLUDE_DIR - Include directory for OSMesa 7 | # 8 | # Copyright (c) 2014 Brandon Schaefer 9 | 10 | if (NOT WIN32) 11 | 12 | find_package (PkgConfig) 13 | pkg_check_modules (PKG_OSMESA QUIET osmesa) 14 | 15 | set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS}) 16 | set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES}) 17 | 18 | endif () 19 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindWaylandProtocols.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | 3 | pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) 4 | 5 | execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols 6 | OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR 7 | RESULT_VARIABLE _pkgconfig_failed) 8 | if (_pkgconfig_failed) 9 | message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") 10 | endif() 11 | 12 | string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") 13 | 14 | find_package_handle_standard_args(WaylandProtocols 15 | FOUND_VAR 16 | WaylandProtocols_FOUND 17 | REQUIRED_VARS 18 | WaylandProtocols_PKGDATADIR 19 | VERSION_VAR 20 | WaylandProtocols_VERSION 21 | HANDLE_COMPONENTS 22 | ) 23 | 24 | set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) 25 | set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) 26 | set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) 27 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/modules/FindXKBCommon.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find XKBCommon 2 | # Once done, this will define 3 | # 4 | # XKBCOMMON_FOUND - System has XKBCommon 5 | # XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories 6 | # XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon 7 | # XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon 8 | 9 | find_package(PkgConfig) 10 | pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) 11 | set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) 12 | 13 | find_path(XKBCOMMON_INCLUDE_DIR 14 | NAMES xkbcommon/xkbcommon.h 15 | HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} 16 | ) 17 | 18 | find_library(XKBCOMMON_LIBRARY 19 | NAMES xkbcommon 20 | HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} 21 | ) 22 | 23 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) 24 | set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) 25 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args(XKBCommon DEFAULT_MSG 29 | XKBCOMMON_LIBRARY 30 | XKBCOMMON_INCLUDE_DIR 31 | ) 32 | 33 | mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) 34 | 35 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/x86_64-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/CMake/x86_64-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2016 Camilla Löwy 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /demo/extern/glfw/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 4 | endif() 5 | 6 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval) 15 | if (NOT "${rm_retval}" STREQUAL 0) 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif() 18 | elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 20 | OUTPUT_VARIABLE rm_out 21 | RETURN_VALUE rm_retval) 22 | if (NOT "${rm_retval}" STREQUAL 0) 23 | message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") 24 | endif() 25 | else() 26 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 27 | endif() 28 | endforeach() 29 | 30 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/glfw3.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: GLFW 7 | Description: A multi-platform library for OpenGL, window and input 8 | Version: @GLFW_VERSION_FULL@ 9 | URL: https://www.glfw.org/ 10 | Requires.private: @GLFW_PKG_DEPS@ 11 | Libs: -L${libdir} -l@GLFW_LIB_NAME@ 12 | Libs.private: @GLFW_PKG_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/glfw3Config.cmake.in: -------------------------------------------------------------------------------- 1 | include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") 2 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/null_joystick.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | 30 | ////////////////////////////////////////////////////////////////////////// 31 | ////// GLFW platform API ////// 32 | ////////////////////////////////////////////////////////////////////////// 33 | 34 | int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) 35 | { 36 | return GLFW_FALSE; 37 | } 38 | 39 | void _glfwPlatformUpdateGamepadGUID(char* guid) 40 | { 41 | } 42 | 43 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/null_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define _GLFW_PLATFORM_JOYSTICK_STATE int nulljs 28 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE int nulljs 29 | 30 | #define _GLFW_PLATFORM_MAPPING_NAME "" 31 | 32 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix 29 | 30 | #include 31 | 32 | 33 | // POSIX-specific global timer data 34 | // 35 | typedef struct _GLFWtimerPOSIX 36 | { 37 | GLFWbool monotonic; 38 | uint64_t frequency; 39 | 40 | } _GLFWtimerPOSIX; 41 | 42 | 43 | void _glfwInitTimerPOSIX(void); 44 | 45 | -------------------------------------------------------------------------------- /demo/extern/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | long _glfwKeySym2Unicode(unsigned int keysym); 28 | 29 | -------------------------------------------------------------------------------- /demo/extern/glm/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | -------------------------------------------------------------------------------- 3 | Copyright (c) 2005 - 2016 G-Truc Creation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/extern/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/common.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_common.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/_fixes.hpp 3 | 4 | #include 5 | 6 | //! Workaround for compatibility with other libraries 7 | #ifdef max 8 | #undef max 9 | #endif 10 | 11 | //! Workaround for compatibility with other libraries 12 | #ifdef min 13 | #undef min 14 | #endif 15 | 16 | //! Workaround for Android 17 | #ifdef isnan 18 | #undef isnan 19 | #endif 20 | 21 | //! Workaround for Android 22 | #ifdef isinf 23 | #undef isinf 24 | #endif 25 | 26 | //! Workaround for Chrone Native Client 27 | #ifdef log2 28 | #undef log2 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_exponential_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_exponential_simd.inl 3 | 4 | #include "../simd/exponential.h" 5 | 6 | #if GLM_ARCH & GLM_ARCH_SSE2_BIT 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | template 12 | struct compute_sqrt 13 | { 14 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 15 | { 16 | tvec4 result(uninitialize); 17 | result.data = _mm_sqrt_ps(v.data); 18 | return result; 19 | } 20 | }; 21 | 22 | template <> 23 | struct compute_sqrt 24 | { 25 | GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) 26 | { 27 | tvec4 result(uninitialize); 28 | result.data = glm_vec4_sqrt_lowp(v.data); 29 | return result; 30 | } 31 | }; 32 | }//namespace detail 33 | }//namespace glm 34 | 35 | #endif//GLM_ARCH & GLM_ARCH_SSE2_BIT 36 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_packing_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_packing_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_trigonometric_simd.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/julianeisel/bWidgets/db9b80c2f863e98fafa64efd17351b0e07fe9d87/demo/extern/glm/detail/func_trigonometric_simd.inl -------------------------------------------------------------------------------- /demo/extern/glm/detail/func_vector_relational_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/func_vector_relational_simd.inl 3 | 4 | namespace glm{ 5 | namespace detail 6 | { 7 | 8 | }//namespace detail 9 | }//namespace glm 10 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/precision.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/precision.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm 9 | { 10 | enum precision 11 | { 12 | packed_highp, 13 | packed_mediump, 14 | packed_lowp, 15 | 16 | # if GLM_HAS_ALIGNED_TYPE 17 | aligned_highp, 18 | aligned_mediump, 19 | aligned_lowp, 20 | aligned = aligned_highp, 21 | # endif 22 | 23 | highp = packed_highp, 24 | mediump = packed_mediump, 25 | lowp = packed_lowp, 26 | packed = packed_highp, 27 | 28 | # if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED) 29 | defaultp = aligned_highp 30 | # else 31 | defaultp = highp 32 | # endif 33 | }; 34 | 35 | namespace detail 36 | { 37 | template 38 | struct is_aligned 39 | { 40 | static const bool value = false; 41 | }; 42 | 43 | # if GLM_HAS_ALIGNED_TYPE 44 | template<> 45 | struct is_aligned 46 | { 47 | static const bool value = true; 48 | }; 49 | 50 | template<> 51 | struct is_aligned 52 | { 53 | static const bool value = true; 54 | }; 55 | 56 | template<> 57 | struct is_aligned 58 | { 59 | static const bool value = true; 60 | }; 61 | # endif 62 | }//namespace detail 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_half.hpp 3 | 4 | #pragma once 5 | 6 | #include "setup.hpp" 7 | 8 | namespace glm{ 9 | namespace detail 10 | { 11 | typedef short hdata; 12 | 13 | GLM_FUNC_DECL float toFloat32(hdata value); 14 | GLM_FUNC_DECL hdata toFloat16(float const & value); 15 | 16 | }//namespace detail 17 | }//namespace glm 18 | 19 | #include "type_half.inl" 20 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat.inl 3 | 4 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_mat4x4_simd.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_mat4x4_sse2.inl 3 | 4 | namespace glm 5 | { 6 | 7 | }//namespace glm 8 | -------------------------------------------------------------------------------- /demo/extern/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/detail/type_vec.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/exponential.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_exponential.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /// @ref core 2 | /// @file glm/geometric.hpp 3 | 4 | #pragma once 5 | 6 | #include "detail/func_geometric.hpp" 7 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/functions.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtc_quaternion (dependence) 7 | /// 8 | /// @defgroup gtc_functions GLM_GTC_functions 9 | /// @ingroup gtc 10 | /// 11 | /// @brief List of useful common functions. 12 | /// 13 | /// need to be included to use these functionalities. 14 | 15 | #pragma once 16 | 17 | // Dependencies 18 | #include "../detail/setup.hpp" 19 | #include "../detail/precision.hpp" 20 | #include "../detail/type_vec2.hpp" 21 | 22 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 23 | # pragma message("GLM: GLM_GTC_functions extension included") 24 | #endif 25 | 26 | namespace glm 27 | { 28 | /// @addtogroup gtc_functions 29 | /// @{ 30 | 31 | /// 1D gauss function 32 | /// 33 | /// @see gtc_epsilon 34 | template 35 | GLM_FUNC_DECL T gauss( 36 | T x, 37 | T ExpectedValue, 38 | T StandardDeviation); 39 | 40 | /// 2D gauss function 41 | /// 42 | /// @see gtc_epsilon 43 | template 44 | GLM_FUNC_DECL T gauss( 45 | tvec2 const& Coord, 46 | tvec2 const& ExpectedValue, 47 | tvec2 const& StandardDeviation); 48 | 49 | /// @} 50 | }//namespace glm 51 | 52 | #include "functions.inl" 53 | 54 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/functions.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_functions 2 | /// @file glm/gtc/functions.inl 3 | 4 | #include "../detail/func_exponential.hpp" 5 | 6 | namespace glm 7 | { 8 | template 9 | GLM_FUNC_QUALIFIER T gauss 10 | ( 11 | T x, 12 | T ExpectedValue, 13 | T StandardDeviation 14 | ) 15 | { 16 | return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast(6.28318530717958647692528676655900576))); 17 | } 18 | 19 | template 20 | GLM_FUNC_QUALIFIER T gauss 21 | ( 22 | tvec2 const& Coord, 23 | tvec2 const& ExpectedValue, 24 | tvec2 const& StandardDeviation 25 | ) 26 | { 27 | tvec2 const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast(2) * StandardDeviation * StandardDeviation); 28 | return exp(-(Squared.x + Squared.y)); 29 | } 30 | }//namespace glm 31 | 32 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/matrix_access.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_access GLM_GTC_matrix_access 7 | /// @ingroup gtc 8 | /// 9 | /// Defines functions to access rows or columns of a matrix easily. 10 | /// need to be included to use these functionalities. 11 | 12 | #pragma once 13 | 14 | // Dependency: 15 | #include "../detail/setup.hpp" 16 | 17 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 18 | # pragma message("GLM: GLM_GTC_matrix_access extension included") 19 | #endif 20 | 21 | namespace glm 22 | { 23 | /// @addtogroup gtc_matrix_access 24 | /// @{ 25 | 26 | /// Get a specific row of a matrix. 27 | /// @see gtc_matrix_access 28 | template 29 | GLM_FUNC_DECL typename genType::row_type row( 30 | genType const & m, 31 | length_t index); 32 | 33 | /// Set a specific row to a matrix. 34 | /// @see gtc_matrix_access 35 | template 36 | GLM_FUNC_DECL genType row( 37 | genType const & m, 38 | length_t index, 39 | typename genType::row_type const & x); 40 | 41 | /// Get a specific column of a matrix. 42 | /// @see gtc_matrix_access 43 | template 44 | GLM_FUNC_DECL typename genType::col_type column( 45 | genType const & m, 46 | length_t index); 47 | 48 | /// Set a specific column to a matrix. 49 | /// @see gtc_matrix_access 50 | template 51 | GLM_FUNC_DECL genType column( 52 | genType const & m, 53 | length_t index, 54 | typename genType::col_type const & x); 55 | 56 | /// @} 57 | }//namespace glm 58 | 59 | #include "matrix_access.inl" 60 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/matrix_access.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_access 2 | /// @file glm/gtc/matrix_access.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType row 8 | ( 9 | genType const & m, 10 | length_t index, 11 | typename genType::row_type const & x 12 | ) 13 | { 14 | assert(index >= 0 && index < m[0].length()); 15 | 16 | genType Result = m; 17 | for(length_t i = 0; i < m.length(); ++i) 18 | Result[i][index] = x[i]; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER typename genType::row_type row 24 | ( 25 | genType const & m, 26 | length_t index 27 | ) 28 | { 29 | assert(index >= 0 && index < m[0].length()); 30 | 31 | typename genType::row_type Result; 32 | for(length_t i = 0; i < m.length(); ++i) 33 | Result[i] = m[i][index]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER genType column 39 | ( 40 | genType const & m, 41 | length_t index, 42 | typename genType::col_type const & x 43 | ) 44 | { 45 | assert(index >= 0 && index < m.length()); 46 | 47 | genType Result = m; 48 | Result[index] = x; 49 | return Result; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER typename genType::col_type column 54 | ( 55 | genType const & m, 56 | length_t index 57 | ) 58 | { 59 | assert(index >= 0 && index < m.length()); 60 | 61 | return m[index]; 62 | } 63 | }//namespace glm 64 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/matrix_inverse.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtc_matrix_inverse 2 | /// @file glm/gtc/matrix_inverse.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse 7 | /// @ingroup gtc 8 | /// 9 | /// Defines additional matrix inverting functions. 10 | /// need to be included to use these functionalities. 11 | 12 | #pragma once 13 | 14 | // Dependencies 15 | #include "../detail/setup.hpp" 16 | #include "../matrix.hpp" 17 | #include "../mat2x2.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../mat4x4.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTC_matrix_inverse extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtc_matrix_inverse 28 | /// @{ 29 | 30 | /// Fast matrix inverse for affine matrix. 31 | /// 32 | /// @param m Input matrix to invert. 33 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 34 | /// @see gtc_matrix_inverse 35 | template 36 | GLM_FUNC_DECL genType affineInverse(genType const & m); 37 | 38 | /// Compute the inverse transpose of a matrix. 39 | /// 40 | /// @param m Input matrix to invert transpose. 41 | /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. 42 | /// @see gtc_matrix_inverse 43 | template 44 | GLM_FUNC_DECL genType inverseTranspose(genType const & m); 45 | 46 | /// @} 47 | }//namespace glm 48 | 49 | #include "matrix_inverse.inl" 50 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_swizzle 2 | /// @file glm/gtc/swizzle.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/gtc/vec1.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtc_vec1 2 | /// @file glm/gtc/vec1.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/closest_point.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_closest_point GLM_GTX_closest_point 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Find the point on a straight line which is the closet of a point. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_closest_point extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_closest_point 25 | /// @{ 26 | 27 | /// Find the point on a straight line which is the closet of a point. 28 | /// @see gtx_closest_point 29 | template 30 | GLM_FUNC_DECL tvec3 closestPointOnLine( 31 | tvec3 const & point, 32 | tvec3 const & a, 33 | tvec3 const & b); 34 | 35 | /// 2d lines work as well 36 | template 37 | GLM_FUNC_DECL tvec2 closestPointOnLine( 38 | tvec2 const & point, 39 | tvec2 const & a, 40 | tvec2 const & b); 41 | 42 | /// @} 43 | }// namespace glm 44 | 45 | #include "closest_point.inl" 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_closest_point 2 | /// @file glm/gtx/closest_point.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 closestPointOnLine 8 | ( 9 | tvec3 const & point, 10 | tvec3 const & a, 11 | tvec3 const & b 12 | ) 13 | { 14 | T LineLength = distance(a, b); 15 | tvec3 Vector = point - a; 16 | tvec3 LineDirection = (b - a) / LineLength; 17 | 18 | // Project Vector to LineDirection to get the distance of point from a 19 | T Distance = dot(Vector, LineDirection); 20 | 21 | if(Distance <= T(0)) return a; 22 | if(Distance >= LineLength) return b; 23 | return a + LineDirection * Distance; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER tvec2 closestPointOnLine 28 | ( 29 | tvec2 const & point, 30 | tvec2 const & a, 31 | tvec2 const & b 32 | ) 33 | { 34 | T LineLength = distance(a, b); 35 | tvec2 Vector = point - a; 36 | tvec2 LineDirection = (b - a) / LineLength; 37 | 38 | // Project Vector to LineDirection to get the distance of point from a 39 | T Distance = dot(Vector, LineDirection); 40 | 41 | if(Distance <= T(0)) return a; 42 | if(Distance >= LineLength) return b; 43 | return a + LineDirection * Distance; 44 | } 45 | 46 | }//namespace glm 47 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_compatibility 2 | /// @file glm/gtx/compatibility.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | // isfinite 9 | template 10 | GLM_FUNC_QUALIFIER bool isfinite( 11 | genType const & x) 12 | { 13 | # if GLM_HAS_CXX11_STL 14 | return std::isfinite(x) != 0; 15 | # elif GLM_COMPILER & GLM_COMPILER_VC 16 | return _finite(x); 17 | # elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID 18 | return _isfinite(x) != 0; 19 | # else 20 | if (std::numeric_limits::is_integer || std::denorm_absent == std::numeric_limits::has_denorm) 21 | return std::numeric_limits::min() <= x && std::numeric_limits::max() >= x; 22 | else 23 | return -std::numeric_limits::max() <= x && std::numeric_limits::max() >= x; 24 | # endif 25 | } 26 | 27 | template 28 | GLM_FUNC_QUALIFIER tvec1 isfinite( 29 | tvec1 const & x) 30 | { 31 | return tvec1( 32 | isfinite(x.x)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER tvec2 isfinite( 37 | tvec2 const & x) 38 | { 39 | return tvec2( 40 | isfinite(x.x), 41 | isfinite(x.y)); 42 | } 43 | 44 | template 45 | GLM_FUNC_QUALIFIER tvec3 isfinite( 46 | tvec3 const & x) 47 | { 48 | return tvec3( 49 | isfinite(x.x), 50 | isfinite(x.y), 51 | isfinite(x.z)); 52 | } 53 | 54 | template 55 | GLM_FUNC_QUALIFIER tvec4 isfinite( 56 | tvec4 const & x) 57 | { 58 | return tvec4( 59 | isfinite(x.x), 60 | isfinite(x.y), 61 | isfinite(x.z), 62 | isfinite(x.w)); 63 | } 64 | 65 | }//namespace glm 66 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/extend.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_extend GLM_GTX_extend 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Extend a position from a source to a position at a defined length. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_extend extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_extend 25 | /// @{ 26 | 27 | /// Extends of Length the Origin position using the (Source - Origin) direction. 28 | /// @see gtx_extend 29 | template 30 | GLM_FUNC_DECL genType extend( 31 | genType const & Origin, 32 | genType const & Source, 33 | typename genType::value_type const Length); 34 | 35 | /// @} 36 | }//namespace glm 37 | 38 | #include "extend.inl" 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_extend 2 | /// @file glm/gtx/extend.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType extend 8 | ( 9 | genType const & Origin, 10 | genType const & Source, 11 | genType const & Distance 12 | ) 13 | { 14 | return Origin + (Source - Origin) * Distance; 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER tvec2 extend 19 | ( 20 | tvec2 const & Origin, 21 | tvec2 const & Source, 22 | T const & Distance 23 | ) 24 | { 25 | return Origin + (Source - Origin) * Distance; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER tvec3 extend 30 | ( 31 | tvec3 const & Origin, 32 | tvec3 const & Source, 33 | T const & Distance 34 | ) 35 | { 36 | return Origin + (Source - Origin) * Distance; 37 | } 38 | 39 | template 40 | GLM_FUNC_QUALIFIER tvec4 extend 41 | ( 42 | tvec4 const & Origin, 43 | tvec4 const & Source, 44 | T const & Distance 45 | ) 46 | { 47 | return Origin + (Source - Origin) * Distance; 48 | } 49 | }//namespace glm 50 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/float_notmalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_float_normalize 2 | /// @file glm/gtx/float_normalize.inl 3 | 4 | #include 5 | 6 | namespace glm 7 | { 8 | template class vecType> 9 | GLM_FUNC_QUALIFIER vecType floatNormalize(vecType const & v) 10 | { 11 | return vecType(v) / static_cast(std::numeric_limits::max()); 12 | } 13 | 14 | }//namespace glm 15 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/gradient_paint.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_optimum_pow (dependence) 6 | /// 7 | /// @defgroup gtx_gradient_paint GLM_GTX_gradient_paint 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Functions that return the color of procedural gradient for specific coordinates. 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtx/optimum_pow.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_gradient_paint extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_gradient_paint 26 | /// @{ 27 | 28 | /// Return a color from a radial gradient. 29 | /// @see - gtx_gradient_paint 30 | template 31 | GLM_FUNC_DECL T radialGradient( 32 | tvec2 const & Center, 33 | T const & Radius, 34 | tvec2 const & Focal, 35 | tvec2 const & Position); 36 | 37 | /// Return a color from a linear gradient. 38 | /// @see - gtx_gradient_paint 39 | template 40 | GLM_FUNC_DECL T linearGradient( 41 | tvec2 const & Point0, 42 | tvec2 const & Point1, 43 | tvec2 const & Position); 44 | 45 | /// @} 46 | }// namespace glm 47 | 48 | #include "gradient_paint.inl" 49 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_gradient_paint 2 | /// @file glm/gtx/gradient_paint.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T radialGradient 8 | ( 9 | tvec2 const & Center, 10 | T const & Radius, 11 | tvec2 const & Focal, 12 | tvec2 const & Position 13 | ) 14 | { 15 | tvec2 F = Focal - Center; 16 | tvec2 D = Position - Focal; 17 | T Radius2 = pow2(Radius); 18 | T Fx2 = pow2(F.x); 19 | T Fy2 = pow2(F.y); 20 | 21 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 22 | T Denominator = Radius2 - (Fx2 + Fy2); 23 | return Numerator / Denominator; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER T linearGradient 28 | ( 29 | tvec2 const & Point0, 30 | tvec2 const & Point1, 31 | tvec2 const & Position 32 | ) 33 | { 34 | tvec2 Dist = Point1 - Point0; 35 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 36 | } 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/handed_coordinate_space.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_handed_coordinate_space GLM_GTX_handed_coordinate_space 7 | /// @ingroup gtx 8 | /// 9 | /// @brief To know if a set of three basis vectors defines a right or left-handed coordinate system. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_handed_coordinate_space extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_handed_coordinate_space 25 | /// @{ 26 | 27 | //! Return if a trihedron right handed or not. 28 | //! From GLM_GTX_handed_coordinate_space extension. 29 | template 30 | GLM_FUNC_DECL bool rightHanded( 31 | tvec3 const & tangent, 32 | tvec3 const & binormal, 33 | tvec3 const & normal); 34 | 35 | //! Return if a trihedron left handed or not. 36 | //! From GLM_GTX_handed_coordinate_space extension. 37 | template 38 | GLM_FUNC_DECL bool leftHanded( 39 | tvec3 const & tangent, 40 | tvec3 const & binormal, 41 | tvec3 const & normal); 42 | 43 | /// @} 44 | }// namespace glm 45 | 46 | #include "handed_coordinate_space.inl" 47 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_handed_coordinate_space 2 | /// @file glm/gtx/handed_coordinate_space.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool rightHanded 8 | ( 9 | tvec3 const & tangent, 10 | tvec3 const & binormal, 11 | tvec3 const & normal 12 | ) 13 | { 14 | return dot(cross(normal, tangent), binormal) > T(0); 15 | } 16 | 17 | template 18 | GLM_FUNC_QUALIFIER bool leftHanded 19 | ( 20 | tvec3 const & tangent, 21 | tvec3 const & binormal, 22 | tvec3 const & normal 23 | ) 24 | { 25 | return dot(cross(normal, tangent), binormal) < T(0); 26 | } 27 | }//namespace glm 28 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_log_base GLM_GTX_log_base 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Logarithm for any base. base can be a vector or a scalar. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_log_base extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_log_base 25 | /// @{ 26 | 27 | /// Logarithm for any base. 28 | /// From GLM_GTX_log_base. 29 | template 30 | GLM_FUNC_DECL genType log( 31 | genType const & x, 32 | genType const & base); 33 | 34 | /// Logarithm for any base. 35 | /// From GLM_GTX_log_base. 36 | template class vecType> 37 | GLM_FUNC_DECL vecType sign( 38 | vecType const & x, 39 | vecType const & base); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "log_base.inl" 45 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_log_base 2 | /// @file glm/gtx/log_base.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType log(genType const & x, genType const & base) 8 | { 9 | assert(x != genType(0)); 10 | return glm::log(x) / glm::log(base); 11 | } 12 | 13 | template class vecType> 14 | GLM_FUNC_QUALIFIER vecType log(vecType const & x, vecType const & base) 15 | { 16 | return glm::log(x) / glm::log(base); 17 | } 18 | }//namespace glm 19 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_cross_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_matrix_cross_product GLM_GTX_matrix_cross_product 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Build cross product matrices 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_matrix_cross_product extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_matrix_cross_product 26 | /// @{ 27 | 28 | //! Build a cross product matrix. 29 | //! From GLM_GTX_matrix_cross_product extension. 30 | template 31 | GLM_FUNC_DECL tmat3x3 matrixCross3( 32 | tvec3 const & x); 33 | 34 | //! Build a cross product matrix. 35 | //! From GLM_GTX_matrix_cross_product extension. 36 | template 37 | GLM_FUNC_DECL tmat4x4 matrixCross4( 38 | tvec3 const & x); 39 | 40 | /// @} 41 | }//namespace glm 42 | 43 | #include "matrix_cross_product.inl" 44 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_cross_product 2 | /// @file glm/gtx/matrix_cross_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 matrixCross3 8 | ( 9 | tvec3 const & x 10 | ) 11 | { 12 | tmat3x3 Result(T(0)); 13 | Result[0][1] = x.z; 14 | Result[1][0] = -x.z; 15 | Result[0][2] = -x.y; 16 | Result[2][0] = x.y; 17 | Result[1][2] = x.x; 18 | Result[2][1] = -x.x; 19 | return Result; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tmat4x4 matrixCross4 24 | ( 25 | tvec3 const & x 26 | ) 27 | { 28 | tmat4x4 Result(T(0)); 29 | Result[0][1] = x.z; 30 | Result[1][0] = -x.z; 31 | Result[0][2] = -x.y; 32 | Result[2][0] = x.y; 33 | Result[1][2] = x.x; 34 | Result[2][1] = -x.x; 35 | return Result; 36 | } 37 | 38 | }//namespace glm 39 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_decompose.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_decompose 2 | /// @file glm/gtx/matrix_decompose.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_matrix_decompose GLM_GTX_matrix_decompose 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Decomposes a model matrix to translations, rotation and scale components 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../mat4x4.hpp" 17 | #include "../vec3.hpp" 18 | #include "../vec4.hpp" 19 | #include "../geometric.hpp" 20 | #include "../gtc/quaternion.hpp" 21 | #include "../gtc/matrix_transform.hpp" 22 | 23 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 24 | # pragma message("GLM: GLM_GTX_matrix_decompose extension included") 25 | #endif 26 | 27 | namespace glm 28 | { 29 | /// @addtogroup gtx_matrix_decompose 30 | /// @{ 31 | 32 | /// Decomposes a model matrix to translations, rotation and scale components 33 | /// @see gtx_matrix_decompose 34 | template 35 | GLM_FUNC_DECL bool decompose( 36 | tmat4x4 const & modelMatrix, 37 | tvec3 & scale, tquat & orientation, tvec3 & translation, tvec3 & skew, tvec4 & perspective); 38 | 39 | /// @} 40 | }//namespace glm 41 | 42 | #include "matrix_decompose.inl" 43 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/matrix_transform_2d.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_matrix_transform_2d 2 | /// @file glm/gtc/matrix_transform_2d.inl 3 | /// @author Miguel Ángel Pérez Martínez 4 | 5 | #include "../trigonometric.hpp" 6 | 7 | namespace glm 8 | { 9 | 10 | template 11 | GLM_FUNC_QUALIFIER tmat3x3 translate( 12 | tmat3x3 const & m, 13 | tvec2 const & v) 14 | { 15 | tmat3x3 Result(m); 16 | Result[2] = m[0] * v[0] + m[1] * v[1] + m[2]; 17 | return Result; 18 | } 19 | 20 | 21 | template 22 | GLM_FUNC_QUALIFIER tmat3x3 rotate( 23 | tmat3x3 const & m, 24 | T angle) 25 | { 26 | T const a = angle; 27 | T const c = cos(a); 28 | T const s = sin(a); 29 | 30 | tmat3x3 Result(uninitialize); 31 | Result[0] = m[0] * c + m[1] * s; 32 | Result[1] = m[0] * -s + m[1] * c; 33 | Result[2] = m[2]; 34 | return Result; 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER tmat3x3 scale( 39 | tmat3x3 const & m, 40 | tvec2 const & v) 41 | { 42 | tmat3x3 Result(uninitialize); 43 | Result[0] = m[0] * v[0]; 44 | Result[1] = m[1] * v[1]; 45 | Result[2] = m[2]; 46 | return Result; 47 | } 48 | 49 | template 50 | GLM_FUNC_QUALIFIER tmat3x3 shearX( 51 | tmat3x3 const & m, 52 | T y) 53 | { 54 | tmat3x3 Result(1); 55 | Result[0][1] = y; 56 | return m * Result; 57 | } 58 | 59 | template 60 | GLM_FUNC_QUALIFIER tmat3x3 shearY( 61 | tmat3x3 const & m, 62 | T x) 63 | { 64 | tmat3x3 Result(1); 65 | Result[1][0] = x; 66 | return m * Result; 67 | } 68 | 69 | }//namespace glm 70 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/mixed_product.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_mixed_product GLM_GTX_mixed_producte 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Mixed product of 3 vectors. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_mixed_product extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_mixed_product 25 | /// @{ 26 | 27 | /// @brief Mixed product of 3 vectors (from GLM_GTX_mixed_product extension) 28 | template 29 | GLM_FUNC_DECL T mixedProduct( 30 | tvec3 const & v1, 31 | tvec3 const & v2, 32 | tvec3 const & v3); 33 | 34 | /// @} 35 | }// namespace glm 36 | 37 | #include "mixed_product.inl" 38 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_mixed_product 2 | /// @file glm/gtx/mixed_product.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER T mixedProduct 8 | ( 9 | tvec3 const & v1, 10 | tvec3 const & v2, 11 | tvec3 const & v3 12 | ) 13 | { 14 | return dot(cross(v1, v2), v3); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normal.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_normal GLM_GTX_normal 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Compute the normal of a triangle. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_normal extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_normal 26 | /// @{ 27 | 28 | //! Computes triangle normal from triangle points. 29 | //! From GLM_GTX_normal extension. 30 | template 31 | GLM_FUNC_DECL tvec3 triangleNormal( 32 | tvec3 const & p1, 33 | tvec3 const & p2, 34 | tvec3 const & p3); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "normal.inl" 40 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normal 2 | /// @file glm/gtx/normal.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 triangleNormal 8 | ( 9 | tvec3 const & p1, 10 | tvec3 const & p2, 11 | tvec3 const & p3 12 | ) 13 | { 14 | return normalize(cross(p1 - p2, p1 - p3)); 15 | } 16 | }//namespace glm 17 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normalize_dot.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_fast_square_root (dependence) 6 | /// 7 | /// @defgroup gtx_normalize_dot GLM_GTX_normalize_dot 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Dot product of vectors that need to be normalize with a single square root. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../gtx/fast_square_root.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_normalize_dot extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_normalize_dot 26 | /// @{ 27 | 28 | /// Normalize parameters and returns the dot product of x and y. 29 | /// It's faster that dot(normalize(x), normalize(y)). 30 | /// 31 | /// @see gtx_normalize_dot extension. 32 | template class vecType> 33 | GLM_FUNC_DECL T normalizeDot(vecType const & x, vecType const & y); 34 | 35 | /// Normalize parameters and returns the dot product of x and y. 36 | /// Faster that dot(fastNormalize(x), fastNormalize(y)). 37 | /// 38 | /// @see gtx_normalize_dot extension. 39 | template class vecType> 40 | GLM_FUNC_DECL T fastNormalizeDot(vecType const & x, vecType const & y); 41 | 42 | /// @} 43 | }//namespace glm 44 | 45 | #include "normalize_dot.inl" 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/normalize_dot.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_normalize_dot 2 | /// @file glm/gtx/normalize_dot.inl 3 | 4 | namespace glm 5 | { 6 | template class vecType> 7 | GLM_FUNC_QUALIFIER T normalizeDot(vecType const & x, vecType const & y) 8 | { 9 | return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); 10 | } 11 | 12 | template class vecType> 13 | GLM_FUNC_QUALIFIER T fastNormalizeDot(vecType const & x, vecType const & y) 14 | { 15 | return glm::dot(x, y) * glm::fastInverseSqrt(glm::dot(x, x) * glm::dot(y, y)); 16 | } 17 | }//namespace glm 18 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_number_precision 2 | /// @file glm/gtx/number_precision.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/optimum_pow.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_optimum_pow GLM_GTX_optimum_pow 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Integer exponentiation of power functions. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_optimum_pow extension included") 20 | #endif 21 | 22 | namespace glm{ 23 | namespace gtx 24 | { 25 | /// @addtogroup gtx_optimum_pow 26 | /// @{ 27 | 28 | /// Returns x raised to the power of 2. 29 | /// 30 | /// @see gtx_optimum_pow 31 | template 32 | GLM_FUNC_DECL genType pow2(genType const & x); 33 | 34 | /// Returns x raised to the power of 3. 35 | /// 36 | /// @see gtx_optimum_pow 37 | template 38 | GLM_FUNC_DECL genType pow3(genType const & x); 39 | 40 | /// Returns x raised to the power of 4. 41 | /// 42 | /// @see gtx_optimum_pow 43 | template 44 | GLM_FUNC_DECL genType pow4(genType const & x); 45 | 46 | /// @} 47 | }//namespace gtx 48 | }//namespace glm 49 | 50 | #include "optimum_pow.inl" 51 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_optimum_pow 2 | /// @file glm/gtx/optimum_pow.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER genType pow2(genType const & x) 8 | { 9 | return x * x; 10 | } 11 | 12 | template 13 | GLM_FUNC_QUALIFIER genType pow3(genType const & x) 14 | { 15 | return x * x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow4(genType const & x) 20 | { 21 | return (x * x) * (x * x); 22 | } 23 | }//namespace glm 24 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/orthonormalize.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_extented_min_max (dependence) 6 | /// 7 | /// @defgroup gtx_orthonormalize GLM_GTX_orthonormalize 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Orthonormalize matrices. 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../vec3.hpp" 18 | #include "../mat3x3.hpp" 19 | #include "../geometric.hpp" 20 | 21 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 | # pragma message("GLM: GLM_GTX_orthonormalize extension included") 23 | #endif 24 | 25 | namespace glm 26 | { 27 | /// @addtogroup gtx_orthonormalize 28 | /// @{ 29 | 30 | /// Returns the orthonormalized matrix of m. 31 | /// 32 | /// @see gtx_orthonormalize 33 | template 34 | GLM_FUNC_DECL tmat3x3 orthonormalize(tmat3x3 const & m); 35 | 36 | /// Orthonormalizes x according y. 37 | /// 38 | /// @see gtx_orthonormalize 39 | template 40 | GLM_FUNC_DECL tvec3 orthonormalize(tvec3 const & x, tvec3 const & y); 41 | 42 | /// @} 43 | }//namespace glm 44 | 45 | #include "orthonormalize.inl" 46 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_orthonormalize 2 | /// @file glm/gtx/orthonormalize.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tmat3x3 orthonormalize(tmat3x3 const & m) 8 | { 9 | tmat3x3 r = m; 10 | 11 | r[0] = normalize(r[0]); 12 | 13 | T d0 = dot(r[0], r[1]); 14 | r[1] -= r[0] * d0; 15 | r[1] = normalize(r[1]); 16 | 17 | T d1 = dot(r[1], r[2]); 18 | d0 = dot(r[0], r[2]); 19 | r[2] -= r[0] * d0 + r[1] * d1; 20 | r[2] = normalize(r[2]); 21 | 22 | return r; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER tvec3 orthonormalize(tvec3 const & x, tvec3 const & y) 27 | { 28 | return normalize(x - y * dot(y, x)); 29 | } 30 | }//namespace glm 31 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/perpendicular.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtx_projection (dependence) 6 | /// 7 | /// @defgroup gtx_perpendicular GLM_GTX_perpendicular 8 | /// @ingroup gtx 9 | /// 10 | /// @brief Perpendicular of a vector from other one 11 | /// 12 | /// need to be included to use these functionalities. 13 | 14 | #pragma once 15 | 16 | // Dependency: 17 | #include "../glm.hpp" 18 | #include "../gtx/projection.hpp" 19 | 20 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 21 | # pragma message("GLM: GLM_GTX_perpendicular extension included") 22 | #endif 23 | 24 | namespace glm 25 | { 26 | /// @addtogroup gtx_perpendicular 27 | /// @{ 28 | 29 | //! Projects x a perpendicular axis of Normal. 30 | //! From GLM_GTX_perpendicular extension. 31 | template 32 | GLM_FUNC_DECL vecType perp( 33 | vecType const & x, 34 | vecType const & Normal); 35 | 36 | /// @} 37 | }//namespace glm 38 | 39 | #include "perpendicular.inl" 40 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_perpendicular 2 | /// @file glm/gtx/perpendicular.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType perp 8 | ( 9 | vecType const & x, 10 | vecType const & Normal 11 | ) 12 | { 13 | return x - proj(x, Normal); 14 | } 15 | }//namespace glm 16 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/polar_coordinates.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_polar_coordinates GLM_GTX_polar_coordinates 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Conversion from Euclidean space to polar space and revert. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_polar_coordinates extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_polar_coordinates 25 | /// @{ 26 | 27 | /// Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude. 28 | /// 29 | /// @see gtx_polar_coordinates 30 | template 31 | GLM_FUNC_DECL tvec3 polar( 32 | tvec3 const & euclidean); 33 | 34 | /// Convert Polar to Euclidean coordinates. 35 | /// 36 | /// @see gtx_polar_coordinates 37 | template 38 | GLM_FUNC_DECL tvec3 euclidean( 39 | tvec2 const & polar); 40 | 41 | /// @} 42 | }//namespace glm 43 | 44 | #include "polar_coordinates.inl" 45 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_polar_coordinates 2 | /// @file glm/gtx/polar_coordinates.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER tvec3 polar 8 | ( 9 | tvec3 const & euclidean 10 | ) 11 | { 12 | T const Length(length(euclidean)); 13 | tvec3 const tmp(euclidean / Length); 14 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 15 | 16 | return tvec3( 17 | asin(tmp.y), // latitude 18 | atan(tmp.x, tmp.z), // longitude 19 | xz_dist); // xz distance 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER tvec3 euclidean 24 | ( 25 | tvec2 const & polar 26 | ) 27 | { 28 | T const latitude(polar.x); 29 | T const longitude(polar.y); 30 | 31 | return tvec3( 32 | cos(latitude) * sin(longitude), 33 | sin(latitude), 34 | cos(latitude) * cos(longitude)); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_projection GLM_GTX_projection 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../geometric.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_projection extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_projection 25 | /// @{ 26 | 27 | /// Projects x on Normal. 28 | /// 29 | /// @see gtx_projection 30 | template 31 | GLM_FUNC_DECL vecType proj(vecType const & x, vecType const & Normal); 32 | 33 | /// @} 34 | }//namespace glm 35 | 36 | #include "projection.inl" 37 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_projection 2 | /// @file glm/gtx/projection.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER vecType proj(vecType const & x, vecType const & Normal) 8 | { 9 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 10 | } 11 | }//namespace glm 12 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/raw_data.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_raw_data GLM_GTX_raw_data 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Projection of a vector to other one 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependencies 16 | #include "../detail/setup.hpp" 17 | #include "../detail/type_int.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_raw_data extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_raw_data 26 | /// @{ 27 | 28 | //! Type for byte numbers. 29 | //! From GLM_GTX_raw_data extension. 30 | typedef detail::uint8 byte; 31 | 32 | //! Type for word numbers. 33 | //! From GLM_GTX_raw_data extension. 34 | typedef detail::uint16 word; 35 | 36 | //! Type for dword numbers. 37 | //! From GLM_GTX_raw_data extension. 38 | typedef detail::uint32 dword; 39 | 40 | //! Type for qword numbers. 41 | //! From GLM_GTX_raw_data extension. 42 | typedef detail::uint64 qword; 43 | 44 | /// @} 45 | }// namespace glm 46 | 47 | #include "raw_data.inl" 48 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_raw_data 2 | /// @file glm/gtx/raw_data.inl 3 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_scalar_relational GLM_GTX_scalar_relational 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Extend a position from a source to a position at a defined length. 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | 18 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 19 | # pragma message("GLM: GLM_GTX_extend extension included") 20 | #endif 21 | 22 | namespace glm 23 | { 24 | /// @addtogroup gtx_scalar_relational 25 | /// @{ 26 | 27 | 28 | 29 | /// @} 30 | }//namespace glm 31 | 32 | #include "scalar_relational.inl" 33 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_scalar_relational 2 | /// @file glm/gtx/scalar_relational.inl 3 | 4 | namespace glm 5 | { 6 | template 7 | GLM_FUNC_QUALIFIER bool lessThan 8 | ( 9 | T const & x, 10 | T const & y 11 | ) 12 | { 13 | return x < y; 14 | } 15 | 16 | template 17 | GLM_FUNC_QUALIFIER bool lessThanEqual 18 | ( 19 | T const & x, 20 | T const & y 21 | ) 22 | { 23 | return x <= y; 24 | } 25 | 26 | template 27 | GLM_FUNC_QUALIFIER bool greaterThan 28 | ( 29 | T const & x, 30 | T const & y 31 | ) 32 | { 33 | return x > y; 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER bool greaterThanEqual 38 | ( 39 | T const & x, 40 | T const & y 41 | ) 42 | { 43 | return x >= y; 44 | } 45 | 46 | template 47 | GLM_FUNC_QUALIFIER bool equal 48 | ( 49 | T const & x, 50 | T const & y 51 | ) 52 | { 53 | return x == y; 54 | } 55 | 56 | template 57 | GLM_FUNC_QUALIFIER bool notEqual 58 | ( 59 | T const & x, 60 | T const & y 61 | ) 62 | { 63 | return x != y; 64 | } 65 | 66 | GLM_FUNC_QUALIFIER bool any 67 | ( 68 | bool const & x 69 | ) 70 | { 71 | return x; 72 | } 73 | 74 | GLM_FUNC_QUALIFIER bool all 75 | ( 76 | bool const & x 77 | ) 78 | { 79 | return x; 80 | } 81 | 82 | GLM_FUNC_QUALIFIER bool not_ 83 | ( 84 | bool const & x 85 | ) 86 | { 87 | return !x; 88 | } 89 | }//namespace glm 90 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/spline.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_spline 2 | /// @file glm/gtx/spline.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// 6 | /// @defgroup gtx_spline GLM_GTX_spline 7 | /// @ingroup gtx 8 | /// 9 | /// @brief Spline functions 10 | /// 11 | /// need to be included to use these functionalities. 12 | 13 | #pragma once 14 | 15 | // Dependency: 16 | #include "../glm.hpp" 17 | #include "../gtx/optimum_pow.hpp" 18 | 19 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 | # pragma message("GLM: GLM_GTX_spline extension included") 21 | #endif 22 | 23 | namespace glm 24 | { 25 | /// @addtogroup gtx_spline 26 | /// @{ 27 | 28 | /// Return a point from a catmull rom curve. 29 | /// @see gtx_spline extension. 30 | template 31 | GLM_FUNC_DECL genType catmullRom( 32 | genType const & v1, 33 | genType const & v2, 34 | genType const & v3, 35 | genType const & v4, 36 | typename genType::value_type const & s); 37 | 38 | /// Return a point from a hermite curve. 39 | /// @see gtx_spline extension. 40 | template 41 | GLM_FUNC_DECL genType hermite( 42 | genType const & v1, 43 | genType const & t1, 44 | genType const & v2, 45 | genType const & t2, 46 | typename genType::value_type const & s); 47 | 48 | /// Return a point from a cubic curve. 49 | /// @see gtx_spline extension. 50 | template 51 | GLM_FUNC_DECL genType cubic( 52 | genType const & v1, 53 | genType const & v2, 54 | genType const & v3, 55 | genType const & v4, 56 | typename genType::value_type const & s); 57 | 58 | /// @} 59 | }//namespace glm 60 | 61 | #include "spline.inl" 62 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /// @ref gtx_std_based_type 2 | /// @file glm/gtx/std_based_type.inl 3 | 4 | namespace glm 5 | { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /demo/extern/glm/gtx/string_cast.hpp: -------------------------------------------------------------------------------- 1 | /// @ref gtx_string_cast 2 | /// @file glm/gtx/string_cast.hpp 3 | /// 4 | /// @see core (dependence) 5 | /// @see gtc_half_float (dependence) 6 | /// @see gtx_integer (dependence) 7 | /// @see gtx_quaternion (dependence) 8 | /// 9 | /// @defgroup gtx_string_cast GLM_GTX_string_cast 10 | /// @ingroup gtx 11 | /// 12 | /// @brief Setup strings for GLM type values 13 | /// 14 | /// need to be included to use these functionalities. 15 | /// This extension is not supported with CUDA 16 | 17 | #pragma once 18 | 19 | // Dependency: 20 | #include "../glm.hpp" 21 | #include "../gtc/type_precision.hpp" 22 | #include "../gtc/quaternion.hpp" 23 | #include "../gtx/dual_quaternion.hpp" 24 | #include 25 | 26 | #if(GLM_COMPILER & GLM_COMPILER_CUDA) 27 | # error "GLM_GTX_string_cast is not supported on CUDA compiler" 28 | #endif 29 | 30 | #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 31 | # pragma message("GLM: GLM_GTX_string_cast extension included") 32 | #endif 33 | 34 | namespace glm 35 | { 36 | /// @addtogroup gtx_string_cast 37 | /// @{ 38 | 39 | /// Create a string from a GLM vector or matrix typed variable. 40 | /// @see gtx_string_cast extension. 41 | template