├── .gitattributes
├── .github
└── workflows
│ └── cmake.yml
├── CMakeLists.txt
├── COPYING
├── Doxyfile
├── README.md
├── cmake
├── Findstormlib.cmake
├── GenerateRevision.cmake
├── add_compiler_flag_if_supported.cmake
├── deps
│ ├── patch_dascript.cmake
│ └── patch_fastnoise2.cmake
├── linux_postfind.cmake
├── revision.h.in
└── win32_postfind.cmake
├── etc
├── random_changes_for_mop.diff
├── some_changes_for_cataclysm.diff
├── todo_1.4.md
└── uid_fix_concept.md
├── include
├── utf8.h
└── win
│ ├── StackWalker.cpp
│ └── StackWalker.h
├── media
├── noggit.icns
├── noggit.ico
├── noggit.png
├── noggit_icon.png
└── res.rc
├── resources
├── fa-solid-900.ttf
├── noggit_font.ttf
└── resources.qrc
├── scripts
├── clean.lua
├── docs
│ ├── README.md
│ └── api
│ │ ├── classes
│ │ ├── chunk.md
│ │ ├── image.md
│ │ ├── model.md
│ │ ├── noisemap.md
│ │ ├── procedures_class.md
│ │ ├── random.md
│ │ ├── script_brush.md
│ │ ├── script_brush_event.md
│ │ ├── selection.md
│ │ ├── tag.md
│ │ ├── tex.md
│ │ ├── vector_3d.md
│ │ └── vert.md
│ │ └── modules.md
├── global.d.ts
├── height_noise.lua
├── image_brush.lua
├── prop_placer.lua
├── texture_brush.lua
├── texture_printer.lua
└── tsconfig.json
├── sql
└── Noggit.sql
├── src
├── external
│ ├── qt-color-widgets.repo
│ └── qt-color-widgets
│ │ ├── CMakeLists.txt
│ │ ├── COPYING
│ │ ├── qt-color-widgets
│ │ ├── abstract_widget_list.hpp
│ │ ├── bound_color_selector.hpp
│ │ ├── color_2d_slider.hpp
│ │ ├── color_delegate.hpp
│ │ ├── color_dialog.hpp
│ │ ├── color_line_edit.hpp
│ │ ├── color_list_widget.hpp
│ │ ├── color_names.hpp
│ │ ├── color_palette.hpp
│ │ ├── color_palette_model.hpp
│ │ ├── color_palette_widget.hpp
│ │ ├── color_preview.hpp
│ │ ├── color_selector.hpp
│ │ ├── color_wheel.hpp
│ │ ├── gradient_slider.hpp
│ │ ├── hue_slider.hpp
│ │ └── swatch.hpp
│ │ └── src
│ │ ├── abstract_widget_list.cpp
│ │ ├── alphaback.png
│ │ ├── bound_color_selector.cpp
│ │ ├── color_2d_slider.cpp
│ │ ├── color_delegate.cpp
│ │ ├── color_dialog.cpp
│ │ ├── color_dialog.ui
│ │ ├── color_line_edit.cpp
│ │ ├── color_list_widget.cpp
│ │ ├── color_names.cpp
│ │ ├── color_palette.cpp
│ │ ├── color_palette_model.cpp
│ │ ├── color_palette_widget.cpp
│ │ ├── color_palette_widget.ui
│ │ ├── color_preview.cpp
│ │ ├── color_selector.cpp
│ │ ├── color_utils.cpp
│ │ ├── color_utils.hpp
│ │ ├── color_wheel.cpp
│ │ ├── color_widgets.qrc
│ │ ├── gradient_slider.cpp
│ │ ├── hue_slider.cpp
│ │ └── swatch.cpp
├── glsl
│ ├── cursor_frag.glsl
│ ├── cursor_vert.glsl
│ ├── gizmo_frag.glsl
│ ├── gizmo_vert.glsl
│ ├── horizon_frag.glsl
│ ├── horizon_vert.glsl
│ ├── liquid_frag.glsl
│ ├── liquid_vert.glsl
│ ├── m2_box_frag.glsl
│ ├── m2_box_vert.glsl
│ ├── m2_depth_frag.glsl
│ ├── m2_depth_vert.glsl
│ ├── m2_frag.glsl
│ ├── m2_vert.glsl
│ ├── mfbo_frag.glsl
│ ├── mfbo_vert.glsl
│ ├── particle_frag.glsl
│ ├── particle_vert.glsl
│ ├── ribbon_frag.glsl
│ ├── ribbon_vert.glsl
│ ├── shadow_frag.glsl
│ ├── shadow_vert.glsl
│ ├── terrain_frag.glsl
│ ├── terrain_vert.glsl
│ ├── wmo_depth_frag.glsl
│ ├── wmo_depth_vert.glsl
│ ├── wmo_frag.glsl
│ └── wmo_vert.glsl
├── math
│ ├── bounding_box.cpp
│ ├── bounding_box.hpp
│ ├── constants.hpp
│ ├── frustum.cpp
│ ├── frustum.hpp
│ ├── interpolation.hpp
│ ├── matrix_4x4.cpp
│ ├── matrix_4x4.hpp
│ ├── projection.hpp
│ ├── quaternion.hpp
│ ├── ray.cpp
│ ├── ray.hpp
│ ├── trig.hpp
│ ├── vector_2d.cpp
│ ├── vector_2d.hpp
│ ├── vector_3d.hpp
│ └── vector_4d.hpp
├── mysql
│ ├── mysql.cpp
│ └── mysql.h
├── noggit
│ ├── Animated.h
│ ├── AsyncLoader.cpp
│ ├── AsyncLoader.h
│ ├── AsyncObject.h
│ ├── Brush.cpp
│ ├── Brush.h
│ ├── DBC.cpp
│ ├── DBC.h
│ ├── DBCFile.cpp
│ ├── DBCFile.h
│ ├── Log.cpp
│ ├── Log.h
│ ├── MPQ.cpp
│ ├── MPQ.h
│ ├── MapChunk.cpp
│ ├── MapChunk.h
│ ├── MapHeaders.h
│ ├── MapTile.cpp
│ ├── MapTile.h
│ ├── MapView.cpp
│ ├── MapView.h
│ ├── Misc.cpp
│ ├── Misc.h
│ ├── Model.cpp
│ ├── Model.h
│ ├── ModelHeaders.h
│ ├── ModelInstance.cpp
│ ├── ModelInstance.h
│ ├── ModelManager.cpp
│ ├── ModelManager.h
│ ├── Particle.cpp
│ ├── Particle.h
│ ├── Selection.h
│ ├── Sky.cpp
│ ├── Sky.h
│ ├── TextureManager.cpp
│ ├── TextureManager.h
│ ├── WMO.cpp
│ ├── WMO.h
│ ├── WMOInstance.cpp
│ ├── WMOInstance.h
│ ├── World.cpp
│ ├── World.h
│ ├── alphamap.cpp
│ ├── alphamap.hpp
│ ├── application.cpp
│ ├── bookmarks.cpp
│ ├── bookmarks.hpp
│ ├── bool_toggle_property.hpp
│ ├── camera.cpp
│ ├── camera.hpp
│ ├── chunk_mover.cpp
│ ├── chunk_mover.hpp
│ ├── cursor_render.cpp
│ ├── cursor_render.hpp
│ ├── errorHandling.h
│ ├── error_handling.cpp
│ ├── float_property.hpp
│ ├── gizmo.cpp
│ ├── gizmo.hpp
│ ├── liquid_chunk.cpp
│ ├── liquid_chunk.hpp
│ ├── liquid_layer.cpp
│ ├── liquid_layer.hpp
│ ├── liquid_render.cpp
│ ├── liquid_render.hpp
│ ├── liquid_tile.cpp
│ ├── liquid_tile.hpp
│ ├── map_chunk_headers.hpp
│ ├── map_enums.hpp
│ ├── map_horizon.cpp
│ ├── map_horizon.h
│ ├── map_index.cpp
│ ├── map_index.hpp
│ ├── moveable_object.cpp
│ ├── moveable_object.hpp
│ ├── moveable_object_group.cpp
│ ├── moveable_object_group.hpp
│ ├── multimap_with_normalized_key.hpp
│ ├── scripting
│ │ ├── script_brush.cpp
│ │ ├── script_brush.hpp
│ │ ├── script_chunk.cpp
│ │ ├── script_chunk.hpp
│ │ ├── script_context.cpp
│ │ ├── script_context.hpp
│ │ ├── script_exception.cpp
│ │ ├── script_exception.hpp
│ │ ├── script_filesystem.cpp
│ │ ├── script_filesystem.hpp
│ │ ├── script_global.cpp
│ │ ├── script_global.hpp
│ │ ├── script_image.cpp
│ │ ├── script_image.hpp
│ │ ├── script_math.cpp
│ │ ├── script_math.hpp
│ │ ├── script_model.cpp
│ │ ├── script_model.hpp
│ │ ├── script_noise.cpp
│ │ ├── script_noise.hpp
│ │ ├── script_object.cpp
│ │ ├── script_object.hpp
│ │ ├── script_procedures.cpp
│ │ ├── script_procedures.hpp
│ │ ├── script_profiles.cpp
│ │ ├── script_profiles.hpp
│ │ ├── script_random.cpp
│ │ ├── script_random.hpp
│ │ ├── script_registry.ipp
│ │ ├── script_selection.cpp
│ │ ├── script_selection.hpp
│ │ ├── script_settings.cpp
│ │ ├── script_settings.hpp
│ │ ├── script_standard_brush.cpp
│ │ ├── script_standard_brush.hpp
│ │ ├── script_tex.cpp
│ │ ├── script_tex.hpp
│ │ ├── script_vert-script_texture_index.ipp
│ │ ├── script_vert.cpp
│ │ ├── script_vert.hpp
│ │ ├── scripting_tool.cpp
│ │ └── scripting_tool.hpp
│ ├── settings.hpp
│ ├── texture_array_handler.cpp
│ ├── texture_array_handler.hpp
│ ├── texture_set.cpp
│ ├── texture_set.hpp
│ ├── tile_index.hpp
│ ├── tileset_array_handler.cpp
│ ├── tileset_array_handler.hpp
│ ├── tool_enums.hpp
│ ├── ui
│ │ ├── About.cpp
│ │ ├── About.h
│ │ ├── CurrentTexture.cpp
│ │ ├── CurrentTexture.h
│ │ ├── CursorSwitcher.cpp
│ │ ├── CursorSwitcher.h
│ │ ├── DetailInfos.cpp
│ │ ├── DetailInfos.h
│ │ ├── FlattenTool.cpp
│ │ ├── FlattenTool.hpp
│ │ ├── Help.cpp
│ │ ├── Help.h
│ │ ├── HelperModels.cpp
│ │ ├── HelperModels.h
│ │ ├── ModelImport.cpp
│ │ ├── ModelImport.h
│ │ ├── ObjectEditor.cpp
│ │ ├── ObjectEditor.h
│ │ ├── RotationEditor.cpp
│ │ ├── RotationEditor.h
│ │ ├── SettingsPanel.cpp
│ │ ├── SettingsPanel.h
│ │ ├── TextureList.cpp
│ │ ├── TextureList.hpp
│ │ ├── TexturePicker.cpp
│ │ ├── TexturePicker.h
│ │ ├── TexturingGUI.cpp
│ │ ├── TexturingGUI.h
│ │ ├── Toolbar.cpp
│ │ ├── Toolbar.h
│ │ ├── Water.cpp
│ │ ├── Water.h
│ │ ├── ZoneIDBrowser.cpp
│ │ ├── ZoneIDBrowser.h
│ │ ├── asset_browser.cpp
│ │ ├── asset_browser.hpp
│ │ ├── checkbox.hpp
│ │ ├── chunk_mover.cpp
│ │ ├── chunk_mover.hpp
│ │ ├── clearing_tool.cpp
│ │ ├── clearing_tool.hpp
│ │ ├── clickable_label.cpp
│ │ ├── clickable_label.hpp
│ │ ├── collapsible_widget.cpp
│ │ ├── collapsible_widget.hpp
│ │ ├── double_spinbox.hpp
│ │ ├── font_awesome.cpp
│ │ ├── font_awesome.hpp
│ │ ├── font_noggit.cpp
│ │ ├── font_noggit.hpp
│ │ ├── main_window.cpp
│ │ ├── main_window.hpp
│ │ ├── minimap_widget.cpp
│ │ ├── minimap_widget.hpp
│ │ ├── noggit_tool.cpp
│ │ ├── noggit_tool.hpp
│ │ ├── pushbutton.hpp
│ │ ├── shader_tool.cpp
│ │ ├── shader_tool.hpp
│ │ ├── shadow_editor.cpp
│ │ ├── shadow_editor.hpp
│ │ ├── slider_spinbox.cpp
│ │ ├── slider_spinbox.hpp
│ │ ├── terrain_tool.cpp
│ │ ├── terrain_tool.hpp
│ │ ├── texture_palette_small.cpp
│ │ ├── texture_palette_small.hpp
│ │ ├── texture_swapper.cpp
│ │ ├── texture_swapper.hpp
│ │ ├── texturing_tool.cpp
│ │ ├── texturing_tool.hpp
│ │ ├── uid_fix_window.cpp
│ │ ├── uid_fix_window.hpp
│ │ └── widget.hpp
│ ├── uid_storage.cpp
│ ├── uid_storage.hpp
│ ├── unsigned_int_property.hpp
│ ├── wmo_headers.hpp
│ ├── wmo_liquid.cpp
│ ├── wmo_liquid.hpp
│ ├── world_model_instances_storage.cpp
│ ├── world_model_instances_storage.hpp
│ ├── world_tile_update_queue.cpp
│ └── world_tile_update_queue.hpp
├── opengl
│ ├── arb_bindless_texture_ext.hpp
│ ├── context.cpp
│ ├── context.hpp
│ ├── delayed.hpp
│ ├── primitives.cpp
│ ├── primitives.hpp
│ ├── scoped.hpp
│ ├── scoped.ipp
│ ├── shader.cpp
│ ├── shader.fwd.hpp
│ ├── shader.hpp
│ ├── texture.cpp
│ ├── texture.hpp
│ └── types.hpp
└── util
│ ├── exception_to_string.cpp
│ ├── exception_to_string.hpp
│ ├── qt
│ └── overload.hpp
│ ├── sExtendableArray.cpp
│ ├── sExtendableArray.hpp
│ └── sExtendableArray.ipp
└── test
└── math
├── matrix_4x4.cpp
├── trig.cpp
└── vector_2d.cpp
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Sources
2 | *.c text diff=cpp eol=lf
3 | *.h text diff=cpp eol=lf
4 | *.cpp text diff=cpp eol=lf
5 | *.hpp text diff=cpp eol=lf
6 | *.ipp text diff=cpp eol=lf
7 |
--------------------------------------------------------------------------------
/cmake/Findstormlib.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | # adds target stormlib::stormlib
4 | # hopes that users installed stormlib properly so that the CONFIG file gets used instead.
5 |
6 | find_path (STORM_INCLUDE_DIR StormLib.h StormPort.h)
7 |
8 | find_library (_storm_debug_lib NAMES StormLibDAD StormLibDAS StormLibDUD StormLibDUS)
9 | find_library (_storm_release_lib NAMES StormLibRAD StormLibRAS StormLibRUD StormLibRUS)
10 | find_library (_storm_any_lib NAMES storm stormlib StormLib)
11 |
12 | set (STORM_LIBRARIES)
13 | if (_storm_debug_lib AND _storm_release_lib)
14 | list (APPEND STORM_LIBRARIES debug ${_storm_debug_lib} optimized ${_storm_release_lib})
15 | else()
16 | list (APPEND STORM_LIBRARIES ${_storm_any_lib})
17 | endif()
18 |
19 | include (FindPackageHandleStandardArgs)
20 | find_package_handle_standard_args (stormlib DEFAULT_MSG STORM_LIBRARIES STORM_INCLUDE_DIR)
21 |
22 | mark_as_advanced (STORM_INCLUDE_DIR _storm_debug_lib _storm_release_lib _storm_any_lib STORM_LIBRARIES)
23 |
24 | add_library (StormLib INTERFACE)
25 | target_link_libraries (StormLib INTERFACE ${STORM_LIBRARIES})
26 | set_property (TARGET StormLib APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${STORM_INCLUDE_DIR})
27 | set_property (TARGET StormLib APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${STORM_INCLUDE_DIR})
28 |
29 |
30 | if (NOT WIN32)
31 | find_package (ZLIB REQUIRED)
32 | find_package (BZip2 REQUIRED)
33 | target_link_libraries (StormLib INTERFACE ZLIB::ZLIB BZip2::BZip2)
34 | endif()
35 |
36 | target_compile_definitions (StormLib INTERFACE STORMLIB_NO_AUTO_LINK)
37 |
38 | add_library (stormlib::stormlib ALIAS StormLib)
39 |
--------------------------------------------------------------------------------
/cmake/GenerateRevision.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | # assumes working directory in git repo
4 | # assumes var _noggit_revision_template_file
5 | # assumes var _noggit_revision_output_file
6 | # assumes var _noggit_revision_state_file
7 | # assumes var GIT_EXECUTABLE
8 | # generates file "${_noggit_revision_state_file}"
9 | # generates file "${_noggit_revision_output_file}"
10 |
11 |
12 | macro (execute _output_var) # , command...
13 | execute_process (COMMAND ${ARGN}
14 | OUTPUT_VARIABLE ${_output_var} OUTPUT_STRIP_TRAILING_WHITESPACE
15 | RESULT_VARIABLE _result)
16 | if (NOT _result EQUAL 0)
17 | message (FATAL_ERROR "'${ARGN}' failed.")
18 | endif()
19 | endmacro()
20 |
21 | execute (_status "${GIT_EXECUTABLE}" "status" "--porcelain")
22 | set (_dirty_marker "+")
23 | if (_status STREQUAL "")
24 | set (_dirty_marker "")
25 | endif()
26 |
27 | # \todo If head is tagged, use tag.
28 | # \todo Add deploy script that adds tags so that we have sane
29 | # revisions again, at all times.
30 | execute (_revision "${GIT_EXECUTABLE}" "rev-parse" "--short" "HEAD")
31 | execute (_commit_count "${GIT_EXECUTABLE}" "rev-list" "--count" "--all")
32 |
33 | file (READ "${_noggit_revision_template_file}" _template_blob)
34 | file (READ "${CMAKE_CURRENT_LIST_FILE}" _self_blob)
35 | string (SHA256 _state_hash "${_dirty_marker}${_revision}${_template_blob}${_self_blob}")
36 |
37 | if (EXISTS ${_noggit_revision_output_file})
38 | file (READ "${_noggit_revision_state_file}" _old_state_hash)
39 | if (_state_hash STREQUAL _old_state_hash)
40 | return()
41 | endif()
42 | endif()
43 |
44 | file (WRITE "${_noggit_revision_state_file}" "${_state_hash}")
45 |
46 | message("Commit count: ${_commit_count}")
47 |
48 | set (NOGGIT_COMMIT_COUNT "${_commit_count}${_dirty_marker}")
49 | set (NOGGIT_GIT_VERSION_STRING "${_revision}")
50 | configure_file ("${_noggit_revision_template_file}"
51 | "${_noggit_revision_output_file}" @ONLY)
52 |
--------------------------------------------------------------------------------
/cmake/deps/patch_dascript.cmake:
--------------------------------------------------------------------------------
1 | # please don't spam root source directory with test things
2 | file (READ "CMakeLists.txt" cmakelists_content)
3 | string (REPLACE "UNITIZE_BUILD(\"examples/test/unit_tests\" TEST_GENERATED_SRC)" "# noggit patch: examples removed" cmakelists_content "${cmakelists_content}")
4 | file (WRITE "CMakeLists.txt" "${cmakelists_content}")
5 |
--------------------------------------------------------------------------------
/cmake/deps/patch_fastnoise2.cmake:
--------------------------------------------------------------------------------
1 | # set includes etc relative to fastnoise2 root directory, not noggit's
2 | file (GLOB_RECURSE cmakelists LIST_DIRECTORIES FALSE "CMakeLists.txt")
3 | foreach (cmakelist ${cmakelists})
4 | file (READ "${cmakelist}" cmakelists_content)
5 | string (REPLACE "CMAKE_SOURCE_DIR" "PROJECT_SOURCE_DIR" cmakelists_content "${cmakelists_content}")
6 | file (WRITE "${cmakelist}" "${cmakelists_content}")
7 | endforeach()
8 |
--------------------------------------------------------------------------------
/cmake/linux_postfind.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | # warnings?
4 | if( NOGGIT_ALL_WARNINGS )
5 | MESSAGE( STATUS "Spilling out mass warnings." )
6 | set(noggit_warning_flags "${noggit_warning_flags} -W -Wall -Wshadow")
7 | endif( NOGGIT_ALL_WARNINGS )
8 |
--------------------------------------------------------------------------------
/cmake/revision.h.in:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | #pragma once
4 |
5 | #define STRPRODUCTVER "3.@NOGGIT_COMMIT_COUNT@ [@NOGGIT_GIT_VERSION_STRING@]"
6 |
--------------------------------------------------------------------------------
/cmake/win32_postfind.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | LINK_DIRECTORIES(${STORMLIB_LIBRARY_DIR})
4 |
5 | #maybe in wrong order now
6 | SET(IncludeDirectories ${IncludeDirectories} "${CMAKE_SOURCE_DIR}/include/win/")
7 | SET(SourceFiles ${SourceFiles} "${CMAKE_SOURCE_DIR}/include/win/StackWalker.cpp")
8 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /D NOMINMAX")
9 |
10 | # warnings?
11 | if( NOGGIT_ALL_WARNINGS )
12 | MESSAGE( STATUS "Spilling out mass warnings." )
13 | set(noggit_warning_flags "${noggit_warning_flags} /W4 /Wall /Wp64")
14 | endif( NOGGIT_ALL_WARNINGS )
15 |
16 | # mark 32 bit executables large address aware so they can use > 2GB address space
17 | if(CMAKE_SIZEOF_VOID_P MATCHES 4)
18 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
19 | message(STATUS "- MSVC: Enabled large address awareness!")
20 | endif()
21 |
22 | set(ResFiles media/res.rc)
23 |
--------------------------------------------------------------------------------
/etc/uid_fix_concept.md:
--------------------------------------------------------------------------------
1 | # MapIndex::fixUIDs() concept idea (Adspartan)
2 |
3 | ## Step 1:
4 | * read every tile
5 | * for each tile read all the modf and mddf entries
6 | * discard the entries not placed on the current tile (eg entry.pos isn't inside the tile)
7 | * discard duplicates
8 | * read the filenames
9 | * create the model/wmo instances and add them to a list
10 |
11 | -> [tile -> [(m*df, filename)]] where (m*df, filename) is unique by transformation, only entries with inside (tile, .pos) are stored
12 |
13 | ## Step 2:
14 | * create 2 lists for each tile, one for the wmo and one for the m2
15 | * assign a new uid for the instances (starting from 0)
16 | * add every model/wmo instances to the lists of every tiles they are on
17 |
18 | -> [[tile] -> [(uid, m*df, filename)] where uid is 0..n, all entries where intersect (tile, .extends) are stored
19 |
20 | ## Step 3:
21 | * load each tile without the models/wmos
22 | * save the tile with the model/wmo instances from step 2
23 |
24 | ## Step 4:
25 | * save the highest uid on the disc to not have to repeat the process ever again
26 |
27 | ## Claim
28 | * Every entity has a globally unique id in 2I, 1O
29 | * uniqueness of newly placed objects is guaranteed by storing highest uid on disk
30 |
31 | ## Shortcomings
32 | * does not work with parallel work by multiple editors on same map, or
33 | requires a central fix-pass every so often, which is undesirable
34 | -> requires one pass _after a fuckup_ which still can exist
35 | -> valid and good for single-person work
36 |
--------------------------------------------------------------------------------
/include/win/StackWalker.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/include/win/StackWalker.cpp
--------------------------------------------------------------------------------
/media/noggit.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/media/noggit.icns
--------------------------------------------------------------------------------
/media/noggit.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/media/noggit.ico
--------------------------------------------------------------------------------
/media/noggit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/media/noggit.png
--------------------------------------------------------------------------------
/media/noggit_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/media/noggit_icon.png
--------------------------------------------------------------------------------
/media/res.rc:
--------------------------------------------------------------------------------
1 | IDI_APP ICON "noggit.ico"
--------------------------------------------------------------------------------
/resources/fa-solid-900.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/resources/fa-solid-900.ttf
--------------------------------------------------------------------------------
/resources/noggit_font.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/resources/noggit_font.ttf
--------------------------------------------------------------------------------
/resources/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | fa-solid-900.ttf
5 |
6 |
7 | noggit_font.ttf
8 |
9 |
10 | ../media/noggit_icon.png
11 |
12 |
13 | ../src/glsl/m2_vert.glsl
14 | ../src/glsl/m2_frag.glsl
15 | ../src/glsl/m2_box_vert.glsl
16 | ../src/glsl/m2_box_frag.glsl
17 | ../src/glsl/particle_vert.glsl
18 | ../src/glsl/particle_frag.glsl
19 | ../src/glsl/ribbon_vert.glsl
20 | ../src/glsl/ribbon_frag.glsl
21 | ../src/glsl/terrain_vert.glsl
22 | ../src/glsl/terrain_frag.glsl
23 | ../src/glsl/wmo_vert.glsl
24 | ../src/glsl/wmo_frag.glsl
25 | ../src/glsl/liquid_vert.glsl
26 | ../src/glsl/liquid_frag.glsl
27 | ../src/glsl/mfbo_vert.glsl
28 | ../src/glsl/mfbo_frag.glsl
29 | ../src/glsl/cursor_vert.glsl
30 | ../src/glsl/cursor_frag.glsl
31 | ../src/glsl/horizon_vert.glsl
32 | ../src/glsl/horizon_frag.glsl
33 | ../src/glsl/m2_depth_vert.glsl
34 | ../src/glsl/m2_depth_frag.glsl
35 | ../src/glsl/wmo_depth_vert.glsl
36 | ../src/glsl/wmo_depth_frag.glsl
37 | ../src/glsl/shadow_vert.glsl
38 | ../src/glsl/shadow_frag.glsl
39 | ../src/glsl/gizmo_vert.glsl
40 | ../src/glsl/gizmo_frag.glsl
41 |
42 |
43 |
--------------------------------------------------------------------------------
/scripts/clean.lua:
--------------------------------------------------------------------------------
1 | -- This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | local clean = brush("Clean");
3 |
4 | local def_height = clean:add_real_tag("Default height",-1000,1000,0)
5 |
6 | local tex_layer_1 = clean:add_string_tag("Texture layer 1","")
7 | local prop_layer_1 = clean:add_int_tag("Effect layer 1",-2,9999999999,-2)
8 | local tex_layer_2 = clean:add_string_tag("Texture layer 2","")
9 | local prop_layer_2 = clean:add_int_tag("Effect layer 2",-2,9999999999,-2)
10 | local tex_layer_3 = clean:add_string_tag("Texture layer 3","")
11 | local prop_layer_3 = clean:add_int_tag("Effect layer 3",-2,9999999999,-2)
12 | local tex_layer_4 = clean:add_string_tag("Texture layer 4","")
13 | local prop_layer_4 = clean:add_int_tag("Effect layer 4",-2,9999999999,-2)
14 |
15 | function clean:on_left_hold(evt)
16 | local sel = select_origin(evt:pos(), evt:outer_radius(), evt:outer_radius())
17 | if(holding_shift()) then
18 | for i,chunk in pairs(sel:chunks()) do
19 | chunk:clear_textures()
20 | chunk:clear_colors()
21 | if tex_layer_1:get() ~= "" then chunk:add_texture(tex_layer_1:get(),prop_layer_1:get()) end
22 | if tex_layer_2:get() ~= "" then chunk:add_texture(tex_layer_2:get(),prop_layer_2:get()) end
23 | if tex_layer_3:get() ~= "" then chunk:add_texture(tex_layer_3:get(),prop_layer_3:get()) end
24 | if tex_layer_4:get() ~= "" then chunk:add_texture(tex_layer_4:get(),prop_layer_4:get()) end
25 | chunk:apply_all()
26 | end
27 | end
28 |
29 | if(holding_ctrl()) then
30 | for i,vert in pairs(sel:verts()) do
31 | vert:set_height(def_height:get())
32 | end
33 | end
34 |
35 | if(holding_alt()) then
36 | for i,model in pairs(sel:models()) do
37 | model:remove()
38 | end
39 | end
40 |
41 | sel:apply()
42 | end
--------------------------------------------------------------------------------
/scripts/docs/api/classes/noisemap.md:
--------------------------------------------------------------------------------
1 | # Class: noisemap
2 |
3 | Represents a map of floats values, typically use with a
4 | noise generator.
5 |
6 | ## Table of contents
7 |
8 | ### Constructors
9 |
10 | - [constructor](noisemap.md#constructor)
11 |
12 | ### Methods
13 |
14 | - [get](noisemap.md#get)
15 | - [height](noisemap.md#height)
16 | - [is\_highest](noisemap.md#is_highest)
17 | - [set](noisemap.md#set)
18 | - [width](noisemap.md#width)
19 |
20 | ## Constructors
21 |
22 | ### constructor
23 |
24 | \+ **new noisemap**(): [*noisemap*](noisemap.md)
25 |
26 | **Returns:** [*noisemap*](noisemap.md)
27 |
28 | ## Methods
29 |
30 | ### get
31 |
32 | ▸ **get**(`pos`: [*vector\_3d*](vector_3d.md)): *number*
33 |
34 | Returns the float value at a specific 3d position.
35 |
36 | **`note`** The 'y' value of pos is ignored by this operation.
37 |
38 | #### Parameters:
39 |
40 | Name | Type |
41 | :------ | :------ |
42 | `pos` | [*vector\_3d*](vector_3d.md) |
43 |
44 | **Returns:** *number*
45 |
46 | ___
47 |
48 | ### height
49 |
50 | ▸ **height**(): *number*
51 |
52 | **Returns:** *number*
53 |
54 | ___
55 |
56 | ### is\_highest
57 |
58 | ▸ **is_highest**(`pos`: [*vector\_3d*](vector_3d.md), `check_radius`: *number*): *boolean*
59 |
60 | Returns true if the float value at a 3d position
61 | is the highest position within a given range.
62 |
63 | This is typically used for object placement.
64 |
65 | #### Parameters:
66 |
67 | Name | Type |
68 | :------ | :------ |
69 | `pos` | [*vector\_3d*](vector_3d.md) |
70 | `check_radius` | *number* |
71 |
72 | **Returns:** *boolean*
73 |
74 | ___
75 |
76 | ### set
77 |
78 | ▸ **set**(`x`: *number*, `y`: *number*, `value`: *number*): *void*
79 |
80 | #### Parameters:
81 |
82 | Name | Type |
83 | :------ | :------ |
84 | `x` | *number* |
85 | `y` | *number* |
86 | `value` | *number* |
87 |
88 | **Returns:** *void*
89 |
90 | ___
91 |
92 | ### width
93 |
94 | ▸ **width**(): *number*
95 |
96 | **Returns:** *number*
97 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/procedures_class.md:
--------------------------------------------------------------------------------
1 | # Class: procedures\_class
2 |
3 | Contains some general-purpose procedures that don't fit anywhere else.
4 |
5 | Access these functions through the global singleton "procedures".
6 |
7 | ## Table of contents
8 |
9 | ### Constructors
10 |
11 | - [constructor](procedures_class.md#constructor)
12 |
13 | ### Methods
14 |
15 | - [paint\_texture](procedures_class.md#paint_texture)
16 |
17 | ## Constructors
18 |
19 | ### constructor
20 |
21 | \+ **new procedures_class**(): [*procedures\_class*](procedures_class.md)
22 |
23 | **Returns:** [*procedures\_class*](procedures_class.md)
24 |
25 | ## Methods
26 |
27 | ### paint\_texture
28 |
29 | ▸ **paint_texture**(`sel`: [*selection*](selection.md), `img`: [*image*](image.md), `layer`: *number*, `pressure`: *number*, `angle`: *number*): *any*
30 |
31 | #### Parameters:
32 |
33 | Name | Type |
34 | :------ | :------ |
35 | `sel` | [*selection*](selection.md) |
36 | `img` | [*image*](image.md) |
37 | `layer` | *number* |
38 | `pressure` | *number* |
39 | `angle` | *number* |
40 |
41 | **Returns:** *any*
42 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/random.md:
--------------------------------------------------------------------------------
1 | # Class: random
2 |
3 | Represents a random generator and its state.
4 |
5 | ## Table of contents
6 |
7 | ### Constructors
8 |
9 | - [constructor](random.md#constructor)
10 |
11 | ### Methods
12 |
13 | - [integer](random.md#integer)
14 | - [real](random.md#real)
15 |
16 | ## Constructors
17 |
18 | ### constructor
19 |
20 | \+ **new random**(): [*random*](random.md)
21 |
22 | **Returns:** [*random*](random.md)
23 |
24 | ## Methods
25 |
26 | ### integer
27 |
28 | ▸ **integer**(`low`: *number*, `high`: *number*): *number*
29 |
30 | #### Parameters:
31 |
32 | Name | Type |
33 | :------ | :------ |
34 | `low` | *number* |
35 | `high` | *number* |
36 |
37 | **Returns:** *number*
38 |
39 | ___
40 |
41 | ### real
42 |
43 | ▸ **real**(`low`: *number*, `high`: *number*): *number*
44 |
45 | #### Parameters:
46 |
47 | Name | Type |
48 | :------ | :------ |
49 | `low` | *number* |
50 | `high` | *number* |
51 |
52 | **Returns:** *number*
53 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/script_brush_event.md:
--------------------------------------------------------------------------------
1 | # Class: script\_brush\_event
2 |
3 | Represents the event context passed to brush click events.
4 |
5 | ## Table of contents
6 |
7 | ### Constructors
8 |
9 | - [constructor](script_brush_event.md#constructor)
10 |
11 | ### Methods
12 |
13 | - [dt](script_brush_event.md#dt)
14 | - [inner\_radius](script_brush_event.md#inner_radius)
15 | - [outer\_radius](script_brush_event.md#outer_radius)
16 | - [pos](script_brush_event.md#pos)
17 | - [set\_inner\_radius](script_brush_event.md#set_inner_radius)
18 | - [set\_outer\_radius](script_brush_event.md#set_outer_radius)
19 |
20 | ## Constructors
21 |
22 | ### constructor
23 |
24 | \+ **new script_brush_event**(): [*script\_brush\_event*](script_brush_event.md)
25 |
26 | **Returns:** [*script\_brush\_event*](script_brush_event.md)
27 |
28 | ## Methods
29 |
30 | ### dt
31 |
32 | ▸ **dt**(): *number*
33 |
34 | Returns the delta-time since the last update frame
35 |
36 | **Returns:** *number*
37 |
38 | ___
39 |
40 | ### inner\_radius
41 |
42 | ▸ **inner_radius**(): *number*
43 |
44 | Returns the current inner radius configured in the settings panel
45 |
46 | **Returns:** *number*
47 |
48 | ___
49 |
50 | ### outer\_radius
51 |
52 | ▸ **outer_radius**(): *number*
53 |
54 | Returns the current outer radius configured in the settings panel
55 |
56 | **Returns:** *number*
57 |
58 | ___
59 |
60 | ### pos
61 |
62 | ▸ **pos**(): [*vector\_3d*](vector_3d.md)
63 |
64 | Returns world position of this click event.
65 | i.e. the world position where the user clicked, held or released a mouse button
66 |
67 | **Returns:** [*vector\_3d*](vector_3d.md)
68 |
69 | ___
70 |
71 | ### set\_inner\_radius
72 |
73 | ▸ **set_inner_radius**(`value`: *number*): *any*
74 |
75 | Sets the outer radius in the settings panel for this brush
76 |
77 | #### Parameters:
78 |
79 | Name | Type | Description |
80 | :------ | :------ | :------ |
81 | `value` | *number* | should be between 0-1 |
82 |
83 | **Returns:** *any*
84 |
85 | ___
86 |
87 | ### set\_outer\_radius
88 |
89 | ▸ **set_outer_radius**(`value`: *number*): *any*
90 |
91 | Sets the outer radius in the settings panel for this brush
92 |
93 | #### Parameters:
94 |
95 | Name | Type |
96 | :------ | :------ |
97 | `value` | *number* |
98 |
99 | **Returns:** *any*
100 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/tag.md:
--------------------------------------------------------------------------------
1 | # Class: tag
2 |
3 | Represents a settings tag that can be accessed at any time by a script.
4 |
5 | ## Type parameters
6 |
7 | Name |
8 | :------ |
9 | `T` |
10 |
11 | ## Table of contents
12 |
13 | ### Constructors
14 |
15 | - [constructor](tag.md#constructor)
16 |
17 | ### Methods
18 |
19 | - [get](tag.md#get)
20 |
21 | ## Constructors
22 |
23 | ### constructor
24 |
25 | \+ **new tag**(): [*tag*](tag.md)
26 |
27 | #### Type parameters:
28 |
29 | Name |
30 | :------ |
31 | `T` |
32 |
33 | **Returns:** [*tag*](tag.md)
34 |
35 | ## Methods
36 |
37 | ### get
38 |
39 | ▸ **get**(): T
40 |
41 | Returns the current value of this tag in the settings panel.
42 |
43 | **Returns:** T
44 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/tex.md:
--------------------------------------------------------------------------------
1 | # Class: tex
2 |
3 | Represents a single texture unit in the worlds texture layers.
4 |
5 | A texture unit represents the smallest area where it's possible to
6 | affect textures alpha layers. This is much smaller than the areas made
7 | up by heightmap vertices.
8 |
9 | ## Table of contents
10 |
11 | ### Constructors
12 |
13 | - [constructor](tex.md#constructor)
14 |
15 | ### Methods
16 |
17 | - [get\_alpha](tex.md#get_alpha)
18 | - [get\_pos\_2d](tex.md#get_pos_2d)
19 | - [set\_alpha](tex.md#set_alpha)
20 |
21 | ## Constructors
22 |
23 | ### constructor
24 |
25 | \+ **new tex**(): [*tex*](tex.md)
26 |
27 | **Returns:** [*tex*](tex.md)
28 |
29 | ## Methods
30 |
31 | ### get\_alpha
32 |
33 | ▸ **get_alpha**(`index`: *number*): *number*
34 |
35 | #### Parameters:
36 |
37 | Name | Type |
38 | :------ | :------ |
39 | `index` | *number* |
40 |
41 | **Returns:** *number*
42 |
43 | ___
44 |
45 | ### get\_pos\_2d
46 |
47 | ▸ **get_pos_2d**(): [*vector\_3d*](vector_3d.md)
48 |
49 | **Returns:** [*vector\_3d*](vector_3d.md)
50 |
51 | ___
52 |
53 | ### set\_alpha
54 |
55 | ▸ **set_alpha**(`index`: *number*, `alpha`: *number*): *void*
56 |
57 | #### Parameters:
58 |
59 | Name | Type |
60 | :------ | :------ |
61 | `index` | *number* |
62 | `alpha` | *number* |
63 |
64 | **Returns:** *void*
65 |
--------------------------------------------------------------------------------
/scripts/docs/api/classes/vector_3d.md:
--------------------------------------------------------------------------------
1 | # Class: vector\_3d
2 |
3 | Represents a 3-dimensional vector.
4 | Most functions do not use the 'y' (height) value at all
5 |
6 | ## Table of contents
7 |
8 | ### Constructors
9 |
10 | - [constructor](vector_3d.md#constructor)
11 |
12 | ### Properties
13 |
14 | - [x](vector_3d.md#x)
15 | - [y](vector_3d.md#y)
16 | - [z](vector_3d.md#z)
17 |
18 | ## Constructors
19 |
20 | ### constructor
21 |
22 | \+ **new vector_3d**(): [*vector\_3d*](vector_3d.md)
23 |
24 | **Returns:** [*vector\_3d*](vector_3d.md)
25 |
26 | ## Properties
27 |
28 | ### x
29 |
30 | • **x**: *number*
31 |
32 | ___
33 |
34 | ### y
35 |
36 | • **y**: *number*
37 |
38 | ___
39 |
40 | ### z
41 |
42 | • **z**: *number*
43 |
--------------------------------------------------------------------------------
/scripts/height_noise.lua:
--------------------------------------------------------------------------------
1 | -- This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | local noise_brush = brush("Height Noise")
3 |
4 | local algo = noise_brush:add_string_tag("Algorithm","HgANAAUAAAAAAABAEAAAAAA/CAAAAACAPwAAAAA/AAAAAAABEwBI4RpAGwANAAMAAAAAAABACAAAAAAAPwAAAAAAAI/C9Tw=")
5 | local seed = noise_brush:add_string_tag("Seed","noggit")
6 | local frequency = noise_brush:add_real_tag("Frequency",0.0005,1.0,0.001,5)
7 | local amplitude = noise_brush:add_real_tag("Amplitude",1.0,1000.0,410.0,2)
8 |
9 | function noise_brush:on_left_hold(evt)
10 | local sel = select_origin(
11 | evt:pos(),
12 | evt:outer_radius(),
13 | evt:outer_radius()
14 | )
15 | local map = sel:make_noise(
16 | frequency:get(),
17 | algo:get(),
18 | seed:get()
19 | )
20 | for i,vert in pairs(sel:verts()) do
21 | local height = map:get(
22 | vert:get_pos()
23 | ) * amplitude:get()
24 | vert:set_height(height)
25 | end
26 | sel:apply()
27 | end
--------------------------------------------------------------------------------
/scripts/image_brush.lua:
--------------------------------------------------------------------------------
1 | -- This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | local painter_brush = brush("Image Painter")
3 | local image_path = painter_brush:add_string_tag("Filename", "")
4 |
5 | function painter_brush:on_left_click(evt)
6 | local img = load_png(
7 | image_path:get()
8 | )
9 | local origin = evt:pos()
10 | local width = img:width()
11 | local height = img:height()
12 | local half_width = width / 2
13 | local half_height = height / 2
14 | local sel = select_origin(origin, width, height)
15 |
16 | for i,vert in pairs(sel:verts()) do
17 | local angle = cam_yaw() - 90
18 | local pos = rotate_2d(
19 | vert:get_pos(),
20 | origin,
21 | angle
22 | )
23 | local local_x = round((pos.x - origin.x) + half_width)
24 | local local_z = round((pos.z - origin.z) + half_height)
25 |
26 | if local_x >= 0
27 | and local_x < width
28 | and local_z >= 0
29 | and local_z < height
30 | and img:get_alpha(local_x,local_z)>0.5 then
31 | local red = img:get_red(local_x, local_z)
32 | local green = img:get_green(local_x, local_z)
33 | local blue = img:get_blue(local_x, local_z)
34 | vert:set_color(red, green, blue)
35 | end
36 | end
37 | sel:apply()
38 | end
--------------------------------------------------------------------------------
/scripts/texture_brush.lua:
--------------------------------------------------------------------------------
1 | local texture_brush = brush("Texture Brush")
2 | texture_brush:add_description("Description:")
3 | texture_brush:add_description("- Uses a black / white texture to paint alpha layers. ")
4 | texture_brush:add_description("- The painting is only additive at the moment,")
5 | texture_brush:add_description(" meaning it cannot paint layers from \"underneath\"")
6 | texture_brush:add_description(" another layer.")
7 |
8 | local texture = texture_brush:add_string_tag("Brush Texture", "")
9 | local pressure = texture_brush:add_real_tag("Pressure", 0, 1000, 1, 2)
10 | local index = texture_brush:add_int_tag("Texture Index", 1, 3, 1)
11 |
12 | texture_brush.on_left_hold = function(brush, evt)
13 | local image = load_png(
14 | texture:get()
15 | )
16 | local sel = select_origin(
17 | evt:pos(),
18 | evt:outer_radius(),
19 | evt:outer_radius()
20 | )
21 | procedures:paint_texture(sel,image,index:get(),pressure:get(),cam_yaw()-90)
22 | sel:apply()
23 | end
--------------------------------------------------------------------------------
/scripts/texture_printer.lua:
--------------------------------------------------------------------------------
1 | local texture_printer = brush("Texture Printer");
2 |
3 | texture_printer:add_description("Description:")
4 | texture_printer:add_description("Prints out texture paths and effect ids ")
5 | texture_printer:add_description("in the clicked chunk.")
6 | texture_printer:add_null_tag()
7 |
8 | function texture_printer:on_left_click(evt)
9 | local sel = select_origin(evt:pos(), 1, 1)
10 |
11 | for i,chunk in pairs(sel:chunks()) do
12 | if chunk:get_texture_count() == 0 then
13 | print("Chunk has no textures")
14 | end
15 |
16 | print("== Chunk Textures ==")
17 | for i=0,chunk:get_texture_count()-1 do
18 | local tex = chunk:get_texture(i)
19 | local eff = chunk:get_effect(i)
20 | print("Layer "..i..":")
21 | print(" Texture: "..tex)
22 | print(" Effect: "..eff)
23 | end
24 | print("")
25 | end
26 | end
--------------------------------------------------------------------------------
/scripts/tsconfig.json:
--------------------------------------------------------------------------------
1 | /**
2 | * This file has a working configuration to write
3 | * script brushes with TypeScriptToLua
4 | * (https://github.com/TypeScriptToLua/TypeScriptToLua)
5 | */
6 | {
7 | "compilerOptions": {
8 | "target": "es5",
9 | "module": "commonjs",
10 | "strict": true,
11 | "esModuleInterop": true,
12 | "skipLibCheck": true,
13 | "outDir": "./_tsbuild",
14 | "forceConsistentCasingInFileNames": true
15 | },
16 | "tstl": {
17 | "luaTarget": "5.1",
18 | "luaPlugins": [],
19 | "noImplicitSelf": true,
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/sql/Noggit.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `UIDs` (
2 | `MapId` int(11) NOT NULL,
3 | `UID` int(11) NOT NULL
4 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
5 |
6 | ALTER TABLE `UIDs`
7 | ADD PRIMARY KEY (`MapId`);
8 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets.repo:
--------------------------------------------------------------------------------
1 | git@github.com:bloerwald/Qt-Color-Widgets.git
2 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/qt-color-widgets/bound_color_selector.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #ifndef BOUND_COLOR_SELECTOR_HPP
23 | #define BOUND_COLOR_SELECTOR_HPP
24 |
25 | #include "qt-color-widgets/color_selector.hpp"
26 |
27 | namespace color_widgets {
28 | /**
29 | * \brief A color selector bound to a color reference
30 | * \todo Maybe this can be removed
31 | */
32 | class Q_DECL_EXPORT BoundColorSelector : public ColorSelector
33 | {
34 | Q_OBJECT
35 | private:
36 | QColor* ref;
37 | public:
38 | explicit BoundColorSelector(QColor* reference, QWidget *parent = 0);
39 |
40 | private Q_SLOTS:
41 | void update_reference(QColor);
42 | };
43 | } // namespace color_widgets
44 | #endif // BOUND_COLOR_SELECTOR_HPP
45 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/qt-color-widgets/color_delegate.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #ifndef COLOR_DELEGATE_HPP
23 | #define COLOR_DELEGATE_HPP
24 |
25 | #include
26 |
27 | namespace color_widgets {
28 |
29 | /**
30 | Delegate to use a ColorSelector in a color list
31 | */
32 | class Q_DECL_EXPORT ColorDelegate : public QAbstractItemDelegate
33 | {
34 | Q_OBJECT
35 | public:
36 | explicit ColorDelegate(QWidget *parent = 0);
37 |
38 | virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
39 | const QModelIndex &index) const Q_DECL_OVERRIDE;
40 |
41 | bool editorEvent(QEvent* event,
42 | QAbstractItemModel* model,
43 | const QStyleOptionViewItem & option,
44 | const QModelIndex & index) override;
45 |
46 | virtual QSize sizeHint(const QStyleOptionViewItem &option,
47 | const QModelIndex &index) const Q_DECL_OVERRIDE;
48 | };
49 |
50 | } // namespace color_widgets
51 |
52 | #endif // COLOR_DELEGATE_HPP
53 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/qt-color-widgets/color_list_widget.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #ifndef COLOR_LIST_WIDGET_HPP
23 | #define COLOR_LIST_WIDGET_HPP
24 |
25 | #include "qt-color-widgets/abstract_widget_list.hpp"
26 | #include "qt-color-widgets/color_wheel.hpp"
27 |
28 | namespace color_widgets {
29 |
30 | class Q_DECL_EXPORT ColorListWidget : public AbstractWidgetList
31 | {
32 | Q_OBJECT
33 |
34 | Q_PROPERTY(QList colors READ colors WRITE setColors NOTIFY colorsChanged )
35 | Q_PROPERTY(ColorWheel::DisplayFlags wheelFlags READ wheelFlags WRITE setWheelFlags NOTIFY wheelFlagsChanged)
36 |
37 | public:
38 | explicit ColorListWidget(QWidget *parent = 0);
39 | ~ColorListWidget();
40 |
41 | QList colors() const;
42 | void setColors(const QList& colors);
43 |
44 | void swap(int a, int b);
45 |
46 | void append();
47 | void setColorAt(int i, QColor const& color);
48 |
49 |
50 | ColorWheel::DisplayFlags wheelFlags() const;
51 |
52 | Q_SIGNALS:
53 | void color_added();
54 | void colorsChanged(const QList&);
55 | void wheelFlagsChanged(ColorWheel::DisplayFlags flags);
56 |
57 | public Q_SLOTS:
58 | void setWheelFlags(ColorWheel::DisplayFlags flags);
59 |
60 | private Q_SLOTS:
61 | void emit_changed();
62 | void handle_removed(int);
63 | void color_changed(int row);
64 |
65 | private:
66 | class Private;
67 | Private * const p;
68 | void append_widget(int col);
69 | };
70 |
71 | } // namespace color_widgets
72 |
73 | #endif // COLOR_LIST_WIDGET_HPP
74 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/qt-color-widgets/color_names.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #ifndef COLOR_WIDGETS_COLOR_NAMES_HPP
23 | #define COLOR_WIDGETS_COLOR_NAMES_HPP
24 |
25 | #include
26 | #include
27 |
28 | namespace color_widgets {
29 |
30 | /**
31 | * \brief Convert a string into a color
32 | *
33 | * Supported string formats:
34 | * * Short hex strings #f00
35 | * * Long hex strings #ff0000
36 | * * Color names red
37 | * * Function-like rgb(255,0,0)
38 | *
39 | * Additional string formats supported only when \p alpha is true:
40 | * * Long hex strings #ff0000ff
41 | * * Function like rgba(255,0,0,255)
42 | */
43 | QColor colorFromString(const QString& string, bool alpha = true);
44 |
45 | /**
46 | * \brief Convert a color into a string
47 | *
48 | * Format:
49 | * * If the color has full alpha: #ff0000
50 | * * If alpha is true and the color has non-full alpha: #ff000088
51 | */
52 | QString stringFromColor(const QColor& color, bool alpha = true);
53 |
54 | } // namespace color_widgets
55 | #endif // COLOR_WIDGETS_COLOR_NAMES_HPP
56 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/src/alphaback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wowdev/noggit3/28c1a0405ec12fd2a7b563c08b6a418bfc2fab23/src/external/qt-color-widgets/src/alphaback.png
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/src/bound_color_selector.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #include "qt-color-widgets/bound_color_selector.hpp"
23 |
24 | namespace color_widgets {
25 |
26 | BoundColorSelector::BoundColorSelector(QColor* reference, QWidget *parent) :
27 | ColorSelector(parent), ref(reference)
28 | {
29 | setColor(*reference);
30 | connect(this,&ColorPreview::colorChanged,this, &BoundColorSelector::update_reference);
31 | }
32 |
33 | void BoundColorSelector::update_reference(QColor c)
34 | {
35 | *ref = c;
36 | }
37 |
38 | } // namespace color_widgets
39 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/src/color_utils.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * \file
3 | *
4 | * \author Mattia Basaglia
5 | *
6 | * \copyright Copyright (C) 2013-2017 Mattia Basaglia
7 | *
8 | * This program is free software: you can redistribute it and/or modify
9 | * it under the terms of the GNU Lesser General Public License as published by
10 | * the Free Software Foundation, either version 3 of the License, or
11 | * (at your option) any later version.
12 | *
13 | * This program is distributed in the hope that it will be useful,
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | * GNU Lesser General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU Lesser General Public License
19 | * along with this program. If not, see .
20 | *
21 | */
22 | #include
23 | #include
24 |
25 | namespace color_widgets {
26 | namespace detail {
27 |
28 |
29 | inline qreal color_chromaF(const QColor& c)
30 | {
31 | qreal max = qMax(c.redF(), qMax(c.greenF(), c.blueF()));
32 | qreal min = qMin(c.redF(), qMin(c.greenF(), c.blueF()));
33 | return max - min;
34 | }
35 |
36 | inline qreal color_lumaF(const QColor& c)
37 | {
38 | return 0.30 * c.redF() + 0.59 * c.greenF() + 0.11 * c.blueF();
39 | }
40 | QColor color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha = 1 );
41 |
42 | inline QColor rainbow_lch(qreal hue)
43 | {
44 | return color_from_lch(hue,1,1);
45 | }
46 |
47 | inline QColor rainbow_hsv(qreal hue)
48 | {
49 | return QColor::fromHsvF(hue,1,1);
50 | }
51 |
52 | inline qreal color_lightnessF(const QColor& c)
53 | {
54 | return ( qMax(c.redF(),qMax(c.greenF(),c.blueF())) +
55 | qMin(c.redF(),qMin(c.greenF(),c.blueF())) ) / 2;
56 | }
57 |
58 | inline qreal color_HSL_saturationF(const QColor& col)
59 | {
60 | qreal c = color_chromaF(col);
61 | qreal l = color_lightnessF(col);
62 | if ( qFuzzyCompare(l+1,1) || qFuzzyCompare(l+1,2) )
63 | return 0;
64 | return c / (1-qAbs(2*l-1));
65 | }
66 |
67 | QColor color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha = 1 );
68 |
69 | } // namespace detail
70 | } // namespace color_widgets
71 |
--------------------------------------------------------------------------------
/src/external/qt-color-widgets/src/color_widgets.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | alphaback.png
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/glsl/cursor_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | uniform vec4 color;
5 |
6 | out vec4 out_color;
7 |
8 | void main()
9 | {
10 | out_color = color;
11 | }
12 |
--------------------------------------------------------------------------------
/src/glsl/cursor_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | uniform mat4 model_view_projection;
5 | uniform vec3 cursor_pos;
6 | uniform float radius;
7 |
8 | in vec4 position;
9 |
10 | void main()
11 | {
12 | vec3 p = cursor_pos + position.xyz * radius;
13 | gl_Position = model_view_projection * vec4(p,1.);
14 | }
15 |
--------------------------------------------------------------------------------
/src/glsl/gizmo_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in vec3 f_color;
5 |
6 | out vec4 out_color;
7 |
8 | uniform float alpha;
9 |
10 | void main()
11 | {
12 | out_color = vec4(f_color, alpha);
13 | }
14 |
--------------------------------------------------------------------------------
/src/glsl/gizmo_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in vec3 position;
5 | in vec3 color;
6 |
7 | out vec3 f_color;
8 |
9 | uniform mat4 view_projection;
10 | uniform mat4 model;
11 |
12 | void main()
13 | {
14 | gl_Position = view_projection * model * vec4(position, 1.);
15 |
16 | f_color = color;
17 | }
18 |
--------------------------------------------------------------------------------
/src/glsl/horizon_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | uniform vec3 color;
5 |
6 | out vec4 out_color;
7 |
8 | void main()
9 | {
10 | out_color = vec4(color, 1.0);
11 | }
12 |
--------------------------------------------------------------------------------
/src/glsl/horizon_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in vec4 position;
5 |
6 | uniform mat4 model_view;
7 | uniform mat4 projection;
8 |
9 | void main()
10 | {
11 | gl_Position = projection * model_view * position;
12 | }
13 |
--------------------------------------------------------------------------------
/src/glsl/liquid_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 | //todo: add fallback in case the extension isn't supported for the user
4 | #extension GL_ARB_shader_draw_parameters : require
5 |
6 | in vec4 position;
7 | in vec2 tex_coord;
8 | in float depth;
9 |
10 | uniform mat4 model_view;
11 | uniform mat4 projection;
12 | uniform mat4 transform;
13 |
14 | uniform int use_transform = int(0);
15 |
16 | out vec3 f_position;
17 | out float depth_;
18 | out vec2 tex_coord_;
19 | flat out int draw_id;
20 |
21 | void main()
22 | {
23 | f_position = position.xyz;
24 | depth_ = depth;
25 | tex_coord_ = tex_coord;
26 |
27 | if(use_transform == 1)
28 | {
29 | gl_Position = projection * model_view * transform * position;
30 | draw_id = 0;
31 | }
32 | else
33 | {
34 | gl_Position = projection * model_view * position;
35 | draw_id = gl_DrawIDARB;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/glsl/m2_box_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | uniform vec4 color;
5 |
6 | out vec4 out_color;
7 |
8 | void main()
9 | {
10 | out_color = color;
11 | }
12 |
--------------------------------------------------------------------------------
/src/glsl/m2_box_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in mat4 transform;
5 | in vec4 position;
6 |
7 | uniform mat4 model_view;
8 | uniform mat4 projection;
9 |
10 | void main()
11 | {
12 | gl_Position = projection * model_view * transform * position;
13 | }
14 |
--------------------------------------------------------------------------------
/src/glsl/m2_depth_vert.glsl:
--------------------------------------------------------------------------------
1 | #version 410 core
2 |
3 | in vec3 position;
4 | in vec2 texcoord1;
5 | in vec2 texcoord2;
6 | in mat4 transform;
7 |
8 | out vec2 uv1;
9 | out vec2 uv2;
10 |
11 | uniform mat4 view_proj;
12 |
13 | struct m2_data
14 | {
15 | vec4 mesh_color;
16 |
17 | int fog_mode;
18 | int unfogged;
19 | int unlit;
20 | int pixel_shader;
21 |
22 | mat4 tex_matrix_1;
23 | mat4 tex_matrix_2;
24 |
25 | uvec2 texture_handle_1;
26 | uvec2 pad1;
27 | uvec2 texture_handle_2;
28 | uvec2 pad2;
29 |
30 | int index_1;
31 | int index_2;
32 | ivec2 padding;
33 |
34 | float alpha_test;
35 | int tex_unit_lookup_1;
36 | int tex_unit_lookup_2;
37 | int tex_count;
38 | };
39 |
40 | uniform int index;
41 |
42 | layout (std140) uniform render_data
43 | {
44 | m2_data data[192];
45 | };
46 |
47 | void main()
48 | {
49 | gl_Position = view_proj * transform * vec4(position, 1.f);
50 |
51 | uv1 = texcoord1;
52 | uv2 = texcoord2;
53 | }
--------------------------------------------------------------------------------
/src/glsl/m2_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 |
4 | in vec4 pos;
5 | in vec3 normal;
6 | in vec2 texcoord1;
7 | in vec2 texcoord2;
8 |
9 | #ifdef instanced
10 | in mat4 transform;
11 | #else
12 | uniform mat4 transform;
13 | #endif
14 |
15 | out vec2 uv1;
16 | out vec2 uv2;
17 | out float camera_dist;
18 | out vec3 norm;
19 |
20 | uniform mat4 model_view;
21 | uniform mat4 projection;
22 |
23 | struct m2_data
24 | {
25 | vec4 mesh_color;
26 |
27 | int fog_mode;
28 | int unfogged;
29 | int unlit;
30 | int pixel_shader;
31 |
32 | mat4 tex_matrix_1;
33 | mat4 tex_matrix_2;
34 |
35 | uvec2 texture_handle_1;
36 | uvec2 pad1;
37 | uvec2 texture_handle_2;
38 | uvec2 pad2;
39 |
40 | int index_1;
41 | int index_2;
42 | ivec2 padding;
43 |
44 | float alpha_test;
45 | int tex_unit_lookup_1;
46 | int tex_unit_lookup_2;
47 | int tex_count;
48 | };
49 |
50 | uniform int index;
51 |
52 | layout (std140) uniform render_data
53 | {
54 | m2_data data[192];
55 | };
56 |
57 |
58 | // code from https://wowdev.wiki/M2/.skin#Environment_mapping
59 | vec2 sphere_map(vec3 vert, vec3 norm)
60 | {
61 | vec3 normPos = -(normalize(vert));
62 | vec3 temp = (normPos - (norm * (2.0 * dot(normPos, norm))));
63 | temp = vec3(temp.x, temp.y, temp.z + 1.0);
64 |
65 | return ((normalize(temp).xy * 0.5) + vec2(0.5));
66 | }
67 |
68 | vec2 get_texture_uv(int tex_unit_lookup, vec3 vert, vec3 norm)
69 | {
70 | if(tex_unit_lookup == 0)
71 | {
72 | return sphere_map(vert, norm);
73 | }
74 | else if(tex_unit_lookup == 1)
75 | {
76 | return (transpose(data[index].tex_matrix_1) * vec4(texcoord1, 0.0, 1.0)).xy;
77 | }
78 | else if(tex_unit_lookup == 2)
79 | {
80 | return (transpose(data[index].tex_matrix_2) * vec4(texcoord2, 0.0, 1.0)).xy;
81 | }
82 | else
83 | {
84 | return vec2(0.0);
85 | }
86 | }
87 |
88 | void main()
89 | {
90 | vec4 vertex = model_view * transform * pos;
91 |
92 | // important to normalize because of the scaling !!
93 | norm = normalize(mat3(transform) * normal);
94 |
95 | uv1 = get_texture_uv(data[index].tex_unit_lookup_1, vertex.xyz, norm);
96 | uv2 = get_texture_uv(data[index].tex_unit_lookup_2, vertex.xyz, norm);
97 |
98 | camera_dist = -vertex.z;
99 | gl_Position = projection * vertex;
100 | }
101 |
--------------------------------------------------------------------------------
/src/glsl/mfbo_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | uniform vec4 color;
5 |
6 | out vec4 out_color;
7 |
8 | void main()
9 | {
10 | out_color = color;
11 | }
12 |
--------------------------------------------------------------------------------
/src/glsl/mfbo_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in vec4 position;
5 |
6 | uniform mat4 model_view_projection;
7 |
8 | void main()
9 | {
10 | gl_Position = model_view_projection * position;
11 | }
12 |
--------------------------------------------------------------------------------
/src/glsl/particle_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 | #ifdef use_bindless
4 | #extension GL_ARB_bindless_texture : require
5 |
6 | uniform uvec2 tex_array;
7 | #else
8 | uniform sampler2DArray tex_array;
9 | #endif
10 |
11 | in vec2 f_uv;
12 | in vec4 f_color;
13 |
14 | out vec4 out_color;
15 |
16 |
17 | uniform int index_in_array;
18 |
19 | uniform float alpha_test;
20 |
21 | void main()
22 | {
23 | #ifdef use_bindless
24 | vec4 t = texture(sampler2DArray(tex_array), vec3(f_uv, index_in_array));
25 | #else
26 | vec4 t = texture(tex_array, vec3(f_uv, index_in_array));
27 | #endif
28 |
29 | if(t.a < alpha_test)
30 | {
31 | discard;
32 | }
33 |
34 | out_color = vec4(f_color.rgb * t.rgb, t.a);
35 | }
36 |
--------------------------------------------------------------------------------
/src/glsl/particle_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in mat4 transform;
5 | in vec4 position;
6 | in vec3 offset;
7 | in vec2 uv;
8 | in vec4 color;
9 |
10 | out vec2 f_uv;
11 | out vec4 f_color;
12 |
13 | uniform mat4 model_view_projection;
14 | uniform int billboard;
15 |
16 | void main()
17 | {
18 | f_uv = uv;
19 | f_color = color;
20 | if(billboard == 1)
21 | {
22 | vec4 pos = transform*position;
23 | pos.xyz += offset;
24 | gl_Position = model_view_projection * pos;
25 | }
26 | else
27 | {
28 | gl_Position = model_view_projection * transform * position;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/glsl/ribbon_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 | #ifdef use_bindless
4 | #extension GL_ARB_bindless_texture : require
5 |
6 | uniform uvec2 tex_array;
7 | #else
8 | uniform sampler2DArray tex_array;
9 | #endif
10 |
11 | in vec2 f_uv;
12 |
13 | out vec4 out_color;
14 |
15 | uniform int index_in_array;
16 | uniform vec4 color;
17 |
18 | void main()
19 | {
20 | #ifdef use_bindless
21 | vec4 t = texture(sampler2DArray(tex_array), vec3(f_uv, index_in_array));
22 | #else
23 | vec4 t = texture(tex_array, vec3(f_uv, index_in_array));
24 | #endif
25 |
26 | out_color = vec4(color.rgb * t.rgb, color.a);
27 | }
28 |
--------------------------------------------------------------------------------
/src/glsl/ribbon_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in mat4 transform;
5 | in vec4 position;
6 | in vec2 uv;
7 |
8 | out vec2 f_uv;
9 |
10 | uniform mat4 model_view_projection;
11 |
12 | void main()
13 | {
14 | f_uv = uv;
15 | gl_Position = model_view_projection * transform * position;
16 | }
17 |
--------------------------------------------------------------------------------
/src/glsl/shadow_frag.glsl:
--------------------------------------------------------------------------------
1 | #version 410 core
2 |
3 | in vec3 f_position;
4 | in vec4 f_light_position;
5 | in vec3 f_normal;
6 |
7 | uniform sampler2DShadow depth_texture;
8 | uniform vec3 light_dir;
9 |
10 | out vec4 shadow;
11 |
12 | void main()
13 | {
14 | vec3 proj_coords = (f_light_position.xyz / f_light_position.w) * 0.5 + 0.5;
15 | float shadow_bias = 0.0001;
16 | float bias = max(shadow_bias * (1.0 - dot(f_normal, light_dir)), shadow_bias);
17 |
18 | proj_coords.z -= bias;
19 |
20 | // shadow outside the light's frustrum
21 | if (proj_coords.z > 1.0)
22 | {
23 | shadow = vec4(0., 0., 0., 1.);
24 | }
25 | else
26 | {
27 | float closest_depth = texture(depth_texture, proj_coords.xyz);
28 | shadow = vec4(1. - closest_depth, 0., 0., 1.);
29 | }
30 | }
--------------------------------------------------------------------------------
/src/glsl/shadow_vert.glsl:
--------------------------------------------------------------------------------
1 | #version 410 core
2 |
3 | in vec3 position;
4 | in vec3 normal;
5 |
6 | out vec3 f_position;
7 | out vec4 f_light_position;
8 | out vec3 f_normal;
9 |
10 | uniform mat4 view_proj;
11 | uniform mat4 light_view_proj;
12 |
13 | void main()
14 | {
15 | gl_Position = view_proj * vec4(position, 1.f);
16 |
17 | f_position = position;
18 | f_light_position = light_view_proj * vec4(position, 1.);
19 | f_normal = normal;
20 | }
--------------------------------------------------------------------------------
/src/glsl/terrain_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 |
4 | in vec3 position;
5 | in vec3 normal;
6 | in vec3 mccv;
7 | in vec2 texcoord;
8 |
9 | uniform mat4 mvp;
10 |
11 | out vec3 vary_position;
12 | out vec2 vary_texcoord;
13 | out vec3 vary_normal;
14 | out vec3 vary_mccv;
15 |
16 |
17 | flat out int chunk_id;
18 |
19 | void main()
20 | {
21 | gl_Position = mvp * vec4(position, 1.0);
22 | vary_normal = normal;
23 | vary_position = position;
24 | vary_texcoord = texcoord;
25 | vary_mccv = mccv;
26 |
27 | chunk_id = gl_VertexID / 145;
28 | }
29 |
--------------------------------------------------------------------------------
/src/glsl/wmo_depth_frag.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 |
4 | #ifdef use_bindless
5 | #extension GL_ARB_bindless_texture : require
6 | #else
7 | uniform sampler2DArray array_0;
8 | #endif
9 |
10 |
11 |
12 |
13 | struct batch_uniforms
14 | {
15 | uvec2 texture_1;
16 | uvec2 padding_1;
17 | uvec2 texture_2;
18 | uvec2 padding_2;
19 |
20 | int texture_index_1;
21 | int texture_index_2;
22 | int use_vertex_color;
23 | int exterior_lit;
24 |
25 | int shader_id;
26 | int unfogged;
27 | int unlit;
28 | float alpha_test;
29 | };
30 |
31 |
32 | flat in int index;
33 |
34 | layout (std140) uniform render_data
35 | {
36 | batch_uniforms data[96];
37 | };
38 |
39 | in vec2 f_texcoord;
40 |
41 | void main()
42 | {
43 | vec4 out_color;
44 |
45 | #ifdef use_bindless
46 | vec4 tex = texture(sampler2DArray(data[index].texture_1), vec3(f_texcoord, data[index].texture_index_1));
47 | #else
48 | vec4 tex = texture(array_0, vec3(f_texcoord, data[index].texture_index_1));
49 | #endif
50 |
51 | int shader = data[index].shader_id;
52 |
53 | // only those shaders use the texture for alpha testing
54 | if((shader == 1 || shader == 2) && (tex.a < data[index].alpha_test))
55 | {
56 | discard;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/glsl/wmo_depth_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 410 core
3 |
4 | in vec4 position;
5 | in vec2 uv1;
6 | in int id;
7 |
8 | in mat4 transform;
9 |
10 | out vec2 f_texcoord;
11 |
12 | flat out int index;
13 |
14 | uniform mat4 view_proj;
15 |
16 | struct batch_uniforms
17 | {
18 | uvec2 texture_1;
19 | uvec2 padding_1;
20 | uvec2 texture_2;
21 | uvec2 padding_2;
22 |
23 | int texture_index_1;
24 | int texture_index_2;
25 | int use_vertex_color;
26 | int exterior_lit;
27 |
28 | int shader_id;
29 | int unfogged;
30 | int unlit;
31 | float alpha_test;
32 | };
33 |
34 |
35 | layout (std140) uniform render_data
36 | {
37 | batch_uniforms data[96];
38 | };
39 |
40 | void main()
41 | {
42 | index = id;
43 | f_texcoord = uv1;
44 |
45 | gl_Position = view_proj * transform * position;
46 | }
47 |
--------------------------------------------------------------------------------
/src/glsl/wmo_vert.glsl:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 | #version 330 core
3 |
4 | in vec4 position;
5 | in vec3 normal;
6 | in vec4 color;
7 | in vec2 uv1;
8 | in vec2 uv2;
9 | in int id;
10 |
11 | in mat4 transform;
12 |
13 | out vec3 f_position;
14 | out vec3 f_normal;
15 | out vec2 f_texcoord;
16 | out vec2 f_texcoord_2;
17 | out vec4 f_vertex_color;
18 | flat out int index;
19 |
20 | uniform mat4 model_view;
21 | uniform mat4 projection;
22 |
23 | struct batch_uniforms
24 | {
25 | uvec2 texture_1;
26 | uvec2 padding_1;
27 | uvec2 texture_2;
28 | uvec2 padding_2;
29 |
30 | int texture_index_1;
31 | int texture_index_2;
32 | int use_vertex_color;
33 | int exterior_lit;
34 |
35 | int shader_id;
36 | int unfogged;
37 | int unlit;
38 | float alpha_test;
39 | };
40 |
41 |
42 | layout (std140) uniform render_data
43 | {
44 | batch_uniforms data[96];
45 | };
46 |
47 | void main()
48 | {
49 | index = id;
50 | vec4 pos = transform * position;
51 | vec4 view_space_pos = model_view * pos;
52 | gl_Position = projection * view_space_pos;
53 |
54 | f_position = pos.xyz;
55 | f_normal = mat3(transform) * normal;
56 |
57 | // Env and EnvMetal
58 | if(data[index].shader_id == 3 || data[index].shader_id == 5)
59 | {
60 | f_texcoord = uv1;
61 | f_texcoord_2 = reflect(normalize(view_space_pos.xyz), f_normal).xy;
62 | }
63 | else
64 | {
65 | f_texcoord = uv1;
66 | f_texcoord_2 = uv2;
67 | }
68 |
69 | f_vertex_color = color;
70 | }
71 |
--------------------------------------------------------------------------------
/src/math/bounding_box.cpp:
--------------------------------------------------------------------------------
1 | // This file is part of Noggit3, licensed under GNU General Public License (version 3).
2 |
3 | #include