Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
games:WorldForge
mercator
_service:obs_scm:mercator-1701611098.a02d15f.ob...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:mercator-1701611098.a02d15f.obscpio of Package mercator
07070100000000000041ED000000000000000000000003656C865A00000000000000000000000000000000000000000000002400000000mercator-1701611098.a02d15f/.github07070100000001000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000002E00000000mercator-1701611098.a02d15f/.github/workflows07070100000002000081A4000000000000000000000001656C865A000008E7000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/.github/workflows/cmake.ymlname: Build all on: workflow_dispatch: push: branches: - master env: CONAN_REVISIONS_ENABLED: 1 CONAN_SCM_TO_CONANDATA: 1 CONAN_PASSWORD: ${{ secrets.CONAN_PASSWORD }} CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }} PROFILE_CONAN: conan-release jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: # os: [ ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022, macos-11, macos-12 ] os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12 ] steps: - name: Workaround preset name difference if: runner.os == 'Windows' shell: bash run: echo "PROFILE_CONAN=conan-default" >> $GITHUB_ENV - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.9' cache: 'pip' - name: Install Conan shell: bash run: | pip install -r .github/workflows/requirements.txt conan profile detect #Set the default profile to use g++ 17 it it's not detected sed -i.backup 's/compiler.cppstd=gnu14/compiler.cppstd=gnu17/g' ~/.conan2/profiles/default conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan - name: Have Conan install packages shell: bash run: | conan install tools/conan -pr default --build=missing --update - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system shell: bash run: cmake --preset $PROFILE_CONAN . -DBUILD_TESTING=ON - name: Build shell: bash run: cmake --build --preset $PROFILE_CONAN --parallel - name: Test shell: bash run: ctest --preset $PROFILE_CONAN --output-on-failure --parallel - name: Upload artifacts shell: bash run: | if [[ x"$CONAN_PASSWORD" != "x" && x"$CONAN_LOGIN_USERNAME" != "x" ]]; then echo "Creating and uploading Conan artifacts" conan remote login worldforge $CONAN_LOGIN_USERNAME -p $CONAN_PASSWORD conan create tools/conan -pr default conan upload "*" -r worldforge -c fi 07070100000003000081A4000000000000000000000001656C865A00000005000000000000000000000000000000000000003F00000000mercator-1701611098.a02d15f/.github/workflows/requirements.txtconan07070100000004000081A4000000000000000000000001656C865A000001FF000000000000000000000000000000000000002700000000mercator-1701611098.a02d15f/.gitignore*.la *.lo *.o *.a *.gcda *.gcno *.gcov .*.swp config.* default.apspec mercator-0.3.pc mercator.spec mingw32-mercator.spec stamp-h1 tests/mercatortest tests/*test tests/*.log tests/timeSeg tests/testPhys tests/testQRNG tests/testWFMath tests/Segmentperf # Ignore temporary files *~ # Ignore desktop files .directory # ignore Eclipse project files .project .cproject .settings .cdtconfig* *.orig *.log *.kdevelop #Report generated by the ABI checker tool abi_report .idea cmake-build-* build CMakeUserPresets.json07070100000005000081A4000000000000000000000001656C865A000001D3000000000000000000000000000000000000002500000000mercator-1701611098.a02d15f/.mailmapErik Ogenvik <erik@ogenvik.org> Erik Hjortsberg <erik.hjortsberg@iteam.se> Erik Ogenvik <erik@ogenvik.org> Erik Hjortsberg <erik.hjortsberg@gmail.com> Alistair Riddoch <alriddoch@googlemail.com> Al Riddoch <alriddoch@googlemail.com> Alistair Riddoch <alriddoch@googlemail.com> Al Riddoch <alriddoch@google.com> Alistair Riddoch <alriddoch@googlemail.com> Al Riddoch <alriddoch@localhost> Simon Goodall <simon@simongoodall.co.uk> Simon Goodall <simon@worldforge.org> 07070100000006000081A4000000000000000000000001656C865A000006FE000000000000000000000000000000000000002800000000mercator-1701611098.a02d15f/.travis.ymllanguage: cpp jobs: include: # - os: linux # dist: bionic # compiler: clang - os: linux dist: bionic compiler: gcc - os: linux dist: focal compiler: clang - os: linux dist: focal compiler: gcc - os: osx osx_image: xcode10.2 compiler: clang addons: apt: packages: - ccache - python3-pip - doxygen - graphviz homebrew: packages: - xz - ccache - python3 env: global: - CONAN_V2_MODE=1 - CONAN_REVISIONS_ENABLED=1 - CONAN_SCM_TO_CONANDATA=1 cache: - pip - ccache - directories: - $HOME/Library/Caches/Homebrew before_install: - sudo pip3 install --upgrade pip wheel setuptools jinja2 - sudo pip3 install --upgrade conan - conan --version - conan user - conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan script: - mkdir build && cd build - conan profile new default --detect - | if [[ "$TRAVIS_OS_NAME" != "osx" && "$CXX" == "clang++" ]]; then echo "Setting libc to use C++11 features" conan profile update settings.compiler.libcxx=libstdc++11 default fi - conan install ../tools/conan -pr default --build=missing --update - cmake -DBUILD_SHARED_LIBS=OFF .. || travis_terminate 1 - make || travis_terminate 1 - make check || travis_terminate 1 # - if [ "$TRAVIS_OS_NAME" != "osx" -a "$CC" == "gcc" ]; then make dox; fi - | if [[ x"$CONAN_PASSWORD" != "x" && x"$CONAN_LOGIN_USERNAME" != "x" ]]; then echo "Creating and uploading Conan artifacts" conan user -p $CONAN_PASSWORD -r worldforge $CONAN_LOGIN_USERNAME conan create ../tools/conan worldforge/testing -pr default conan upload "*" -r worldforge -c --all fi 07070100000007000081A4000000000000000000000001656C865A00000117000000000000000000000000000000000000002400000000mercator-1701611098.a02d15f/AUTHORSTerrain Algorithm Design: Munin Damien McGinnes <mcginnes at netspeed.com.au> Al Riddoch <alriddoch@googlemail.com> Software Engineering: Al Riddoch <alriddoch@googlemail.com> Damien McGinnes <mcginnes at netspeed.com.au> Erik Ogenvik <erik@ogenvik.org> 07070100000008000081A4000000000000000000000001656C865A00001A41000000000000000000000000000000000000002B00000000mercator-1701611098.a02d15f/CMakeLists.txtcmake_minimum_required(VERSION 3.12) project(mercator) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED on) include(GNUInstallDirs) include(FindPkgConfig) include(CheckIncludeFile) # Version setup set(VERSION_MAJOR 0) set(VERSION_MINOR 4) set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SUFFIX -${VERSION_MAJOR}.${VERSION_MINOR}) set(ABI_CURRENT 0) set(ABI_REVISION 0) set(ABI_AGE 0) math(EXPR SOVERSION ${ABI_CURRENT}-${ABI_AGE}) set(ABI_VERSION ${SOVERSION}.${ABI_AGE}.${ABI_REVISION}) option(BUILD_TESTING "Should tests always be built; otherwise they will be built when the 'check' target is executed." OFF) option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static." ON) # Set compiler flags if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(WF_WARNING_FLAGS /W3) add_definitions(-D_WIN32_WINNT=0x0601) #target Windows 7 else () set(WF_WARNING_FLAGS -Wall -Winit-self -Wcast-qual -Wwrite-strings -Wextra -Wundef -Wmissing-declarations -Wno-unused-parameter -Wshadow -Wno-missing-field-initializers -Wno-long-long) endif () include_directories("${PROJECT_SOURCE_DIR}/src") # Meta data set(DESCRIPTION "A terrain generation library for the Worldforge system.") find_package(wfmath 1.0.3 REQUIRED) # This macro defines a library macro(wf_add_library _LIB_NAME _SOURCE_FILES_VAR _HEADER_FILES_VAR) add_library(${_LIB_NAME} ${${_SOURCE_FILES_VAR}}) set_target_properties(${_LIB_NAME} PROPERTIES VERSION ${ABI_VERSION} SOVERSION ${SOVERSION} ) target_compile_options(${_LIB_NAME} PUBLIC ${WF_WARNING_FLAGS}) target_include_directories(${_LIB_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" ) install(TARGETS ${_LIB_NAME} EXPORT "${PROJECT_NAME}Targets" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) #We would want to use the FILE_SET feature, but that requires CMake 3.23, which prevents us from currently building # Snap packages (as of 2023-02-12). Instead we'll copy each include file. #When distros catch up to more recent CMake versions we can use FILE_SET instead. foreach (file ${${_HEADER_FILES_VAR}}) get_filename_component(dir ${file} DIRECTORY) install(FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${dir}) endforeach () endmacro() # pkg-config files configure_file("tools/${PROJECT_NAME}.pc.in" "${PROJECT_NAME}.pc" @ONLY) install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # Add test enable_testing() # Add a "check" target, which builds and runs the tests. add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) #Macro for adding a test. The test name will be extracted from the name of the first submitted file. #Additional files can be submitted as varargs. macro(wf_add_test TEST_FILE) get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE) # If BUILD_TESTING is defined we'll build the test no matter what. This makes it work better on Windows. if (BUILD_TESTING) add_executable(${TEST_NAME} ${TEST_FILE} ${ARGN}) else (BUILD_TESTING) add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_FILE} ${ARGN}) endif (BUILD_TESTING) target_link_libraries(${TEST_NAME} "${PROJECT_NAME}") target_compile_options(${TEST_NAME} PUBLIC "-w") add_test(NAME ${TEST_NAME} COMMAND $<TARGET_FILE:${TEST_NAME}>) #We need to tell adjust the path so tests on windows can find the .dll files. SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/bin;$ENV{PATH}") add_dependencies(check ${TEST_NAME}) endmacro() add_subdirectory(src) add_subdirectory(tests) # Doxygen support, exports a "dox" target. find_package(Doxygen) set(DOXYGEN_INPUT src/Mercator) configure_file(docs/Doxyfile.in Doxyfile @ONLY) if (DOXYGEN_FOUND) set(DOXYGEN_INPUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) set(DOXYGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/docs) add_custom_command( OUTPUT ${DOXYGEN_OUTPUT} COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..." COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${DOXYGEN_INPUT} ) add_custom_target(dox DEPENDS ${DOXYGEN_OUTPUT}) endif (DOXYGEN_FOUND) add_custom_command( OUTPUT ChangeLog COMMAND ${CMAKE_SOURCE_DIR}/support/generate-ChangeLog.sh ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR} 8bd480b053190ffde2afe33af66f484953036f5a ) add_custom_target(changelog DEPENDS ChangeLog) # CMake config files include(CMakePackageConfigHelpers) install(EXPORT "${PROJECT_NAME}Targets" FILE "${PROJECT_NAME}Targets.cmake" NAMESPACE "${PROJECT_NAME}::" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" ) configure_package_config_file(tools/Config.cmake.in ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR) write_basic_package_version_file( ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake VERSION ${VERSION} COMPATIBILITY ExactVersion) install(FILES ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake ${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) # Packaging (for source tarballs set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${DESCRIPTION}) set(CPACK_PACKAGE_VENDOR "Worldforge") set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") #set(CPACK_INSTALL_SCRIPT "sh ${CMAKE_SOURCE_DIR}/support/generate-ChangeLog.sh ${CMAKE_SOURCE_DIR} ${CPACK_PACKAGE_INSTALL_DIRECTORY} 8bd480b053190ffde2afe33af66f484953036f5a") set(CPACK_SOURCE_GENERATOR TBZ2 ZIP) set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}" CACHE INTERNAL "tarball basename") set(CPACK_SOURCE_IGNORE_FILES # no hidden files "/\\\\..+$" "~$" ) include(CPack) 07070100000009000081A4000000000000000000000001656C865A000046AC000000000000000000000000000000000000002400000000mercator-1701611098.a02d15f/COPYING GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. 0707010000000A000081A4000000000000000000000001656C865A00000123000000000000000000000000000000000000002600000000mercator-1701611098.a02d15f/ChangeLogThis file is autogenerated from the Git history when a the "dist" make target is invoked. If you find this file in an official release something has gone wrong and you should contact erik@ogenvik.org. It needs to be exactly one line long in order for the ChangeLog generating script to work.0707010000000B000081A4000000000000000000000001656C865A000003B5000000000000000000000000000000000000002100000000mercator-1701611098.a02d15f/NEWS2013-08-29 Erik Ogenvik <erik@ogenvik.org> * mercator 0.3.3 released. 2012-11-08 Al Riddoch <alriddoch@googlemail.com> * mercator 0.3.2 released. 2012-07-04 Al Riddoch <alriddoch@googlemail.com> * mercator 0.3.1 released. 2011-02-13 Al Riddoch <alriddoch@googlemail.com> * mercator 0.3.0 released. 2010-11-14 Al Riddoch <alriddoch@googlemail.com> * mercator 0.2.9 released. 2010-08-19 Al Riddoch <alriddoch@googlemail.com> * mercator 0.2.8 released. 2009-02-24 Al Riddoch <alriddoch@googlemail.com> * mercator 0.2.7 released. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * mercator 0.2.6 released. 2006-08-22 Al Riddoch <alriddoch@zepler.org> * mercator 0.2.5 released. 2005-06-16 Al Riddoch <alriddoch@zepler.org> * mercator 0.2.4 released. 2005-06-11 Al Riddoch <alriddoch@zepler.org> * mercator 0.2.3 released. 2005-05-08 Al Riddoch <alriddoch@zepler.org> * mercator 0.2.2 released. 0707010000000C000081A4000000000000000000000001656C865A0000113F000000000000000000000000000000000000002600000000mercator-1701611098.a02d15f/README.md# DEPRECATED This code has been moved to [the Worldforge repository](https://github.com/worldforge/worldforge). Mercator: a procedural terrain library ====================================== [![Join us on Gitter!](https://badges.gitter.im/Worldforge.svg)](https://gitter.im/Worldforge/Lobby) [![Appveyor build status](https://ci.appveyor.com/api/projects/status/github/worldforge/mercator?branch=master&svg=true)](https://ci.appveyor.com/project/erikogenvik/mercator) [![Travis build Status](https://travis-ci.com/worldforge/mercator.svg?branch=master)](https://travis-ci.com/worldforge/mercator) [![Github build status](https://github.com/worldforge/mercator/actions/workflows/cmake.yml/badge.svg)](https://github.com/worldforge/mercator/actions/workflows/cmake.yml) Mercator is primarily aimed at terrain for multiplayer online games and forms one of the [WorldForge](http://worldforge.org/ "The main Worldforge site") core libraries. It is intended to be used as a terrain library on both the client and the server. ## Installation If you intend to build this as a prerequisite for the Ember client or the Cyphesis server we strongly suggest that you use the [Hammer](http://wiki.worldforge.org/wiki/Hammer_Script "The Hammer script") tool to compile it. This is script provided by the Worldforge project which will download and install all of the required libraries and components used by Worldforge. Alternatively you can use [Conan](https://www.conan.io) to install all dependencies. ```bash conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan conan install tools/conan --build missing cmake --preset conan-release cmake --build --preset conan-release ``` Otherwise the library can most easily be built through the following commands. ```bash mkdir build && cd build cmake .. make -j all install ``` ### Tests The test suite can be built and run using the ```check``` target. For example: ```bash make check ``` or ```bash cmake --build --preset conan-release --target check ``` ### API documentation If Doxygen is available API documentation can be generated using the ```dox``` target. For example: ```bash make dox ``` or ```bash cmake --build --preset conan-release --target dox ``` ## Design Mercator is designed in such a way that individual tiles can be generated on-the-fly from a very small source data set. Each tile uses a fast deterministic random number generation to ensure that identical results are produced "anytime, anywhere". This enables transmission of terrain across low bandwidth links as part of the standard data stream, or server side collision detection with the same terrain that the player sees. The use of tiles means that there is inherently a large degree of gross control of the shape of the terrain. Finer control is implemented by allowing geometric modifications - for example, a polygonal area might be flattened, or a crater could be applied. ### Height generation * uses deterministic random number generation and seeds to generate detailed terrain from sparse control points. * each tile is seeded using the four surrounding control points * shape of each tile is influenced by height, roughness and falloff parameters ### Height Modifications * geometric modifications can be applied for small features * new types of modifications can be added quite easily ### Shading * generate shading information based on height and gradient * new types of shaders can be added quite easily * used on the client side ### Collision basic terrain intersection/collision functions are implemented for * bbox * point * ray ### Vegetation Basic support for generation of forests in much the same way as terrain. Forest shape (polygonal) is supported Tree location, orientation and height are generated from a random seed. Currently incomplete and has hardcoded parameters ### Current Limitations * multiple resolutions in the one terrain are unsupported ## How to help If you're interested in helping out with development you should check out these resources: * [The main Worldforge site](http://worldforge.org/ "The main Worldforge site") * [Bugs and feature planning on Launchpad](https://launchpad.net/mercator "Mercator Launchpad entry") * [Gitter conversation](https://gitter.im/Worldforge/Lobby "Gitter conversation") * [Mailing lists](http://mail.worldforge.org/lists/listinfo/ "Mailing lists") 0707010000000D000081A4000000000000000000000001656C865A00000CF8000000000000000000000000000000000000002100000000mercator-1701611098.a02d15f/TODOCan pulling out the matissa and exponent give us a bit more predictability with seeding? Use template metaprogs to provide a general solution for visiting every point in a segment that intersects with an area. Why are HEIGHT, ROUGHNESS and FALLOFF referenced outside Basepoint? Consider if Segment::m_xRef could become a float and multiply by m_res on initialisation, as it is always used this way. In Terrain::getHeightAndNormal, the calculation for values passed to Segment::get() needs to be checked. Its seems to result in strange values being passed. Kick James repeatedly in the head for using .count() and [] to check then modify maps. Think carefully about whether Surface needs a writable reference to Segment. Add checks for making sure that mods get applied to segments as the segments are created. * Implement the constructors which take a Shader::Paramters. * How about a class for handling building sections of arbitrary size. Uses quasi random techniques to define the pattern of building elements, with hopefully an efficient way to render. * SHould probably make segment etc. less involved in memory, and provide a way for the memory to be special * Look at using allocators to control memory allocation for buffers. * Make SnowShader, High, with thinner snow on steep areas, and more snow on the north, * Make GrassShader, banded, with thinner grass on steep areas, * Mercator should handle weather, vegetation, maybe even houses * Delete all the leaked surfaces and shaders. * Devise some way so that FillShader surfaces don't need a shaded surface, as they can just use a constant color. * Add threshold shaders. Add an underwater shader which colors the sea bed according to its depth. * Try and do something smarter with Segment texCoords and lineIndeces, as they are the same for every segment, but recalculated every time. * Re-work code to use 2D arrays for 2D data - AJR * a sea level? multiple sea levels? * include Munins texture blending model * a cache that dynamically creates Segments when they are requested and deallocates based on a rule such as LRU * allow for non fractal tiles (hand drawn ones inserted into the landscape) ?? * variable detail? (32, 64 and 128 side tiles on the same terrain?) unsure how this fits in with the RNG scheme, so this might be difficult. a tile of side 2^n must butt up against tile of size 2^n-1, 2^n or 2^n+1. ie 32 cant interact with a 128 * transparent patches? allowing caves, or tunnels? DONE TODOs ========== * allow local terrain deformation: -subtraction eg of a sphere to make a crater - DONE dpm -addition eg of a cylindroid to make a mesa - DONE dpm -set all heights within a polygon to one value (level ground on which to build) - DONE dpm * move some of the stage terrain code into mercator - normal/height calcs - DONE dpm - axisbox intersect - DONE dpm - ray intersect - DONE dpm * The semantics of Terrain::get() were not as I expected. I wanted an interpolated value. Should another function be added to do what I want, plus get the normal too, as it seems to be free? - DONE * Need to fix normals along edge and corner point. Currently they create visible seems because they are not the same on adjacent segments. -DONE * variable roughness. DONE dpm 0707010000000E000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000002100000000mercator-1701611098.a02d15f/docs0707010000000F000081A4000000000000000000000001656C865A0001A692000000000000000000000000000000000000002D00000000mercator-1701611098.a02d15f/docs/Doxyfile.in# Doxyfile 1.8.15 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the configuration # file that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = @PROJECT_NAME@ # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = @VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "@DESCRIPTION@" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and # will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. # The default value is: NO. CREATE_SUBDIRS = # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, # Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = # The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all generated output in the proper direction. # Possible values are: None, LTR, RTL and Context. # The default value is: None. OUTPUT_TEXT_DIRECTION = # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = NO # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:\n" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert # newlines (in the resulting output). You can put ^^ in the value part of an # alias to insert a newline as if a physical newline was in the original file. # When you need a literal { or } or , in the value part of an alias you have to # escape them by means of a backslash (\), this can lead to conflicts with the # commands \{ and \} for these it is advised to use the version @{ and @} or use # a double escape (\\{ and \\}) ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding "class=itcl::class" # will allow you to use the command class in the itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = # Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice # sources only. Doxygen will then generate output that is more tailored for that # language. For instance, namespaces will be presented as modules, types will be # separated into more groups, etc. # The default value is: NO. OPTIMIZE_OUTPUT_SLICE = # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, Javascript, # Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, # Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the # default for Fortran type files), VHDL, tcl. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is # Fortran), use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 0. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # (class|struct|union) declarations. If set to NO, these declarations will be # included in the documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if <section_label> ... \endif and \cond <section_label> # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = NO # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some parameters # in a documented function, or documenting parameters that don't exist or using # markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete # parameter documentation, but not about the absence of documentation. If # EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. # The default value is: NO. WARN_AS_ERROR = # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # The default value is: $file:$line: $text. WARN_FORMAT = # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). WARN_LOGFILE = @CMAKE_CURRENT_BINARY_DIR@/doxygen-errors.log #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = @PROJECT_SOURCE_DIR@/docs \ @PROJECT_SOURCE_DIR@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. INPUT_ENCODING = # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, # *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = YES # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # <filter> <input-file> # # where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in # which the alphabetical index list will be split. # Minimum value: 1, maximum value: 20, default value: 5. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored # while generating the index headers. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). For an example see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use grayscales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via Javascript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML # page. Disable this option to support browsers that do not have Javascript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_MENUS = # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: https://developer.apple.com/xcode/), introduced with OSX # 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the master .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the # generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine-tune the look of the index. As an example, the default style # sheet generated by doxygen has an example that shows how to put an image at # the root of the tree instead of the PROJECT_NAME. Since the tree basically has # the same information as the tab index, you could consider setting # DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = # Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # # Note that when changing this option you need to delete any form_*.png files in # the HTML output directory before the changes have effect. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: # http://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. # The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use <access key> + S # (what the <access key> is depends on the OS and browser, but it is typically # <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down # key> to jump into the search results window, the results can be navigated # using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel # the search. The filter options can be selected when the cursor is inside the # search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> # to select a filter and <Enter> or <escape> to activate or cancel the filter # option. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. SEARCHENGINE = # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing # and searching needs to be provided by external tools. See the section # "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. SERVER_BASED_SEARCH = # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain the # search results. # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH = # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will return the search results when EXTERNAL_SEARCH is enabled. # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library # Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. # The default file is: searchdata.xml. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHDATA_FILE = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. # This tag requires that the tag SEARCHENGINE is set to YES. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of # to a relative location where the documentation can be found. The format is: # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... # This tag requires that the tag SEARCHENGINE is set to YES. EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. # The default value is: YES. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: latex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_OUTPUT = # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # # Note that when not enabling USE_PDFLATEX the default is latex when enabling # USE_PDFLATEX the default is pdflatex and when in the later case latex is # chosen this is overwritten by pdflatex. For specific output languages the # default can have been set differently, this depends on the implementation of # the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. # Note: This tag is used in the Makefile / make.bat. # See also: LATEX_MAKEINDEX_CMD for the part in the generated output file # (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = # The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to # generate index for LaTeX. # Note: This tag is used in the generated output file (.tex). # See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. # The default value is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_MAKEINDEX_CMD = # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. COMPACT_LATEX = # The PAPER_TYPE tag can be used to set the paper type that is used by the # printer. # Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x # 14 inches) and executive (7.25 x 10.5 inches). # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. PAPER_TYPE = # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. The package can be specified just # by its name or with the correct syntax as to be used with the LaTeX # \usepackage command. To get the times font for instance you can specify : # EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} # To use the option intlimits with the amsmath package you can specify: # EXTRA_PACKAGES=[intlimits]{amsmath} # If left blank no extra packages will be included. # This tag requires that the tag GENERATE_LATEX is set to YES. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the # generated LaTeX document. The header should contain everything until the first # chapter. If it is left blank doxygen will generate a standard header. See # section "Doxygen usage" for information on how to let doxygen write the # default header to a separate file. # # Note: Only use a user-defined header if you know what you are doing! The # following commands have a special meaning inside the header: $title, # $datetime, $date, $doxygenversion, $projectname, $projectnumber, # $projectbrief, $projectlogo. Doxygen will replace $title with the empty # string, for the replacement values of the other commands the user is referred # to HTML_HEADER. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the # generated LaTeX document. The footer should contain everything after the last # chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what # special commands can be used inside the footer. # # Note: Only use a user-defined footer if you know what you are doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = # The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined # LaTeX style sheets that are included after the standard style sheets created # by doxygen. Using this option one can overrule certain style aspects. Doxygen # will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EXTRA_STYLESHEET = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the LATEX_OUTPUT output # directory. Note that the files will be copied as-is; there are no commands or # markers available. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will # contain links (just like the HTML output) instead of page references. This # makes the output suitable for online browsing using a PDF viewer. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. PDF_HYPERLINKS = # If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate # the PDF file directly from the LaTeX files. Set this option to YES, to get a # higher quality PDF documentation. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. USE_PDFLATEX = # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running # if errors occur, instead of asking the user for help. This option is also used # when generating formulas in HTML. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BATCHMODE = # If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the # index chapters (such as File Index, Compound Index, etc.) in the output. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HIDE_INDICES = # If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source # code with syntax highlighting in the LaTeX output. # # Note that which sources are shown also depends on other settings such as # SOURCE_BROWSER. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_SOURCE_CODE = # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = # If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated # page will contain the date and time when the page was generated. Setting this # to NO can help when comparing the output of multiple runs. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_TIMESTAMP = # The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) # path from which the emoji images will be read. If a relative path is entered, # it will be relative to the LATEX_OUTPUT directory. If left blank the # LATEX_OUTPUT directory will be used. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The # RTF output is optimized for Word 97 and may not look too pretty with other RTF # readers/editors. # The default value is: NO. GENERATE_RTF = YES # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: rtf. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_OUTPUT = # If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF # documents. This may be useful for small projects and may help to save some # trees in general. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. COMPACT_RTF = YES # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will # contain hyperlink fields. The RTF file will contain links (just like the HTML # output) instead of page references. This makes the output suitable for online # browsing using Word or some other Word compatible readers that support those # fields. # # Note: WordPad (write) and others do not support links. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_HYPERLINKS = YES # Load stylesheet definitions from file. Syntax is similar to doxygen's # configuration file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is # similar to doxygen's configuration file. A template extensions file can be # generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = # If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code # with syntax highlighting in the RTF output. # # Note that which sources are shown also depends on other settings such as # SOURCE_BROWSER. # The default value is: NO. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_SOURCE_CODE = #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for # classes and files. # The default value is: NO. GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. A directory man3 will be created inside the directory specified by # MAN_OUTPUT. # The default directory is: man. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_OUTPUT = # The MAN_EXTENSION tag determines the extension that is added to the generated # man pages. In case the manual section does not start with a number, the number # 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is # optional. # The default value is: .3. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_EXTENSION = # The MAN_SUBDIR tag determines the name of the directory created within # MAN_OUTPUT in which the man pages are placed. If defaults to man followed by # MAN_EXTENSION with the initial . removed. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_SUBDIR = # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it # will generate one additional man file for each entity documented in the real # man page(s). These additional files only source the real man page, but without # them the man command would be unable to find the correct page. # The default value is: NO. # This tag requires that the tag GENERATE_MAN is set to YES. MAN_LINKS = #--------------------------------------------------------------------------- # Configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that # captures the structure of the code including all documentation. # The default value is: NO. GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: xml. # This tag requires that the tag GENERATE_XML is set to YES. XML_OUTPUT = # If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to # the XML output. Note that enabling this will significantly increase the size # of the XML output. # The default value is: YES. # This tag requires that the tag GENERATE_XML is set to YES. XML_PROGRAMLISTING = # If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include # namespace members in file scope as well, matching the HTML output. # The default value is: NO. # This tag requires that the tag GENERATE_XML is set to YES. XML_NS_MEMB_FILE_SCOPE = #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- # If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files # that can be used to generate PDF. # The default value is: NO. GENERATE_DOCBOOK = # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in # front of it. # The default directory is: docbook. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. DOCBOOK_OUTPUT = # If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the # program listings (including syntax highlighting and cross-referencing # information) to the DOCBOOK output. Note that enabling this will significantly # increase the size of the DOCBOOK output. # The default value is: NO. # This tag requires that the tag GENERATE_DOCBOOK is set to YES. DOCBOOK_PROGRAMLISTING = #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an # AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures # the structure of the code including all documentation. Note that this feature # is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module # file that captures the structure of the code including all documentation. # # Note that this feature is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_PERLMOD = # If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI # output from the Perl module output. # The default value is: NO. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_LATEX = # If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely # formatted so it can be parsed by a human reader. This is useful if you want to # understand what is going on. On the other hand, if this tag is set to NO, the # size of the Perl module output will be much smaller and Perl will parse it # just the same. # The default value is: YES. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_PRETTY = # The names of the make variables in the generated doxyrules.make file are # prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful # so different doxyrules.make files included by the same Makefile don't # overwrite each other's variables. # This tag requires that the tag GENERATE_PERLMOD is set to YES. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all # C-preprocessor directives found in the sources and include files. # The default value is: YES. ENABLE_PREPROCESSING = # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be # performed. Macro expansion can be done in a controlled way by setting # EXPAND_ONLY_PREDEF to YES. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and # EXPAND_AS_DEFINED tags. # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_ONLY_PREDEF = # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SEARCH_INCLUDES = # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will be # used. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that are # defined before the preprocessor is started (similar to the -D option of e.g. # gcc). The argument of the tag is a list of macros of the form: name or # name=definition (no spaces). If the definition and the "=" are omitted, "=1" # is assumed. To prevent a macro definition from being undefined via #undef or # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The # macro definition that is found in the sources will be used. Use the PREDEFINED # tag if you want to use a different macro definition that overrules the # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have # an all uppercase name, and do not end with a semicolon. Such function macros # are typically used for boiler-plate code, and will confuse the parser if not # removed. # The default value is: YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. SKIP_FUNCTION_MACROS = #--------------------------------------------------------------------------- # Configuration options related to external references #--------------------------------------------------------------------------- # The TAGFILES tag can be used to specify one or more tag files. For each tag # file the location of the external documentation should be added. The format of # a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where loc1 and loc2 can be relative or absolute paths or URLs. See the # section "Linking to external documentation" for more information about the use # of tag files. # Note: Each tag file must have a unique name (where the name does NOT include # the path). If a tag file is not located in the directory in which doxygen is # run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create a # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. GENERATE_TAGFILE = @CMAKE_CURRENT_BINARY_DIR@/@PROJECT_NAME@.tag # If the ALLEXTERNALS tag is set to YES, all external class will be listed in # the class index. If set to NO, only the inherited external classes will be # listed. # The default value is: NO. ALLEXTERNALS = # If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed # in the modules index. If set to NO, only the current project's groups will be # listed. # The default value is: YES. EXTERNAL_GROUPS = # If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in # the related pages index. If set to NO, only the current project's pages will # be listed. # The default value is: YES. EXTERNAL_PAGES = # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of 'which perl'). # The default file (with absolute path) is: /usr/bin/perl. PERL_PATH = #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to # NO turns the diagrams off. Note that this option also works with HAVE_DOT # disabled, but it is recommended to install and use dot, since it yields more # powerful graphs. # The default value is: YES. CLASS_DIAGRAMS = # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: # http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. DIA_PATH = # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. # The default value is: YES. HIDE_UNDOC_RELATIONS = # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz (see: # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent # Bell Labs. The other options in this section have no effect if this option is # set to NO # The default value is: NO. HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of # processors available in the system. You can set it explicitly to a value # larger than 0 to get control over the balance between CPU load and processing # speed. # Minimum value: 0, maximum value: 32, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. DOT_NUM_THREADS = # When you want a differently looking font in the dot files that doxygen # generates you can specify the font name using DOT_FONTNAME. You need to make # sure dot is able to find the font, which can be done by putting it in a # standard location or by setting the DOTFONTPATH environment variable or by # setting DOT_FONTPATH to the directory containing the font. # The default value is: Helvetica. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTNAME = # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of # dot graphs. # Minimum value: 4, maximum value: 24, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTSIZE = # By default doxygen will tell dot to use the default font as specified with # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set # the path where dot can find it using this tag. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for # each documented class showing the direct and indirect inheritance relations. # Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a # graph for each documented class showing the direct and indirect implementation # dependencies (inheritance, containment, and class references variables) of the # class with other documented classes. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. COLLABORATION_GRAPH = # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for # groups, showing the direct groups dependencies. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GROUP_GRAPHS = # If the UML_LOOK tag is set to YES, doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. UML_LOOK = # If the UML_LOOK tag is enabled, the fields and methods are shown inside the # class node. If there are many fields or methods and many nodes the graph may # become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the # number of items for each type to make the size more manageable. Set this to 0 # for no limit. Note that the threshold may be exceeded by 50% before the limit # is enforced. So when you set the threshold to 10, up to 15 fields may appear, # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. # This tag requires that the tag HAVE_DOT is set to YES. UML_LIMIT_NUM_FIELDS = # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. TEMPLATE_RELATIONS = # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to # YES then doxygen will generate a graph for each documented file showing the # direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDE_GRAPH = # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing # the direct and indirect include dependencies of the file with other documented # files. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. INCLUDED_BY_GRAPH = # If the CALL_GRAPH tag is set to YES then doxygen will generate a call # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. Disabling a call graph can be # accomplished by means of the command \hidecallgraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALL_GRAPH = # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. # # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. Disabling a caller graph can be # accomplished by means of the command \hidecallergraph. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. CALLER_GRAPH = # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GRAPHICAL_HIERARCHY = # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the # dependencies a directory has on other directories in a graphical way. The # dependency relations are determined by the #include relations between the # files in the directories. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DIRECTORY_GRAPH = # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: # http://www.graphviz.org/)). # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order # to make the SVG files visible in IE 9+ (other browsers do not have this # requirement). # Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, # png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and # png:gdiplus:gdiplus. # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. DOT_IMAGE_FORMAT = # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # # Note that this requires a modern browser other than Internet Explorer. Tested # and working are Firefox, Chrome, Safari, and Opera. # Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make # the SVG files visible. Older versions of IE do not have SVG support. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. INTERACTIVE_SVG = # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile # command). # This tag requires that the tag HAVE_DOT is set to YES. DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the \mscfile # command). MSCFILE_DIRS = # The DIAFILE_DIRS tag can be used to specify one or more directories that # contain dia files that are included in the documentation (see the \diafile # command). DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the # path where java can find the plantuml.jar file. If left blank, it is assumed # PlantUML is not used or called during a preprocessing step. Doxygen will # generate a warning when it encounters a \startuml command in this case and # will not generate output for the diagram. PLANTUML_JAR_PATH = # When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a # configuration file for plantuml. PLANTUML_CFG_FILE = # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. PLANTUML_INCLUDE_PATH = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes # that will be shown in the graph. If the number of nodes in a graph becomes # larger than this value, doxygen will truncate the graph, which is visualized # by representing a node as a red box. Note that doxygen if the number of direct # children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that # the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. # Minimum value: 0, maximum value: 10000, default value: 50. # This tag requires that the tag HAVE_DOT is set to YES. DOT_GRAPH_MAX_NODES = # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs # generated by dot. A depth value of 3 means that only nodes reachable from the # root by following a path via at most 3 edges will be shown. Nodes that lay # further from the root node will be omitted. Note that setting this option to 1 # or 2 may greatly reduce the computation time needed for large code bases. Also # note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. # Minimum value: 0, maximum value: 1000, default value: 0. # This tag requires that the tag HAVE_DOT is set to YES. MAX_DOT_GRAPH_DEPTH = # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not seem # to support this out of the box. # # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_TRANSPARENT = YES # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support # this, this feature is disabled by default. # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = # If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot # files that are used to generate the various graphs. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = 07070100000010000081A4000000000000000000000001656C865A000001BF000000000000000000000000000000000000002B00000000mercator-1701611098.a02d15f/docs/index.dox/** @page index <H1>Mercator</H1> Welcome to the Mercator documentation. <H2>Links</H2> <UL> <LI><a href="http://www.worldforge.org/">The WorldForge Project</a></LI> <LI><a href="https://github.com/worldforge/mercator/">Source</a></LI> <LI><a href="http://www.worldforge.org/index.php/components/mercator/">Mercator</a></LI> </UL> <H2>Contact</H2> The current maintainer and main author for Mercator is Erik Ogenvik <erik@ogenvik.org>. */ 07070100000011000041ED000000000000000000000003656C865A00000000000000000000000000000000000000000000002000000000mercator-1701611098.a02d15f/src07070100000012000081A4000000000000000000000001656C865A00000673000000000000000000000000000000000000002F00000000mercator-1701611098.a02d15f/src/CMakeLists.txtset(SOURCE_FILES Mercator/Area.cpp Mercator/AreaShader.cpp Mercator/BasePoint.cpp Mercator/Buffer.cpp Mercator/Buffer_impl.h Mercator/DepthShader.cpp Mercator/Effector.cpp Mercator/FillShader.cpp Mercator/Forest.cpp Mercator/GrassShader.cpp Mercator/HeightMap.cpp Mercator/Intersect.cpp Mercator/Matrix.cpp Mercator/Segment.cpp Mercator/Shader.cpp Mercator/ShaderFactory.cpp Mercator/ShaderFactory_impl.h Mercator/Surface.cpp Mercator/Terrain.cpp Mercator/TerrainMod.cpp Mercator/TerrainMod_impl.h Mercator/ThresholdShader.cpp Mercator/TileShader.cpp Mercator/iround.h) set(HEADER_FILES Mercator/Area.h Mercator/AreaShader.h Mercator/BasePoint.h Mercator/Buffer.h Mercator/DepthShader.h Mercator/Effector.h Mercator/FillShader.h Mercator/Forest.h Mercator/GrassShader.h Mercator/HeightMap.h Mercator/Intersect.h Mercator/iround.h Mercator/Matrix.h Mercator/Mercator.h Mercator/Plant.h Mercator/RandCache.h Mercator/Segment.h Mercator/Shader.h Mercator/ShaderFactory.h Mercator/ShaderFactory_impl.h Mercator/Surface.h Mercator/Terrain.h Mercator/TerrainMod.h Mercator/TerrainMod_impl.h Mercator/ThresholdShader.h Mercator/TileShader.h) wf_add_library(mercator SOURCE_FILES HEADER_FILES) target_link_libraries(mercator PUBLIC wfmath::wfmath) 07070100000013000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000002900000000mercator-1701611098.a02d15f/src/Mercator07070100000014000081A4000000000000000000000001656C865A00001CF5000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/Area.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Area.h" #include "Segment.h" #include <wfmath/intersect.h> #include <iostream> #include <cmath> #include <cassert> using WFMath::CoordType; namespace Mercator { typedef WFMath::Point<2> Point2; typedef WFMath::Vector<2> Vector2; #ifndef NDEBUG static bool isZero(CoordType d) { return (std::fabs(d) < WFMath::numeric_constants<CoordType>::epsilon()); } #endif /// \brief Helper to clip points to a given range. struct TopClip { /// Constructor /// /// @param t top of y range explicit TopClip(CoordType t) : topZ(t) { } /// \brief Check a point is outside this clip. /// /// @param p point to be checked. /// @return true if p is outside the clip. bool inside(const Point2& p) const { return p.y() >= topZ; } /// \brief Determine the point where a line crosses this clip. /// /// @param u one of of a line that crosses this clip /// @param v one of of a line that crosses this clip /// @return a point where the line cross this clip. Point2 clip(const Point2& u, const Point2& v) const { CoordType dy = v.y() - u.y(); CoordType dx = v.x() - u.x(); // shouldn't every happen - if dy iz zero, the line is horizontal, // so either both points should be inside, or both points should be // outside. In either case, we should not call clip() assert(!isZero(dy)); CoordType t = (topZ - u.y()) / dy; return Point2(u.x() + t * dx, topZ); } /// \brief Top of z range. CoordType topZ; }; /// \brief Helper to clip points to a given range. struct BottomClip { /// Constructor /// /// @param t bottom of y range explicit BottomClip(CoordType t) : bottomZ(t) { } /// \brief Check a point is outside this clip. /// /// @param p point to be checked. /// @return true if p is outside the clip. bool inside(const Point2& p) const { return p.y() < bottomZ; } /// \brief Determine the point where a line crosses this clip. /// /// @param u one of of a line that crosses this clip /// @param v one of of a line that crosses this clip /// @return a point where the line cross this clip. Point2 clip(const Point2& u, const Point2& v) const { CoordType dy = v.y() - u.y(); CoordType dx = v.x() - u.x(); assert(!isZero(dy)); CoordType t = (u.y() - bottomZ) / -dy; return Point2(u.x() + t * dx, bottomZ); } /// \brief Bottom of z range. CoordType bottomZ; }; /// \brief Helper to clip points to a given range. struct LeftClip { /// Constructor /// /// @param t left of x range. explicit LeftClip(CoordType t) : leftX(t) { } /// \brief Check a point is outside this clip. /// /// @param p point to be checked. /// @return true if p is outside the clip. bool inside(const Point2& p) const { return p.x() >= leftX; } /// \brief Determine the point where a line crosses this clip. /// /// @param u one of of a line that crosses this clip /// @param v one of of a line that crosses this clip /// @return a point where the line cross this clip. Point2 clip(const Point2& u, const Point2& v) const { CoordType dy = v.y() - u.y(); CoordType dx = v.x() - u.x(); // shouldn't every happen assert(!isZero(dx)); CoordType t = (leftX - u.x()) / dx; return Point2(leftX, u.y() + t * dy); } /// \brief Left of x range. CoordType leftX; }; /// \brief Helper to clip points to a given range. struct RightClip { /// Constructor /// /// @param t right of x range. explicit RightClip(CoordType t) : rightX(t) { } /// \brief Check a point is outside this clip. /// /// @param p point to be checked. /// @return true if p is outside the clip. bool inside(const Point2& p) const { return p.x() < rightX; } /// \brief Determine the point where a line crosses this clip. /// /// @param u one of of a line that crosses this clip /// @param v one of of a line that crosses this clip /// @return a point where the line cross this clip. Point2 clip(const Point2& u, const Point2& v) const { CoordType dy = v.y() - u.y(); CoordType dx = v.x() - u.x(); // shouldn't every happen assert(!isZero(dx)); CoordType t = (u.x() - rightX) / -dx; return Point2(rightX, u.y() + t * dy); } /// \brief Right of x range. CoordType rightX; }; // FIXME Why pass Clip by value? template <class Clip> WFMath::Polygon<2> sutherlandHodgmanKernel(const WFMath::Polygon<2>& inpoly, const Clip& clipper) { WFMath::Polygon<2> outpoly; if (!inpoly.isValid()) return inpoly; std::size_t points = inpoly.numCorners(); if (points < 3) return outpoly; // i.e an invalid result Point2 lastPt = inpoly.getCorner(points - 1); bool lastInside = clipper.inside(lastPt); for (std::size_t p = 0; p < points; ++p) { Point2 curPt = inpoly.getCorner(p); bool inside = clipper.inside(curPt); if (lastInside) { if (inside) { // emit curPt outpoly.addCorner(outpoly.numCorners(), curPt); } else { // emit intersection of edge with clip line outpoly.addCorner(outpoly.numCorners(), clipper.clip(lastPt, curPt)); } } else { if (inside) { // emit both outpoly.addCorner(outpoly.numCorners(), clipper.clip(lastPt, curPt)); outpoly.addCorner(outpoly.numCorners(), curPt); } else { // don't emit anything } } // last was outside lastPt = curPt; lastInside = inside; } return outpoly; } Area::Area(int layer, bool hole) : m_layer(layer), m_hole(hole) { } void Area::setShape(const WFMath::Polygon<2>& p) { assert(p.isValid()); m_shape = p; m_box = p.boundingBox(); } bool Area::contains(CoordType x, CoordType z) const { if (!WFMath::Contains(m_box, Point2(x,z), false)) return false; return WFMath::Contains(m_shape, Point2(x,z), false); } WFMath::Polygon<2> Area::clipToSegment(const Segment& s) const { // box reject if (!checkIntersects(s)) return WFMath::Polygon<2>(); WFMath::AxisBox<2> segBox(s.getRect()); WFMath::Polygon<2> clipped = sutherlandHodgmanKernel(m_shape, TopClip(segBox.lowCorner().y())); clipped = sutherlandHodgmanKernel(clipped, BottomClip(segBox.highCorner().y())); clipped = sutherlandHodgmanKernel(clipped, LeftClip(segBox.lowCorner().x())); clipped = sutherlandHodgmanKernel(clipped, RightClip(segBox.highCorner().x())); return clipped; } bool Area::checkIntersects(const Segment& s) const { return m_shape.numCorners() && (WFMath::Intersect(m_shape, s.getRect(), false) || WFMath::Contains(s.getRect(), m_shape.getCorner(0), false)); } } // of namespace 07070100000015000081A4000000000000000000000001656C865A00000980000000000000000000000000000000000000003000000000mercator-1701611098.a02d15f/src/Mercator/Area.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifndef MERCATOR_AREA_H #define MERCATOR_AREA_H #include "Effector.h" #include <wfmath/axisbox.h> #include <wfmath/polygon.h> namespace Mercator { class Segment; class Shader; /// \brief Region of terrain surface which is modified. /// /// Objects of this class describe regions of the surface which have /// been changed. Which layers of the shaded terrain is affected by /// their layer number. For example, if they are below the snow layer /// then the snow shader will cover them where the area affected by /// snow intersects with the area, but the lower grass area will be /// overriden. In order to get the best effect it is important to /// select the layer carefully. class Area : public Effector { public: /// \brief Constructor /// /// @param layer layer number. /// @param hole flag indicating whether this is a hole. Area(int layer, bool hole); /// Set the geometric shape of this area. void setShape(const WFMath::Polygon<2>& p); /// Determine if a point is contained by the shape of this area. bool contains(WFMath::CoordType x, WFMath::CoordType z) const; /// Accessor for the layer number. int getLayer() const { return m_layer; } /// Accessor for the flag indicating whether this is a hole. bool isHole() const { return m_hole; } /// Accessor for the geometric shape. const WFMath::Polygon<2> & shape() const { return m_shape; } /** Test if a segment intersects this area */ bool checkIntersects(const Segment& s) const override; /// \brief Clip the shape of this area to a given segment. /// /// Determines the intersection of the geometric shape of this area /// with a square terrain segment, and returns the intersection as /// a geometric shape. /// @param s the segment that the shape should be clipped to. /// @returns the shape of the intersection of this area with the segment. WFMath::Polygon<2> clipToSegment(const Segment& s) const; private: /// The layer number. int m_layer; /// A flag indicating whether this is a hole. bool m_hole; /// The geometric shape. WFMath::Polygon<2> m_shape; }; } #endif // of MERCATOR_AREA_H 07070100000016000081A4000000000000000000000001656C865A00001CF1000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/src/Mercator/AreaShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "AreaShader.h" #include "Area.h" #include "iround.h" #include "Segment.h" #include "Surface.h" #include <list> #include <set> #include <iostream> #include <algorithm> #include <cmath> #include <cassert> namespace Mercator { typedef WFMath::Point<2> Point2; typedef WFMath::Vector<2> Vector2; const WFMath::CoordType ROW_HEIGHT = 1 / 4.0f; // 4x over-sample /// \brief The edge of an area. class Edge { public: /// \brief Constructor /// /// @param a one end of the line defining the edge. /// @param b one end of the line defining the edge. Edge(const Point2& a, const Point2& b) { // horizontal segments should be discarded earlier assert(a.y() != b.y()); if (a.y() < b.y()) { m_start = a; m_seg = b - a; } else { m_start = b; m_seg = a - b; } // normal gradient is y/x, here we use x/y. seg.y() will be != 0, // as we already asserted above. m_inverseGradient = m_seg.x() / m_seg.y(); } /// Accessor for the point describing the start of the edge. Point2 start() const { return m_start; } /// Determine the point describing the end of the edge. Point2 end() const { return m_start + m_seg; } /// \brief Determine the x coordinate at a given y coordinate. /// /// Calculate the x coordinate on the edge line where the y coordinate /// is the value specified. /// @param z the y coordinate where the calculation is required. WFMath::CoordType xValueAtZ(WFMath::CoordType z) const { WFMath::CoordType x = m_start.x() + ((z - m_start.y()) * m_inverseGradient); // std::cout << "edge (" << m_start << ", " << m_start + m_seg << ") at z=" << z << " has x=" << x << std::endl; return x; } /// \brief Compare the y coordinate of the start with another edge. /// /// This operator ensures that edges can be sorted, compares the y /// y coordinate of the start of the edges. bool operator<(const Edge& other) const { return m_start.y() < other.m_start.y(); } private: /// The point describing the start of the edge. Point2 m_start; /// The vector describing the edge from its start. Vector2 m_seg; /// The inverse of the gradient of the line. WFMath::CoordType m_inverseGradient; }; /// \brief The edge of an area parallel to the x axis. class EdgeAtZ { public: /// Constructor /// /// @param y coordinate on the y axis of the edge. explicit EdgeAtZ(WFMath::CoordType y) : m_y(y) {} /// Determine which edge crosses this edge at a lower x coordinate. bool operator()(const Edge& u, const Edge& v) const { return u.xValueAtZ(m_y) < v.xValueAtZ(m_y); } private: /// The coordinate on the y axis of the edge. WFMath::CoordType m_y; }; static void contribute(Surface& s, unsigned int x, unsigned int z, WFMath::CoordType amount) { unsigned int sz = s.getSize() - 1; if ((x == 0) || (x == sz)) amount *= 2; if ((z == 0) || (z == sz)) amount *= 2; s(x, z, 0) = std::min(static_cast<ColorT>(I_ROUND(amount * 255)) + s(x,z,0), 255); } static void span(Surface& s, WFMath::CoordType z, WFMath::CoordType xStart, WFMath::CoordType xEnd) { assert(xStart <= xEnd); // quantize and accumulate into the buffer data unsigned int row = I_ROUND(z), ixStart = I_ROUND(xStart), ixEnd = I_ROUND(xEnd); //std::cout << "span @ z=" << row << ", " << ixStart << " -> " << ixEnd << std::endl; if (ixStart == ixEnd) { contribute(s, ixStart, row, ROW_HEIGHT * (xEnd - xStart)); } else { contribute(s, ixStart, row, ROW_HEIGHT * (ixStart - xStart + 0.5f)); for (unsigned int i=ixStart+1; i < ixEnd; ++i) contribute(s, i, row, ROW_HEIGHT); contribute(s, ixEnd, row, ROW_HEIGHT * (xEnd - ixEnd + 0.5f)); } } static void scanConvert(const WFMath::Polygon<2>& inPoly, Surface& sf) { if (!inPoly.isValid()) return; std::list<Edge> pending; std::vector<Edge> active; Point2 lastPt = inPoly.getCorner(inPoly.numCorners() - 1); for (std::size_t p=0; p < inPoly.numCorners(); ++p) { Point2 curPt = inPoly.getCorner(p); // skip horizontal edges if (curPt.y() != lastPt.y()) pending.emplace_back(lastPt, curPt); lastPt = curPt; } if (pending.empty()) return; // sort edges by starting (lowest) z value pending.sort(); active.push_back(pending.front()); pending.pop_front(); // advance to the row of the first z value, and ensure z sits in the // middle of sample rows - we do this by offseting by 1/2 a row height // if you don't do this, you'll find alternating rows are over/under // sampled, producing a charming striped effect. WFMath::CoordType z = std::floor(active.front().start().y()) + ROW_HEIGHT * 0.5f; for (; !pending.empty() || !active.empty(); z += ROW_HEIGHT) { while (!pending.empty() && (pending.front().start().y() <= z)) { active.push_back(pending.front()); pending.pop_front(); } // sort by x value - note active will be close to sorted anyway std::sort(active.begin(), active.end(), EdgeAtZ(z)); // delete finished edges for (unsigned int i=0; i< active.size(); ) { if (active[i].end().y() <= z) active.erase(active.begin() + i); else ++i; } // draw pairs of active edges for (unsigned int i=1; i < active.size(); i += 2) span(sf, z, active[i - 1].xValueAtZ(z), active[i].xValueAtZ(z)); } // of active edges loop } AreaShader::AreaShader(int layer) : Shader(false /* no color */, true), m_layer(layer) { } bool AreaShader::checkIntersect(const Segment& s) const { const Segment::Areastore& areas(s.getAreas()); return (areas.count(m_layer) > 0); } void AreaShader::shade(Surface &s) const { ColorT * data = s.getData(); unsigned int size = s.getSegment().getSize(); unsigned int buflen = size * size; for (unsigned int i = 0; i < buflen; ++i) data[i] = 0; auto& areas = s.m_segment.getAreas(); auto it = areas.lower_bound(m_layer); auto itend = areas.upper_bound(m_layer); for (;it != itend; ++it) { // apply to surface in turn if (it->second.area->isHole()) { //TODO: shadeHole } else shadeArea(s, *it->second.area); } // of areas in layer } void AreaShader::shadeArea(Surface& s, const Area& ar) const { WFMath::Polygon<2> clipped = ar.clipToSegment(s.m_segment); assert(clipped.isValid()); if (clipped.numCorners() == 0) return; Point2 segOrigin = s.m_segment.getRect().lowCorner(); clipped.shift(Point2(0,0) - segOrigin); scanConvert(clipped, s); } } // of namespace 07070100000017000081A4000000000000000000000001656C865A0000031B000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/src/Mercator/AreaShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifndef MERCATOR_AREASHADER_H #define MERCATOR_AREASHADER_H #include "Shader.h" namespace Mercator { class Area; /// \brief Shader for handling areas. class AreaShader : public Shader { public: /// \brief Constructor /// /// @param layer layer number. explicit AreaShader(int layer); void shade(Surface &s) const override; bool checkIntersect(const Segment &) const override; private: /// helper to shader a single area into the surface void shadeArea(Surface& s, const Area& ar) const; /// The layer number. int m_layer; }; } #endif // of MERCATOR_AREASHADER_H 07070100000018000081A4000000000000000000000001656C865A000002C8000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/BasePoint.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Damien McGinnes, Alistair Riddoch #include "BasePoint.h" #include "iround.h" namespace Mercator { constexpr float BasePoint::HEIGHT; constexpr float BasePoint::ROUGHNESS; constexpr float BasePoint::FALLOFF; unsigned int BasePoint::seed() const { return I_ROUND(m_height * 1000.0); } bool BasePoint::operator==(const BasePoint& rhs) const { return rhs.m_falloff == m_falloff && rhs.m_height == m_height && rhs.m_roughness == m_roughness; } bool BasePoint::operator!=(const BasePoint& rhs) const { return !(*this == rhs); } } //namespace Mercator 07070100000019000081A4000000000000000000000001656C865A000009B1000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/BasePoint.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes, Alistair Riddoch #ifndef MERCATOR_BASE_POINT_H #define MERCATOR_BASE_POINT_H #include <iostream> namespace Mercator { /// \brief Point on the fundamental grid that is used as the basis for terrain. /// /// The terrain is defined by a sparse grid of evenly spaced points, each of /// which is defined by an instance of this class. The most fundamental /// property of each point is its elevation stored as height, as this is also /// used to seed the random number generators. Additional parameters for /// roughness and falloff are often specified. class BasePoint { private: /// The height at the base point. float m_height; /// The roughness at the base point. float m_roughness; /// The falloff at the base point. float m_falloff; public: /// Default height at the base point. static constexpr float HEIGHT = 8.0; /// Default roughness at the base point. static constexpr float ROUGHNESS = 1.25; /// Default falloff at the base point. static constexpr float FALLOFF = 0.25; /// \brief Constructor /// /// @param h height at the base point. /// @param r roughness at the base point. /// @param f falloff at the base point. explicit BasePoint(float h = HEIGHT, float r = ROUGHNESS, float f = FALLOFF) : m_height(h), m_roughness(r), m_falloff(f) {} bool operator==(const BasePoint& rhs) const; bool operator!=(const BasePoint& rhs) const; /// Accessor for the height at the base point. float height() const { return m_height; } /// Accessor for the height at the base point. float & height() { return m_height; } /// Accessor for the roughness at the base point. float roughness() const { return m_roughness; } /// Accessor for the roughness at the base point. float & roughness() { return m_roughness; } /// Accessor for the falloff at the base point. float falloff() const { return m_falloff; } /// Accessor for the falloff at the base point. float & falloff() { return m_falloff; } /// Calculate the random seed used at this base point. //unsigned int seed() const { return (unsigned int)(m_height * 1000.0);} unsigned int seed() const; }; } //namespace Mercator #endif // MERCATOR_BASE_POINT_H 0707010000001A000081A4000000000000000000000001656C865A00000139000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Buffer.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "Buffer_impl.h" namespace Mercator { template class Buffer<float>; template class Buffer<unsigned char>; } // namespace Mercator 0707010000001B000081A4000000000000000000000001656C865A00000B8B000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/Buffer.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_BUFFER_H #define MERCATOR_BUFFER_H #include <vector> namespace Mercator { /// \brief Template for managing buffers of data for a segment. template<typename DataType> class Buffer { protected: /// The number of data values per height point. const unsigned int m_channels; /// The size of segment, m_res + 1. const unsigned int m_size; /// Pointer to buffer containing data values. std::vector<DataType> m_data; public: /// \brief Constructor. /// /// @param segment terrain height segment this buffer is associated with. /// @param channels number of data values per height point. explicit Buffer(unsigned int size, unsigned int channels); virtual ~Buffer(); /// \brief Retrieve the data value at a given point. /// /// Access the data value associated with given point in the segment /// in a given channel in this buffer. /// @return a reference to the value at the point requested. DataType & operator()(unsigned int x,unsigned int y,unsigned int channel) { return m_data[(y * m_size + x) * m_channels + channel]; } /// \brief Retrieve the data value at a given point. /// /// Return the data value associated with given point in the segment /// in a given channel in this buffer. /// @return the value at the point requested. const DataType & operator()(unsigned int x, unsigned int y, unsigned int channel) const { return m_data[(y * m_size + x) * m_channels + channel]; } /// Accessor for the size of segment, m_res + 1. unsigned int getSize() const { return m_size; } /// Accessor for the number of data values per height point. unsigned int getChannels() const { return m_channels; } /// Accessor for a pointer to buffer containing data values. DataType * getData() { return m_data.data(); } /// Accessor for a pointer to buffer containing data values. const DataType * getData() const { return m_data.data(); } /// \brief Allocate the storage required by the buffer. /// /// Allocate memory based on the size and number of channels required /// by the buffer. void allocate() { m_data.resize(m_size * m_size * m_channels); } /// \brief Determine if this buffer has valid allocated storage. /// /// @return true if storage is allocated. bool isValid() const { return (!m_data.empty()); } /// \brief De-allocate the storage for this buffer. /// /// Free the storage allocate for this buffer. void invalidate() { m_data.resize(0); } }; } // namespace Mercator #endif // MERCATOR_BUFFER_H 0707010000001C000081A4000000000000000000000001656C865A000001C7000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/Buffer_impl.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "Buffer.h" namespace Mercator { template <typename DataType> Buffer<DataType>::Buffer(unsigned int size, unsigned int channels) : m_channels(channels), m_size(size) { } template <typename DataType> Buffer<DataType>::~Buffer() = default; } // namespace Mercator 0707010000001D000081A4000000000000000000000001656C865A0000094B000000000000000000000000000000000000003900000000mercator-1701611098.a02d15f/src/Mercator/DepthShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "iround.h" #include "DepthShader.h" #include "Segment.h" #include "Surface.h" #include <cmath> #include <cassert> namespace Mercator { const std::string DepthShader::key_waterLevel("waterLevel"); const std::string DepthShader::key_murkyDepth("murkyDepth"); const float DepthShader::default_waterLevel = 0.f; const float DepthShader::default_murkyDepth = -64.f; DepthShader::DepthShader(float waterLevel, float murkyDepth) : m_waterLevel(waterLevel), m_murkyDepth(murkyDepth) { } DepthShader::DepthShader(const Parameters & params) : m_waterLevel(default_waterLevel), m_murkyDepth(default_murkyDepth) { auto I = params.find(key_waterLevel); auto Iend = params.end(); if (I != Iend) { m_waterLevel = I->second; } I = params.find(key_murkyDepth); if (I != Iend) { m_murkyDepth = I->second; } } DepthShader::~DepthShader() = default; bool DepthShader::checkIntersect(const Segment & s) const { if (s.getMin() < m_waterLevel) { return true; } else { return false; } } void DepthShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); assert(channels > 0); unsigned int colors = channels - 1; ColorT * data = s.getData(); const float * height_data = s.getSegment().getPoints(); if (height_data == 0) { std::cerr << "WARNING: Mercator: Attempting to shade empty segment." << std::endl << std::flush; return; } unsigned int size = s.getSegment().getSize(); unsigned int count = size * size; int j = -1; for (unsigned int i = 0; i < count; ++i) { for (unsigned int k = 0; k < colors; ++k) { data[++j] = colorMax; } float depth = height_data[i]; if (depth > m_waterLevel) { data[++j] = colorMin; } else if (depth < m_murkyDepth) { data[++j] = colorMax; } else { data[++j] = colorMax - I_ROUND(colorMax * ((depth - m_murkyDepth) / (m_waterLevel - m_murkyDepth))); } } } } // namespace Mercator 0707010000001E000081A4000000000000000000000001656C865A000008A0000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/DepthShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_FILL_DEPTH_SHADER_H #define MERCATOR_FILL_DEPTH_SHADER_H #include "Shader.h" namespace Mercator { /// \brief Shader to give the appearance of deep murky water. /// /// Areas of terrain covered by water should be darker as less /// distinct as they get deeper. This shader adds a uniform alpha blended /// surface below water level which becomes more opaque as it gets deeper /// concealing the underlying appearance of the terrain from a viewer /// at the surface. class DepthShader : public Shader { private: /// The level of the surface of the water. float m_waterLevel; /// The depth at which the bottom becomes completely obscured. float m_murkyDepth; public: /// Key string used when specifying the water level parameter. static const std::string key_waterLevel; /// Key string used when specifying the murky depth parameter. static const std::string key_murkyDepth; /// Default level of the surface of the water. static const float default_waterLevel; /// Default depth at which the bottom becomes completely obscured. static const float default_murkyDepth; /// \brief Constructor /// /// @param waterLevel level of the surface of the water. /// @param murkyDepth depth at which the bottom becomes completely obscured. explicit DepthShader(float waterLevel = default_waterLevel, float murkyDepth = default_murkyDepth); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit DepthShader(const Parameters & params); ~DepthShader() override; /// Accessor for the level of the surface of the water. float waterLevel() const { return m_waterLevel; } /// Accessor for the depth at which the bottom becomes completely obscured. float murkyDepth() const { return m_murkyDepth; } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; } // namespace Mercator #endif // MERCATOR_FILL_DEPTH_SHADER_H 0707010000001F000081A4000000000000000000000001656C865A00000583000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/src/Mercator/Effector.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2010 Alistair Riddoch #include "Effector.h" #include <algorithm> namespace Mercator { void Effector::setContext(std::unique_ptr<Effector::Context> c) { m_context = std::move(c); } Effector::Effector() = default; // Ensure that m_context is not copied only one object can own the context Effector::Effector(const Effector & o) : m_box(o.m_box) { } // Ensure that m_context is not copied only one object can own the context Effector & Effector::operator=(const Effector & rhs) { m_box = rhs.m_box; m_context.reset(); return *this; } Effector::~Effector() = default; /// \brief Set the height point to the mod value float set(float orig, float mod) { return mod; } /// \brief Set the height point to the greater of existing and mod value float max(float orig, float mod) { return std::max(orig, mod); } /// \brief Set the height point to the lesser of existing and mod value float min(float orig, float mod) { return std::min(orig, mod); } /// \brief Set the height point to the sum of existing and mod value float sum(float orig, float mod) { return orig + mod; } /// \brief Set the height point to the difference of existing and mod value float dif(float orig, float mod) { return orig - mod; } } // of namespace 07070100000020000081A4000000000000000000000001656C865A000006C4000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Effector.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2010 Alistair Riddoch #ifndef MERCATOR_EFFECTOR_H #define MERCATOR_EFFECTOR_H #include <wfmath/axisbox.h> #include <wfmath/polygon.h> #include <string> namespace Mercator { class Segment; class Shader; /// \brief Device which effects a change in the terrain /// /// Classes which inherit from this interface change the terrain in /// some way within the region given by the box member. The exact /// shape of the area affected and the nature of the change depends /// on the subclass. class Effector { public: struct Context { std::string m_id; }; Context * context() const { return m_context.get(); } void setContext(std::unique_ptr<Context> context); /// Accessor for the bounding box of the geometric shape. const WFMath::AxisBox<2> & bbox() const { return m_box; } virtual ~Effector() = 0; virtual bool checkIntersects(const Segment& s) const = 0; protected: /// \brief Constructor Effector(); /// \brief Copy constructor Effector(const Effector &); /// \brief Assignment Effector & operator=(const Effector &); /// The bounding box of the geometric shape. WFMath::AxisBox<2> m_box; /// The application context of this effector std::unique_ptr<Context> m_context; }; /// \brief Function used to apply an effector to an existing height point typedef float (*effector_func)(float height, float mod); float set(float, float); float max(float, float); float min(float, float); float sum(float, float); float dif(float, float); } #endif // of MERCATOR_EFFECTOR_H 07070100000021000081A4000000000000000000000001656C865A00000321000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/src/Mercator/FillShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "FillShader.h" #include "Segment.h" #include "Surface.h" namespace Mercator { FillShader::FillShader() = default; FillShader::FillShader(const Parameters & params) { } FillShader::~FillShader() = default; bool FillShader::checkIntersect(const Segment &) const { return true; } void FillShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); ColorT * data = s.getData(); unsigned int size = s.getSegment().getSize(); unsigned int buflen = size * size * channels; for (unsigned int i = 0; i < buflen; ++i) { data[i] = colorMax; } } } // namespace Mercator 07070100000022000081A4000000000000000000000001656C865A0000035B000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/src/Mercator/FillShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_FILL_SHADER_H #define MERCATOR_FILL_SHADER_H #include "Shader.h" namespace Mercator { /// \brief Shader that fills the surface. /// /// This shader is typically only used for the lowest possible layer, /// which is usually bed rock. class FillShader : public Shader { public: /// \brief Constructor explicit FillShader(); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit FillShader(const Parameters & params); ~FillShader() override; bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; } // namespace Mercator #endif // MERCATOR_FILL_SHADER_H 07070100000023000081A4000000000000000000000001656C865A00000FDE000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Forest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "iround.h" #include "Forest.h" #include "Plant.h" #include "Area.h" #include <wfmath/MersenneTwister.h> #include <wfmath/intersect.h> #include <iostream> #include <cmath> namespace Mercator { /// \brief Construct a new forest with the given seed. Forest::Forest(unsigned long seed) : m_area(nullptr), m_seed(seed), m_randCache(seed, std::make_unique<ZeroSpiralOrdering>()) { } /// \brief Destruct a forest. /// /// All contained vegetation is lost, so references to contained /// vegetation must not be maintained if this is likely to occur. Forest::~Forest() = default; /// \brief Assign an area to this forest. void Forest::setArea(Area* area) { m_area = area; } static const float plant_chance = 0.04f; static const float plant_min_height = 5.f; static const float plant_height_range = 20.f; /// \brief This function uses a pseudo-random technique to populate the /// forest with trees. This algorithm as the following essental properties: /// /// - It is repeatable. It can be repeated on the client and the server, /// and give identical results. /// /// - It is location independent. It gives the same results even if the /// forest is in a different place. /// /// - It is shape and size independent. A given area of the forest is /// the same even if the borders of the forest change. /// /// - It is localizable. It is possible to only partially populate the /// the forest, and still get the same results in that area. /// /// This function will have no effect if the area defining the forest remains /// uninitialised. Any previously generated contents are erased. /// For each instance a new seed is used to ensure it is repeatable, and /// height, displacement and orientation are calculated. void Forest::populate() { if (!m_area) return; WFMath::AxisBox<2> bbox(m_area->bbox()); // Fill the plant store with plants. m_plants.clear(); WFMath::MTRand rng; int lx = I_ROUND(bbox.lowCorner().x()), ly = I_ROUND(bbox.lowCorner().y()), hx = I_ROUND(bbox.highCorner().x()), hy = I_ROUND(bbox.highCorner().y()); PlantSpecies::const_iterator I; PlantSpecies::const_iterator Iend = m_species.end(); for(int j = ly; j < hy; ++j) { for(int i = lx; i < hx; ++i) { if (!m_area->contains(i,j)) { continue; } double prob = m_randCache(i,j); I = m_species.begin(); for (; I != Iend; ++I) { const Species & species = *I; if (prob > species.m_probability) { prob -= species.m_probability; // Next species continue; } // std::cout << "Plant at [" << i << ", " << j << "]" // << std::endl << std::flush; //this is a bit of a hack rng.seed((int)(prob / I->m_probability * 123456)); Plant & plant = m_plants[i][j]; // plant.setHeight(rng() * plant_height_range + plant_min_height); plant.m_displacement = WFMath::Point<2>( (rng.rand<WFMath::CoordType>() - 0.5f) * species.m_deviation, (rng.rand<WFMath::CoordType>() - 0.5f) * species.m_deviation); plant.m_orientation = WFMath::Quaternion(2, rng.rand<WFMath::CoordType>() * 2 * WFMath::numeric_constants<WFMath::CoordType>::pi()); // auto J = species.m_parameters.begin(); // auto Jend = species.m_parameters.end(); // for (; J != Jend; ++J) { // plant.setParameter(J->first, rng.rand<WFMath::CoordType>() * J->second.range + J->second.min); // } break; } } } } } 07070100000024000081A4000000000000000000000001656C865A00000C56000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/Forest.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #ifndef MERCATOR_FOREST_H #define MERCATOR_FOREST_H #include "RandCache.h" #include <wfmath/axisbox.h> #include <wfmath/polygon.h> #include <map> #include <string> namespace Mercator { struct Plant; class Area; class SpeciesParameter; typedef std::map<std::string, SpeciesParameter> ParameterDict; /// \brief A set of constraints on a plant parameter. class SpeciesParameter { public: /// \brief The minimum value a parameter should take. float min; /// \brief The range of values a parameter should take. float range; }; /// \brief Data about a species of plant in a Forest. /// /// Species objects encapsulate all the data required to determine /// where instances of a given species occur, and how they are scattered /// in a Forest. class Species { public: /// Probability that this species will occur at each grid node. float m_probability; /// Multiplyer for how deviated from the grid items should be. float m_deviation; /// Arbitrary parameters. ParameterDict m_parameters; }; /// \brief This is the core class for any area to be populated with vegetation. /// /// Each instance of vegetation is represented by the Plant class, /// and are stored in a 2 dimensional mapping container, which allows /// the entire contents to be iterated, or a given square two dimenstional /// area to be examined using the STL map API. class Forest { public: /// \brief STL map to store a sparse array of Plant objects. /// /// Integer key is effectively used as an index. typedef std::map<int, Plant> PlantColumn; /// \brief STL map to store a sparse array of PlantColumn objects. /// /// The end effect is a sparse two dimensional array of plant objects /// which can be efficiently queried and scanned using STL iterators. typedef std::map<int, PlantColumn> PlantStore; /// STL vector of plant species in this forest. typedef std::vector<Species> PlantSpecies; private: //TODO: store as value, not pointer /// Area of terrain affected by the presence of this forest. Area* m_area; /// List of species in this forest. PlantSpecies m_species; /// 2D spatial container with all the vegetation instances in. PlantStore m_plants; /// Seed value used to initialise the random number generator. unsigned long m_seed; /// Cache for optimising random number generation. RandCache m_randCache; public: explicit Forest(unsigned long seed = 0); ~Forest(); /// \brief Accessor for polygonal area. Area* getArea() const { return m_area; } /// Accessor for list of species in this forest. PlantSpecies & species() { return m_species; } /// \brief Accessor for container of vegetation. /// @return A const reference to the container. const PlantStore & getPlants() const { return m_plants; } void setArea(Area* a); void populate(); }; } #endif // MERCATOR_FOREST_H 07070100000025000081A4000000000000000000000001656C865A0000126C000000000000000000000000000000000000003900000000mercator-1701611098.a02d15f/src/Mercator/GrassShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "GrassShader.h" #include "Segment.h" #include "Surface.h" #include <cmath> #include <cassert> namespace Mercator { const std::string GrassShader::key_lowThreshold("lowThreshold"); const std::string GrassShader::key_highThreshold("highThreshold"); const std::string GrassShader::key_cutoff("cutoff"); const std::string GrassShader::key_intercept("intercept"); const float GrassShader::default_lowThreshold = 1.f; const float GrassShader::default_highThreshold = 20.f; const float GrassShader::default_cutoff = 1.f; const float GrassShader::default_intercept = 2.f; GrassShader::GrassShader(float lowThreshold, float highThreshold, float cutoff, float intercept) : m_lowThreshold(lowThreshold), m_highThreshold(highThreshold), m_cutoff(cutoff), m_intercept(intercept) { } GrassShader::GrassShader(const Parameters & params) : m_lowThreshold(default_lowThreshold), m_highThreshold(default_highThreshold), m_cutoff(default_cutoff), m_intercept(default_intercept) { auto I = params.find(key_lowThreshold); auto Iend = params.end(); if (I != Iend) { m_lowThreshold = I->second; } I = params.find(key_highThreshold); if (I != Iend) { m_highThreshold = I->second; } I = params.find(key_cutoff); if (I != Iend) { m_cutoff = I->second; } I = params.find(key_intercept); if (I != Iend) { m_intercept = I->second; } } GrassShader::~GrassShader() = default; inline ColorT GrassShader::slopeToAlpha(float height, float slope) const { if ((height < m_lowThreshold) || (height > m_highThreshold) || (slope > m_intercept)) { return colorMin; } else if (slope < m_cutoff) { return colorMax; } else { return (ColorT)(colorMax * ((slope - m_cutoff) / (m_intercept - m_cutoff))); } } bool GrassShader::checkIntersect(const Segment & s) const { if ((s.getMin() < m_highThreshold) && (s.getMax() > m_lowThreshold)) { return true; } else { return false; } } void GrassShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); assert(channels > 0); unsigned int chanAlpha = channels - 1; const Segment & seg = s.getSegment(); ColorT * data = s.getData(); const float * height_data = seg.getPoints(); if (height_data == nullptr) { std::cerr << "WARNING: Mercator: Attempting to shade empty segment." << std::endl << std::flush; return; } int size = seg.getSize(); int res = seg.getResolution(); unsigned int data_count = size * size * channels; for (unsigned int i = 0; i < data_count; ++i) { data[i] = colorMax; } // Deal with corner points s(0, 0, chanAlpha) = slopeToAlpha(seg.get(0,0), 0.f); s(res, 0, chanAlpha) = slopeToAlpha(seg.get(res,0), 0.f); s(0, res, chanAlpha) = slopeToAlpha(seg.get(0,res), 0.f); s(res, res, chanAlpha) = slopeToAlpha(seg.get(res,res), 0.f); for (int i = 1; i < res; ++i) { float height = seg.get(i, 0); float avgSlope = (std::fabs(seg.get(i - 1, 0) - height) + std::fabs(seg.get(i + 1, 0) - height)) / 2.f; s(i, 0, chanAlpha) = slopeToAlpha(height, avgSlope); height = seg.get(i, res); avgSlope = (std::fabs(seg.get(i - 1, res) - height) + std::fabs(seg.get(i + 1, res) - height)) / 2.f; s(i, res, chanAlpha) = slopeToAlpha(height, avgSlope); height = seg.get(0, i); avgSlope = (std::fabs(seg.get(0, i - 1) - height) + std::fabs(seg.get(0, i + 1) - height)) / 2.f; s(0, i, chanAlpha) = slopeToAlpha(height, avgSlope); height = seg.get(res, i); avgSlope = (std::fabs(seg.get(res, i - 1) - height) + std::fabs(seg.get(res, i + 1) - height)) / 2.f; s(res, i, chanAlpha) = slopeToAlpha(height, avgSlope); for (int j = 1; j < res; ++j) { height = seg.get(i, j); avgSlope = (std::fabs(seg.get(i + 1, j ) - height) + std::fabs(seg.get(i , j + 1) - height) + std::fabs(seg.get(i - 1, j ) - height) + std::fabs(seg.get(i , j - 1) - height)) / 4.f; s(i, j, chanAlpha) = slopeToAlpha(height, avgSlope); } } } } // namespace Mercator 07070100000026000081A4000000000000000000000001656C865A00001387000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/GrassShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_FILL_GRASS_SHADER_H #define MERCATOR_FILL_GRASS_SHADER_H #include "Shader.h" #include "Surface.h" /* alpha ^ * | * 1 |_______________________ cutoff * | \ * | \ * | \ * | \ * | \ * | \ * | \ * | \ * | \ * | \ intercept * 0 |_________________________________\_________________________> slope * * This shader is used to add grassy vegetation to some terrain. * The mask generated by this shader depends on two factors. The altitude * of the terrain, and its slope. Two parameter specify the low and high * altitude values between which vegetation grows. The low value will typically * be just above sea level, and the high value could be anything up to the * height above which plants cannot grow. * * The cutoff parameter specifies the slope below which the vegetation is * completely opaque. The intercept parameter specifies the slope above which * vegetetation will not grow on the terrain. Between these values the * vegetation is blended onto the terrain to give an impression of a light * covering. */ namespace Mercator { /// \brief Shader for adding grass to the terrain. /// /// This shader is used to add grassy vegetation to some terrain. /// The mask generated by this shader depends on two factors. The altitude /// of the terrain, and its slope. Two parameter specify the low and high /// altitude values between which vegetation grows. The low value will /// typically be just above sea level, and the high value could be anything /// up to the height above which plants cannot grow. class GrassShader : public Shader { private: /// The level above which the shader renders. float m_lowThreshold; /// The level below which the shader renders. float m_highThreshold; /// The slope below which grass is opaque. float m_cutoff; /// The slope steeper than which no grass grows. float m_intercept; /// \brief Determine the alpha value for grass for a given slope /// /// Determine the alpha value used when applying grass to the /// terrain at a point with given height and average slope. /// @param height the altitude of the specified point. /// @param slope the steepness of the terrain at the specified point. ColorT slopeToAlpha(float height, float slope) const; public: /// Key string used when specifying the low threshold parameter. static const std::string key_lowThreshold; /// Key string used when specifying the high threshold parameter. static const std::string key_highThreshold; /// Key string used when specifying the cutoff parameter. static const std::string key_cutoff; /// Key string used when specifying the intercept parameter. static const std::string key_intercept; /// Default level above which the shader renders. static const float default_lowThreshold; /// Default level below which the shader renders. static const float default_highThreshold; /// Default slope below which grass is opaque. static const float default_cutoff; /// Default slope steeper than which no grass grows. static const float default_intercept; /// \brief Constructor /// /// @param lowThreshold level above which the shader renders. /// @param highThreshold level above which the shader renders. /// @param cutoff slope below which grass is opaque. /// @param intercept slope steeper than which no grass grows. explicit GrassShader(float lowThreshold = default_lowThreshold, float highThreshold = default_highThreshold, float cutoff = default_cutoff, float intercept = default_intercept); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit GrassShader(const Parameters & params); ~GrassShader() override; /// Accessor for level above which the shader renders. float lowThreshold() const { return m_lowThreshold; } /// Accessor for level below which the shader renders. float highThreshold() const { return m_highThreshold; } /// Accessor for slope below which grass is opaque. float cutoff() const { return m_cutoff; } /// Accessor for slope steeper than which no grass grows. float intercept() const { return m_intercept; } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; } // namespace Mercator #endif // MERCATOR_FILL_GRASS_SHADER_H 07070100000027000081A4000000000000000000000001656C865A00003855000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/HeightMap.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "iround.h" #include "HeightMap.h" #include "Terrain.h" #include "TerrainMod.h" #include "Surface.h" #include "BasePoint.h" #include "Area.h" #include "Shader.h" #include <wfmath/MersenneTwister.h> #include <cmath> #include <cassert> #include <algorithm> namespace Mercator { /// \brief Helper to interpolate on a line. /// /// The line specified is of integer length, and the position specified /// as an integer. A check is included to avoid calculation if the value /// at each end is the same. class LinInterp { private: /// The length of the line. float m_size; /// Flag indicating that both points have the same value. bool noCalc; public: /// Values at the two ends. float ep1, ep2; /// \brief Determine the interpolated value along the line. inline float calc(float loc) { return ((noCalc) ? ep1 : ((m_size-loc) * ep1 + loc * ep2)); } /// \brief Constructor /// /// @param size length of the line. /// @param l value at one end of the line. /// @param h value at one end of the line. LinInterp(float size,float l, float h) : m_size(size), noCalc(false), ep1(l/size), ep2(h/size) { if (l==h) { ep1 = l; noCalc=true; } } }; /// \brief Helper to interpolate in a quad. /// /// The quad specified is assumed to be square of integer size, and /// the position specified for interpolation is specified in integer /// form. A check is included to avoid calculation if the value of each /// corner is the same. class QuadInterp { private: /// The length of one side of the square quad. float m_size; /// Flag indicating that all points have the same value. bool noCalc; public: /// Values at the four corners. float ep1, ep2, ep3, ep4; /// \brief Determine the interpolated value within the quad. inline float calc(float locX, float locY) { return ((noCalc) ? ep1 : (( ep1*(m_size-locX) + ep2 * locX) * (m_size-locY) + ( ep4*(m_size-locX) + ep3 * locX) * (locY) ) / m_size ); } /// \brief Constructor /// /// @param size length of one side of the square quad. /// @param e1 value at one corner of the square quad. /// @param e2 value at one corner of the square quad. /// @param e3 value at one corner of the square quad. /// @param e4 value at one corner of the square quad. QuadInterp(float size,float e1, float e2, float e3, float e4) : m_size(size), noCalc(false), ep1(e1/size), ep2(e2/size), ep3(e3/size), ep4(e4/size) { if ((e1==e2) && (e3==e4) && (e2==e3)) { ep1 = e1; noCalc=true; } } }; /// \brief Construct an empty height map with the given resolution. HeightMap::HeightMap(int resolution) : Buffer<float>::Buffer(resolution + 1, 1), m_res(resolution), m_max(std::numeric_limits<float>::lowest()), m_min(std::numeric_limits<float>::max()) { } /// \brief Check a value against m_min and m_max and set one of them /// if appropriate. /// /// Called by internal functions whenever a new data point is generated. void HeightMap::checkMaxMin(float h) { if (h<m_min) { m_min=h; } if (h>m_max) { m_max=h; } } // generate a rand num between -0.5...0.5 inline float randHalf(WFMath::MTRand& rng) { //return (float) rand() / RAND_MAX - 0.5f; return rng.rand<float>() - 0.5f; } /// \brief quasi-Random Midpoint Displacement (qRMD) algorithm. float HeightMap::qRMD(WFMath::MTRand& rng, float nn, float fn, float ff, float nf, float roughness, float falloff, float depth) const { float max = std::max(std::max(nn, fn), std::max(nf, ff)), min = std::min(std::min(nn, fn), std::min(nf, ff)), heightDifference = max - min; return ((nn+fn+ff+nf)/4.f) + randHalf(rng) * roughness * heightDifference / (1.f+std::pow(depth,falloff)); } /// \brief One dimensional midpoint displacement fractal. /// /// Size must be a power of 2. /// Falloff is the decay of displacement as the fractal is refined. /// Array is size + 1 long. array[0] and array[size] are filled /// with the control points for the fractal. void HeightMap::fill1d(const BasePoint& l, const BasePoint &h, float *array) const { array[0] = l.height(); array[m_res] = h.height(); LinInterp li((float)m_res, l.roughness(), h.roughness()); // seed the RNG. // The RNG is seeded only once for the line and the seed is based on the // two endpoints -because they are the common parameters for two adjoining // tiles //srand((l.seed() * 1000 + h.seed())); WFMath::MTRand::uint32 seed[2]={ l.seed(), h.seed() }; WFMath::MTRand rng(seed, 2); // stride is used to step across the array in a deterministic fashion // effectively we do the 1/2 point, then the 1/4 points, then the 1/8th // points etc. this has to be the same order every time because we call // on the RNG at every point int stride = m_res/2; // depth is used to indicate what level we are on. the displacement is // reduced each time we traverse the array. float depth=1; while (stride) { for (int i=stride;i<m_res;i+=stride*2) { float hh = array[i-stride]; float lh = array[i+stride]; float hd = std::fabs(hh-lh); float roughness = li.calc((float)i); //eliminate the problem where hd is nearly zero, leaving a flat section. if ((hd*100.f) < roughness) { hd+=0.05f * roughness; } array[i] = ((hh+lh)/2.f) + randHalf(rng) * roughness * hd / (1.f+std::pow(depth,BasePoint::FALLOFF)); } stride >>= 1; depth++; } } /// \brief Two dimensional midpoint displacement fractal. /// /// For a tile where edges are to be filled by 1d fractals. /// Size must be a power of 2, array is (size + 1) * (size + 1) with the /// corners the control points. void HeightMap::fill2d(const BasePoint& p1, const BasePoint& p2, const BasePoint& p3, const BasePoint& p4) { //First reset the min and max values, since they will be updated. m_max = std::numeric_limits<float>::lowest(); m_min = std::numeric_limits<float>::max(); // calculate the edges first. This is necessary so that segments tile // seamlessly note the order in which the edges are calculated and the // direction. opposite edges are calculated the same way (eg left->right) // so that the top of one tile matches the bottom of another, likewise // with sides. // temporary array used to hold each edge std::vector<float> edgeData; edgeData.reserve(m_size); float* edge = edgeData.data(); float* points = m_data.data(); // calc top edge and copy into m_heightMap fill1d(p1,p2,edge); for (int i=0;i<=m_res;i++) { points[0*m_size + i] = edge[i]; checkMaxMin(edge[i]); } // calc left edge and copy into points fill1d(p1,p4,edge); for (int i=0;i<=m_res;i++) { points[i*m_size + 0] = edge[i]; checkMaxMin(edge[i]); } // calc right edge and copy into points fill1d(p2,p3,edge); for (int i=0;i<=m_res;i++) { points[i*m_size + m_res] = edge[i]; checkMaxMin(edge[i]); } // calc bottom edge and copy into points fill1d(p4,p3,edge); for (int i=0;i<=m_res;i++) { points[m_res*m_size + i] = edge[i]; checkMaxMin(edge[i]); } // seed the RNG - this is the 5th and last seeding for the tile. // it was seeded once for each edge, now once for the tile. //srand(p1.seed()*20 + p2.seed()*15 + p3.seed()*10 + p4.seed()*5); WFMath::MTRand::uint32 seed[4]={ p1.seed(), p2.seed(), p3.seed(), p4.seed() }; WFMath::MTRand rng(seed, 4); QuadInterp qi((float)m_res, p1.roughness(), p2.roughness(), p3.roughness(), p4.roughness()); QuadInterp falloffQi((float)m_res, p1.falloff(), p2.falloff(), p3.falloff(), p4.falloff()); float depth=0; // center of points is done separately int stride = m_res/2; //float roughness = (p1.roughness+p2.roughness+p3.roughness+p4.roughness)/(4.0f); float roughness = qi.calc((float)stride,(float) stride); float f = falloffQi.calc((float)stride, (float)stride); points[stride*m_size + stride] = qRMD(rng, points[0 * m_size + stride], points[stride*m_size + 0], points[stride*m_size + m_res], points[m_res*m_size + stride], roughness, f, depth); checkMaxMin(points[stride*m_size + stride]); stride >>= 1; // skip across the points and fill in the points // alternate cross and plus shapes. // this is a diamond-square algorithm. while (stride) { //Cross shape - + contributes to value at X //+ . + //. X . //+ . + for (int i=stride;i<m_res;i+=stride*2) { for (int j=stride;j<m_res;j+=stride*2) { roughness=qi.calc((float)i,(float)j); f = falloffQi.calc((float)i, (float)j); points[j*m_size + i] = qRMD(rng, points[(i-stride) + (j+stride) * (m_size)], points[(i+stride) + (j-stride) * (m_size)], points[(i+stride) + (j+stride) * (m_size)], points[(i-stride) + (j-stride) * (m_size)], roughness, f, depth); checkMaxMin(points[j*m_size + i]); } } depth++; //Plus shape - + contributes to value at X //. + . //+ X + //. + . for (int i=stride*2;i<m_res;i+=stride*2) { for (int j=stride;j<m_res;j+=stride*2) { roughness=qi.calc((float)i,(float)j); f = falloffQi.calc((float)i, (float)j); points[j*m_size + i] = qRMD(rng, points[(i-stride) + (j) * (m_size)], points[(i+stride) + (j) * (m_size)], points[(i) + (j+stride) * (m_size)], points[(i) + (j-stride) * (m_size)], roughness, f , depth); checkMaxMin(points[j*m_size + i]); } } for (int i=stride;i<m_res;i+=stride*2) { for (int j=stride*2;j<m_res;j+=stride*2) { roughness=qi.calc((float)i,(float)j); f = falloffQi.calc((float)i, (float)j); points[j*m_size + i] = qRMD(rng, points[(i-stride) + (j) * (m_size)], points[(i+stride) + (j) * (m_size)], points[(i) + (j+stride) * (m_size)], points[(i) + (j-stride) * (m_size)], roughness, f, depth); checkMaxMin(points[j*m_size + i]); } } stride>>=1; depth++; } } void HeightMap::getHeight(float x, float z, float &h) const { // FIXME this ignores edges and corners assert(x <= m_res); assert(x >= 0.0f); assert(z <= m_res); assert(z >= 0.0f); // get index of the actual tile in the segment int tile_x = I_ROUND(std::floor(x)); int tile_z = I_ROUND(std::floor(z)); // work out the offset into that tile float off_x = x - (float)tile_x; float off_z = z - (float)tile_z; float h1=get(tile_x, tile_z); float h2=get(tile_x, tile_z+1); float h3=get(tile_x+1, tile_z+1); float h4=get(tile_x+1, tile_z); // square is broken into two triangles // top triangle |/ if ((off_x - off_z) <= 0.f) { h = h1 + (h3-h2) * off_x + (h2-h1) * off_z; } // bottom triangle /| else { h = h1 + (h4-h1) * off_x + (h3-h4) * off_z; } } /// \brief Get an accurate height and normal vector at a given coordinate /// relative to this segment. /// /// The height and surface normal are determined by finding the four adjacent /// height points nearest to the coordinate, and interpolating between /// those height values. The square area defined by the 4 height points is /// considered as two triangles for the purposes of interpolation to ensure /// that the calculated height falls on the surface rendered by a 3D /// graphics engine from the same heightfield data. The line used to /// divide the area is defined by the gradient z = x, so the first /// triangle has relative vertex coordinates (0,0) (1,0) (1,1) and /// the second triangle has vertex coordinates (0,0) (0,1) (1,1). void HeightMap::getHeightAndNormal(float x, float z, float& h, WFMath::Vector<3> &normal) const { // FIXME this ignores edges and corners assert(x <= m_res); assert(x >= 0.0f); assert(z <= m_res); assert(z >= 0.0f); // get index of the actual tile in the segment int tile_x = I_ROUND(std::floor(x)); int tile_z = I_ROUND(std::floor(z)); // work out the offset into that tile float off_x = x - (float)tile_x; float off_z = z - (float)tile_z; float h1=get(tile_x, tile_z); float h2=get(tile_x, tile_z+1); float h3=get(tile_x+1, tile_z+1); float h4=get(tile_x+1, tile_z); // square is broken into two triangles // top triangle |/ if ((off_x - off_z) <= 0.f) { normal = WFMath::Vector<3>(h2-h3, 1.0f, h1-h2); //normal for intersection of both triangles if (off_x == off_z) { normal += WFMath::Vector<3>(h1-h4, 1.0f, h4-h3); } normal.normalize(); h = h1 + (h3-h2) * off_x + (h2-h1) * off_z; } // bottom triangle /| else { normal = WFMath::Vector<3>(h1-h4, 1.0f, h4-h3); normal.normalize(); h = h1 + (h4-h1) * off_x + (h3-h4) * off_z; } } } // namespace Mercator 07070100000028000081A4000000000000000000000001656C865A000007B9000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/HeightMap.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifndef MERCATOR_HEIGHTMAP_H #define MERCATOR_HEIGHTMAP_H #include "BasePoint.h" #include "Buffer.h" #include <wfmath/vector.h> namespace WFMath { class MTRand; } namespace Mercator { /// \brief Class storing heightfield and other data for a single fixed size /// square area of terrain defined by four adjacent BasePoint objects. class HeightMap : public Buffer<float> { private: /// Distance between segments const int m_res; /// Maximum height of any point in this segment float m_max; /// Minimum height of any point in this segment float m_min; public: explicit HeightMap(int resolution); ~HeightMap() override = default; /// \brief Accessor for resolution of this segment. int getResolution() const { return m_res; } /// \brief Get the height at a relative integer position in the Segment. float get(int x, int z) const { return m_data[z * (m_res + 1) + x]; } void getHeightAndNormal(float x, float z, float &h, WFMath::Vector<3> &normal) const; void getHeight(float x, float z, float &h) const; /// \brief Accessor for the maximum height value in this Segment. float getMax() const { return m_max; } /// \brief Accessor for the minimum height value in this Segment. float getMin() const { return m_min; } void fill2d(const BasePoint& p1, const BasePoint& p2, const BasePoint& p3, const BasePoint& p4); void checkMaxMin(float h); private: void fill1d(const BasePoint& l, const BasePoint &h, float *array) const; float qRMD(WFMath::MTRand& rng, float nn, float fn, float ff, float nf, float roughness, float falloff, float depth) const; }; } // namespace Mercator #endif // MERCATOR_HEIGHTMAP_H 07070100000029000081A4000000000000000000000001656C865A000028D9000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/src/Mercator/Intersect.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Intersect.h" #include "Segment.h" #include <algorithm> namespace Mercator { //floor and ceil functions that return d-1 and d+1 //respectively if d is integral static inline float gridceil(float d) { float c = std::ceil(d); return (c==d) ? c+1.0f : c; } static inline double gridceil(double d) { auto c = std::ceil(d); return (c==d) ? c+1.0 : c; } static inline float gridfloor(float d) { float c = std::floor(d); return (c==d) ? c-1.0f : c; } static inline double gridfloor(double d) { auto c = std::floor(d); return (c==d) ? c-1.0 : c; } //check intersection of an axis-aligned box with the terrain bool Intersect(const Terrain &t, const WFMath::AxisBox<3> &bbox) { float max, min=bbox.lowCorner()[1]; const int res = t.getResolution(); const float spacing = t.getSpacing(); //determine which segments are involved //usually will just be one int xlow = (int) floor(bbox.lowCorner()[0] / spacing); int xhigh = (int) gridceil(bbox.highCorner()[0] / spacing); int zlow = (int) floor(bbox.lowCorner()[2] / spacing); int zhigh = (int) gridceil(bbox.highCorner()[2] / spacing); //loop across all tiles covered by this bbox for (int x = xlow; x < xhigh; x++) { for (int z = zlow; z < zhigh; z++) { //check the bbox against the extent of each tile //as an early rejection Segment *thisSeg=t.getSegmentAtIndex(x,z); if (thisSeg) max=thisSeg->getMax(); else max=Terrain::defaultLevel; if (max > min) { //entity bbox overlaps with the extents of this tile //now check each tile point covered by the entity bbox //clip the points to be tested against the bbox int min_x = (int) floor(bbox.lowCorner()[0] - ((float)x * spacing)); if (min_x < 0) min_x = 0; int max_x = (int) gridceil(bbox.highCorner()[0] - ((float)x * spacing)); if (max_x > res) min_x = res; int min_z = (int) floor(bbox.lowCorner()[2] - ((float)z * spacing)); if (min_z < 0) min_z = 0; int max_z = (int) gridceil(bbox.highCorner()[2] - ((float)z * spacing)); if (max_z > res) min_z = res; //loop over each point and see if it is greater than the minimum //of the bbox. If all points are below, the the bbox does NOT //intersect. If a single point is above, then the bbox MIGHT //intersect. for (int xpt = min_x; xpt <= max_x; xpt++) { for (int zpt = min_z; zpt <= max_z; zpt++) { if (thisSeg) { if (thisSeg->get(xpt,zpt) > min) { return true; } } else if (Terrain::defaultLevel > min) { return true; } } } } } } return false; } static bool HOT(const Terrain &t, const WFMath::Point<3> &pt, double & h) { WFMath::Vector<3> normal; float terrHeight; if (!t.getHeightAndNormal(pt[0], pt[2], terrHeight, normal)) { return false; } h = (pt[1] - terrHeight); return true; } bool Intersect(const Terrain &t, const WFMath::Point<3> &pt) { double h; return HOT(t, pt, h) && h <= 0.0; } //helper function for ray terrain intersection static bool cellIntersect(double h1, double h2, double h3, double h4, double X, double Z, const WFMath::Vector<3> &nDir, float dirLen, const WFMath::Point<3> &sPt, WFMath::Point<3> &intersection, WFMath::Vector<3> &normal, double &par) { //ray plane intersection roughly using the following: //parametric ray eqn: p=po + par V //plane eqn: p dot N + d = 0 // //intersection: // -par = (po dot N + d ) / (V dot N) // // // effectively we calculate the ray parametric variable for the // intersection of the plane corresponding to each triangle // then clip them by endpints of the ray, and by the sides of the square // and by the diagonal // // if they both still intersect, then we choose the earlier intersection //intersection points for top and bottom triangles WFMath::Point<3> topInt, botInt; //point to use in plane equation for both triangles WFMath::Vector<3> p0 = WFMath::Vector<3>(X, h1, Z); // square is broken into two triangles // top triangle |/ bool topIntersected = false; WFMath::Vector<3> topNormal(h2-h3, 1.0, h1-h2); topNormal.normalize(); double t = Dot(nDir, topNormal); double topP=0.0; if ((t > 1e-7) || (t < -1e-7)) { topP = - (Dot((sPt-WFMath::Point<3>(0,0,0)), topNormal) - Dot(topNormal, p0)) / t; topInt = sPt + nDir*topP; //check the intersection is inside the triangle, and within the ray extents if ((topP <= dirLen) && (topP > 0.0) && (topInt[0] >= X ) && (topInt[2] <= Z + 1 ) && ((topInt[0] - topInt[2]) <= (X - Z)) ) { topIntersected=true; } } // bottom triangle /| bool botIntersected = false; WFMath::Vector<3> botNormal(h1-h4, 1.0, h4-h3); botNormal.normalize(); double b = Dot(nDir, botNormal); double botP=0.0; if ((b > 1e-7) || (b < -1e-7)) { botP = - (Dot((sPt-WFMath::Point<3>(0,0,0)), botNormal) - Dot(botNormal, p0)) / b; botInt = sPt + nDir*botP; //check the intersection is inside the triangle, and within the ray extents if ((botP <= dirLen) && (botP > 0.0) && (botInt[0] <= X + 1 ) && (botInt[2] >= Z ) && ((botInt[0] - botInt[2]) >= (X - Z)) ) { botIntersected = true; } } if (topIntersected && botIntersected) { //intersection with both if (botP <= topP) { intersection = botInt; normal = botNormal; par=botP/dirLen; if (botP == topP) { normal += topNormal; normal.normalize(); } return true; } else { intersection = topInt; normal = topNormal; par=topP/dirLen; return true; } } else if (topIntersected) { //intersection with top intersection = topInt; normal = topNormal; par=topP/dirLen; return true; } else if (botIntersected) { //intersection with bot intersection = botInt; normal = botNormal; par=botP/dirLen; return true; } return false; } //Intersection of ray with terrain // //returns true on successful intersection //ray is represented by a start point (sPt) //and a direction vector (dir). The length of dir is //used as the length of the ray. (ie not an infinite ray) //intersection and normal are filled in on a successful result. //par is the distance along the ray where intersection occurs //0.0 == start, 1.0 == end. bool Intersect(const Terrain &t, const WFMath::Point<3> &sPt, const WFMath::Vector<3>& dir, WFMath::Point<3> &intersection, WFMath::Vector<3> &normal, double &par) { //FIXME early reject using segment max //FIXME handle height point getting in a more optimal way //FIXME early reject for vertical ray // check if startpoint is below ground double hot; if (HOT(t, sPt, hot) && hot < 0.0) return true; double paraX=0.0, paraZ=0.0; //used to store the parametric gap between grid crossings double pX, pZ; //the accumulators for the parametrics as we traverse the ray float h1,h2,h3,h4; WFMath::Point<3> last(sPt), next(sPt); WFMath::Vector<3> nDir(dir); nDir.normalize(); float dirLen = dir.mag(); //work out where the ray first crosses an X grid line if (dir[0] != 0.0f) { paraX = 1.0f/dir[0]; double crossX = (dir[0] > 0.0f) ? gridceil(last[0]) : gridfloor(last[0]); pX = (crossX - last[0]) * paraX; pX = std::min(pX, 1.0); } else { //parallel: never crosses pX = 1.0f; } //work out where the ray first crosses a Y grid line if (dir[2] != 0.0f) { paraZ = 1.0f/dir[2]; double crossZ = (dir[2] > 0.0f) ? gridceil(last[2]) : gridfloor(last[2]); pZ = (crossZ - sPt[2]) * paraZ; pZ = std::min(pZ, 1.0); } else { //parallel: never crosses pZ = 1.0f; } //ensure we traverse the ray forwards paraX = std::abs(paraX); paraZ = std::abs(paraZ); bool endpoint = false; //check each candidate tile for an intersection while (true) { last = next; if (pX < pZ) { // cross x grid line first next = sPt + (pX * dir); pX += paraX; // set x accumulator to current p } else { //cross z grid line first next = sPt + (pZ * dir); if (pX == pZ) { pX += paraX; //unusual case where ray crosses corner } pZ += paraZ; // set z accumulator to current p } //FIXME these gets could be optimized a bit float x= (dir[0] > 0) ? std::floor(last[0]) : std::floor(next[0]); float z= (dir[2] > 0) ? std::floor(last[2]) : std::floor(next[2]); h1 = t.get(x, z); h2 = t.get(x, z+1); h3 = t.get(x+1, z+1); h4 = t.get(x+1, z); auto height = std::max( std::max(h1, h2), std::max(h3, h4)); if ( (last[1] < height) || (next[1] < height) ) { // possible intersect with this tile if (cellIntersect(h1, h2, h3, h4, x, z, nDir, dirLen, sPt, intersection, normal, par)) { return true; } } if ((pX >= 1.0f) && (pZ >= 1.0f)) { if (endpoint) { break; } else endpoint = true; } } return false; } } // namespace Mercator 0707010000002A000081A4000000000000000000000001656C865A000002BD000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/Intersect.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes #ifndef MERCATOR_INTERSECT #define MERCATOR_INTERSECT #include <wfmath/axisbox.h> #include <wfmath/vector.h> #include <wfmath/point.h> #include "Terrain.h" namespace Mercator { bool Intersect(const Terrain &t, const WFMath::AxisBox<3> &bbox); bool Intersect(const Terrain &t, const WFMath::Point<3> &pt); bool Intersect(const Terrain &t, const WFMath::Point<3> &sPt, const WFMath::Vector<3>& dir, WFMath::Point<3> &intersection, WFMath::Vector<3> &normal, double &par); } // namespace Mercator #endif 0707010000002B000081A4000000000000000000000001656C865A0000012E000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Matrix.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "Matrix.h" namespace Mercator { template class Matrix<2, 2>; template class Matrix<4, 4>; } // namespace Mercator 0707010000002C000081A4000000000000000000000001656C865A00000466000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/Matrix.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_MATRIX_H #define MERCATOR_MATRIX_H namespace Mercator { /// \brief A fixed sized array of objects. /// /// Mainly used to store the control points in a Segment. template <unsigned int COLS, unsigned int ROWS, typename FloatType = float> class Matrix { private: /// \brief Storage for the array of objects. FloatType m_data[COLS * ROWS]; public: /// \brief Constructor for the Matrix. Matrix() = default; /// \brief Accessor for modifying the array. FloatType & operator()(unsigned int col, unsigned int row) { return m_data[row * COLS + col]; } /// \brief Accessor for the array. const FloatType & operator()(unsigned int col, unsigned int row) const { return m_data[row * COLS + col]; } /// \brief Accessor for accessing the array as one dimensional. FloatType & operator[](unsigned int idx) { return m_data[idx]; } }; } #endif // MERCATOR_MATRIX_H 0707010000002D000081A4000000000000000000000001656C865A00000164000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Mercator.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_MERCATOR_H #define MERCATOR_MERCATOR_H namespace Mercator { static constexpr int defaultResolution = 64; } // namespace Mercator #endif // MERCATOR_MERCATOR_H 0707010000002E000081A4000000000000000000000001656C865A0000032C000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/src/Mercator/Plant.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #ifndef MERCATOR_PLANT_H #define MERCATOR_PLANT_H #include <wfmath/point.h> #include <wfmath/quaternion.h> #include <string> namespace Mercator { /// \brief This is the simple class for representing instances of vegetation. /// /// It is used in instances of class Forest to represent each instance /// of vegetation created when the Forest is populated. struct Plant { /// Position of the vegetation relative to its grid point. WFMath::Point<2> m_displacement; /// Orientation of the vegetation. WFMath::Quaternion m_orientation; /// Height of the vegetation. float m_height; }; } #endif // MERCATOR_PLANT_H 0707010000002F000081A4000000000000000000000001656C865A00000E2E000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/RandCache.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Damien McGinnes, Ron Steinke, Alistair Riddoch #ifndef MERCATOR_RANDCACHE_H #define MERCATOR_RANDCACHE_H #include <vector> #include <algorithm> #include <cstdlib> #include <memory> #include <wfmath/MersenneTwister.h> // construct with something like: // RandCache r(seed, new MyOrdering(args)); // where MyOrdering is derived from RandCache::Ordering. /// \brief A cache of random values. class RandCache { public: /// Unsigned 32bit integer typedef WFMath::MTRand::uint32 uint32; /// Size type of std::vector. typedef std::vector<uint32>::size_type size_type; /// \brief Interface to define the ordering of the random number cache. struct Ordering { virtual ~Ordering() = default; /// \brief Determine the order. virtual size_type operator()(int x, int y) = 0; }; /// \brief Constructor /// /// @param seed the random seed value for generated numbers. /// @param o the ordering object that defines the sequence generated. RandCache(uint32 seed, std::unique_ptr<Ordering> o) : m_rand(seed), m_ordering(std::move(o)) {} /// \brief Constructor /// /// @param seed the random seed block for generated numbers. /// @param seed_len the length of the seed block. /// @param o the ordering object that defines the sequence generated. RandCache(uint32* seed, uint32 seed_len, std::unique_ptr<Ordering> o) : m_rand(seed, seed_len), m_ordering(std::move(o)) {} ~RandCache() = default; /// \brief Retrieve a random value associated with parameters /// /// @param x coordinate associated with value to be retrieved. /// @param y coordinate associated with value to be retrieved. double operator()(int x, int y) { size_type cache_order = (*m_ordering)(x, y); // make sure we've cached the value if(cache_order >= m_cache.size()) { size_type old_size = m_cache.size(); m_cache.resize(cache_order + 64); //do 64 at once while(old_size < m_cache.size()) m_cache[old_size++] = m_rand.randInt(); } return double(m_cache[cache_order] * (1.0/4294967295.0)); } private: /// \brief Source random number generator. WFMath::MTRand m_rand; /// \brief Store for the cache of values. std::vector<uint32> m_cache; /// \brief Ordering object that defines the ordering of the cache. std::unique_ptr<Ordering> m_ordering; }; /// \brief A spiral around 0,0 class ZeroSpiralOrdering : public RandCache::Ordering { public: RandCache::size_type operator () (int x, int y) override { if (x==0 && y==0) return 0; int d=std::max(std::abs(x), std::abs(y)); int min=(2*d-1)*(2*d-1); if (y == d) return min + 2*d - x; if (x == -d) return min + 4*d - y; if (y == -d) return min + 6*d + x; else { //if (x == d) { if (y >=0) return min + y; else return min + 8*d + y; } } }; /// \brief A spiral around x,y class SpiralOrdering : public ZeroSpiralOrdering { private: /// The centre x coordinate of the spiral. int m_x; /// The centre y coordinate of the spiral. int m_y; public: /// \brief Constructor /// /// @param x centre x coordinate of the spiral. /// @param y centre y coordinate of the spiral. SpiralOrdering(int x, int y) : ZeroSpiralOrdering(), m_x(x), m_y(y) {} RandCache::size_type operator () (int x, int y) override { return ZeroSpiralOrdering::operator()(x-m_x, y-m_y); } }; #endif 07070100000030000081A4000000000000000000000001656C865A000028B9000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/Segment.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "iround.h" #include "Segment.h" #include "Terrain.h" #include "TerrainMod.h" #include "Surface.h" #include "BasePoint.h" #include "Area.h" #include "Shader.h" #include <wfmath/MersenneTwister.h> #include <cmath> #include <cassert> #include <algorithm> namespace Mercator { /// \brief Construct an empty segment with the given resolution. /// /// Generally it is not necessary to call this from outside the Mercator /// library Segment objects are created as required. The Segment is /// constructed without allocating any storage for heightfield or surface /// normal data. The m_min and m_max members are initialised to extreme /// values, and should be set to appropriate using setMinMax() as soon as /// possible after construction. Similarly the control points should be /// set soon after construction. Segment::Segment(int x, int z, int resolution) : m_res(resolution), m_size(m_res+1), m_xRef(x), m_zRef(z), m_heightMap(resolution) { } /// \brief Destruct the Segment. /// /// Generally it is not necessary to delete Segment objects from application /// code, as Segment instances are owned by the Terrain object. /// Storage allocated for heightfield and surface normals is implicitly /// deleted as well as all surfaces. Segment::~Segment() { clearMods(); } /// \brief Populate the Segment with heightfield data. /// /// Storage for the heightfield data is allocated if necessary, the /// qRMD algorithm is used to calculate the heightfield data, and /// required modifications are applied. void Segment::populate() // const Matrix<2, 2, BasePoint> & base) { m_heightMap.allocate(); populateHeightMap(m_heightMap); for (auto& entry : m_terrainMods) { applyMod(entry.second); } } void Segment::populateHeightMap(HeightMap& heightMap) { heightMap.fill2d(m_controlPoints(0, 0), m_controlPoints(1, 0), m_controlPoints(1, 1), m_controlPoints(0, 1)); } /// \brief Mark the contents of this Segment as stale. /// /// This is called internally whenever changes occur that mean that the /// heightfield and surface normal data are no longer valid. /// If surface normal storage is deallocated, and if the points argument /// is true the heightfield storage is also deallocated. void Segment::invalidate(bool points) { if (points) { m_heightMap.invalidate(); } m_normals = {}; invalidateSurfaces(); } /// \brief Mark surfaces as stale. /// /// This is called internally from Segment::invalidate() when changes occur /// that mean the surface data is no longer valid. The Surface::invalidate() /// method is called for each surface. void Segment::invalidateSurfaces() { for(auto& entry : m_surfaces) { entry.second->invalidate(); } } /// \brief Populate the Segment with surface normal data. /// /// Storage for the normals is allocated if necessary, and the average /// normal at each heightpoint is calculated. The middle normals are /// calculated first, followed by the boundaries which are done in /// 2 dimensions to ensure that there is no visible seam between segments. void Segment::populateNormals() { assert(m_heightMap.isValid()); assert(m_size != 0); assert(m_res == m_size - 1); if (m_normals.empty()) { m_normals.reserve(m_size * m_size * 3); } auto * np = m_normals.data(); // Fill in the damn normals float h1,h2,h3,h4; for (int j = 1; j < m_res; ++j) { for (int i = 1; i < m_res; ++i) { h1 = get(i - 1, j); h2 = get(i, j + 1); h3 = get(i + 1, j); h4 = get(i, j - 1); // Caclulate the normal vector. np[j * m_size * 3 + i * 3] = (h1 - h3) / 2.f; np[j * m_size * 3 + i * 3 + 1] = 1.0; np[j * m_size * 3 + i * 3 + 2] = (h4 - h2) / 2.f; } } //edges have one axis pegged to 0 //top and bottom boundary for (int i=1; i < m_res; ++i) { h1 = m_heightMap.get(i - 1, 0); h2 = m_heightMap.get(i + 1, 0); np[i * 3] = (h1 - h2) / 2.f; np[i * 3 + 1] = 1.0; np[i * 3 + 2] = 0.0; h1 = m_heightMap.get(i - 1, m_res); h2 = m_heightMap.get(i + 1, m_res); np[m_res * m_size * 3 + i * 3] = (h1 - h2) / 2.f; np[m_res * m_size * 3 + i * 3 + 1] = 1.0f; np[m_res * m_size * 3 + i * 3 + 2] = 0.0f; } //left and right boundary for (int j=1; j < m_res; ++j) { h1 = m_heightMap.get(0, j - 1); h2 = m_heightMap.get(0, j + 1); np[j * m_size * 3] = 0; np[j * m_size * 3 + 1] = 1.f; np[j * m_size * 3 + 2] = (h1 - h2) / 2.f; h1 = m_heightMap.get(m_res, j - 1); h2 = m_heightMap.get(m_res, j + 1); np[j * m_size * 3 + m_res * 3] = 0.f; np[j * m_size * 3 + m_res * 3 + 1] = 1.f; np[j * m_size * 3 + m_res * 3 + 2] = (h1 - h2) / 2.f; } //corners - these are all treated as flat //so the normal points straight up np[0] = 0.f; np[1] = 1.f; np[2] = 0.f; np[m_res * m_size * 3] = 0.f; np[m_res * m_size * 3 + 1] = 1.f; np[m_res * m_size * 3 + 2] = 0.f; np[m_res * 3] = 0.f; np[m_res * 3 + 1] = 1.f; np[m_res * 3 + 2] = 0.f; np[m_res * m_size * 3 + m_res * 3] = 0.f; np[m_res * m_size * 3 + m_res * 3 + 1] = 1.f; np[m_res * m_size * 3 + m_res * 3 + 2] = 0.f; } /// \brief Populate the surfaces associated with this Segment. /// /// Call Surface::populate() for each Surface in turn. void Segment::populateSurfaces() { for (const auto& entry : m_surfaces) { if (entry.second->m_shader.checkIntersect(*this)) { entry.second->populate(); } } } void Segment::getHeight(float x, float y, float &h) const { m_heightMap.getHeight(x, y, h); } /// \brief Get an accurate height and normal vector at a given coordinate /// relative to this segment. /// /// The height and surface normal are determined by finding the four adjacent /// height points nearest to the coordinate, and interpolating between /// those height values. The square area defined by the 4 height points is /// considered as two triangles for the purposes of interpolation to ensure /// that the calculated height falls on the surface rendered by a 3D /// graphics engine from the same heightfield data. The line used to /// divide the area is defined by the gradient y = x, so the first /// triangle has relative vertex coordinates (0,0) (1,0) (1,1) and /// the second triangle has vertex coordinates (0,0) (0,1) (1,1). void Segment::getHeightAndNormal(float x, float z, float& h, WFMath::Vector<3> &normal) const { m_heightMap.getHeightAndNormal(x, z, h, normal); } /// \brief Determine the intersection between an axis aligned box and /// this segment. /// /// @param bbox axis aligned box to be tested. /// @param lx lower x coordinate of intersection area. /// @param hx upper x coordinate of intersection area. /// @param lz lower z coordinate of intersection area. /// @param hz upper z coordinate of intersection area. /// @return true if the box intersects with this Segment, false otherwise. bool Segment::clipToSegment(const WFMath::AxisBox<2> &bbox, int &lx, int &hx, int &lz, int &hz) const { lx = I_ROUND(bbox.lowCorner()[0]); if (lx > m_res) return false; if (lx < 0) lx = 0; hx = I_ROUND(bbox.highCorner()[0]); if (hx < 0) return false; if (hx > m_res) hx = m_res; lz = I_ROUND(bbox.lowCorner()[1]); if (lz > m_res) return false; if (lz < 0) lz = 0; hz = I_ROUND(bbox.highCorner()[1]); if (hz < 0) return false; if (hz > m_res) hz = m_res; return true; } void Segment::updateMod(long id, const TerrainMod *t) { if (t) { m_terrainMods[id] = t; } else { m_terrainMods.erase(id); } invalidate(); } /// \brief Delete all the modifications applied to this Segment. /// /// Usually called from the destructor. It is not normally necessary to call /// this function from the application. void Segment::clearMods() { if (!m_terrainMods.empty()) { m_terrainMods.clear(); invalidate(); } } /// \brief Modify the heightfield data using the TerrainMod objects which /// are attached to this Segment. /// /// Usually called from Segment::populate(). It is not normally necessary to /// call this function from the application. void Segment::applyMod(const TerrainMod *t) { int lx,hx,lz,hz; float* points = m_heightMap.getData(); WFMath::AxisBox<2> bbox=t->bbox(); bbox.shift(WFMath::Vector<2>(-m_xRef, -m_zRef)); if (clipToSegment(bbox, lx, hx, lz, hz)) { for (int i=lz; i<=hz; i++) { for (int j=lx; j<=hx; j++) { float& h = points[i * m_size + j]; t->apply(h, j + m_xRef, i + m_zRef); m_heightMap.checkMaxMin(h); } } } //currently mods dont fix the normals invalidate(false); } void Segment::updateArea(long id, const Area* area, const Shader* shader) { auto areaLookupI = m_areaLookup.find(id); if (areaLookupI != m_areaLookup.end()) { auto& areaEntry = areaLookupI->second->second; auto J = m_surfaces.find(areaEntry.area->getLayer()); if (J != m_surfaces.end()) { // segment already has a surface for this shader, mark it // for re-generation J->second->invalidate(); } m_areas.erase(areaLookupI->second); m_areaLookup.erase(areaLookupI); } if (area) { auto result = m_areas.emplace(area->getLayer(), AreaEntry{id, area}); m_areaLookup.emplace(id, result); auto J = m_surfaces.find(area->getLayer()); if (J != m_surfaces.end()) { J->second->invalidate(); } else { if (shader) { m_surfaces[area->getLayer()] = shader->newSurface(*this); } } } } WFMath::AxisBox<2> Segment::getRect() const { WFMath::Point<2> lp(m_xRef, m_zRef), hp(lp.x() + m_res, lp.y() + m_res); return WFMath::AxisBox<2>(lp, hp); } } // namespace Mercator 07070100000031000081A4000000000000000000000001656C865A0000185D000000000000000000000000000000000000003300000000mercator-1701611098.a02d15f/src/Mercator/Segment.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifndef MERCATOR_SEGMENT_H #define MERCATOR_SEGMENT_H #include "Mercator.h" #include "Matrix.h" #include "BasePoint.h" #include "HeightMap.h" #include <wfmath/vector.h> #include <wfmath/axisbox.h> #include <set> #include <map> namespace WFMath { class MTRand; } namespace Mercator { class Terrain; class Surface; class TerrainMod; class Area; class Shader; // This class will need to be reference counted if we want the code to // be able to hold onto it, as currently they get deleted internally // whenever height points are asserted. /// \brief Class storing heightfield and other data for a single fixed size /// square area of terrain defined by four adjacent BasePoint objects. class Segment { public: /// STL map of pointers to Surface objects. typedef std::map<int, std::unique_ptr<Surface>> Surfacestore; struct AreaEntry { long id; const Area* area; }; /// STL multimap of pointers to Area objects affecting this segment. typedef std::multimap<int, AreaEntry> Areastore; private: /// Distance between segments const int m_res; /// Size of segment, m_res + 1 const int m_size; /// Global x reference of this segment const int m_xRef; /// Global z reference of this segment const int m_zRef; /// 2x2 matrix of points which control this segment Matrix<2, 2, BasePoint> m_controlPoints; /// Pointer to buffer containing height points HeightMap m_heightMap; /// Pointer to buffer containing normals for height points std::vector<float> m_normals; /// Store of surfaces which can be rendered on this terrain Surfacestore m_surfaces; /// Areas which intersect this segment Areastore m_areas; /** * A lookup table into m_areas used when areas are removed. */ std::map<long, std::multimap<int, AreaEntry>::iterator> m_areaLookup; /// \brief Map of TerrainMod objects that are applied to this Segment. std::map<long, const TerrainMod*> m_terrainMods; public: explicit Segment(int x, int z, int resolution); ~Segment(); /// \brief Accessor for resolution of this segment. int getResolution() const { return m_res; } /// \brief Accessor for array size of this segment. int getSize() const { return m_size; } /// \brief Accessor for Global x reference of this segment int getXRef() const { return m_xRef; } /// \brief Accessor for Global y reference of this segment int getZRef() const { return m_zRef; } /// \brief Check whether this Segment contains valid point data. /// /// @return true if this Segment is valid, false otherwise. bool isValid() const { return m_heightMap.isValid(); } void invalidate(bool points = true); /// \brief Set the BasePoint data for one of the four that define this /// Segment. /// /// @param x relative x coord of base point. Must be 0 or 1. /// @param z relative z coord of base point. Must be 0 or 1. /// @param bp BasePoint data to be used. void setCornerPoint(unsigned int x, unsigned int z, const BasePoint & bp) { m_controlPoints(x, z) = bp; invalidate(); } /// \brief Accessor for 2D matrix of base points. const Matrix<2, 2, BasePoint> & getControlPoints() const { return m_controlPoints; } /// \brief Accessor for modifying 2D matrix of base points. Matrix<2, 2, BasePoint> & getControlPoints() { return m_controlPoints; } /// \brief Accessor for list of attached Surface objects. const Surfacestore & getSurfaces() const { return m_surfaces; } /// \brief Accessor for modifying list of attached Surface objects. Surfacestore & getSurfaces() { return m_surfaces; } /// \brief Accessor for buffer containing height points. const float * getPoints() const { return m_heightMap.getData(); } /// \brief Accessor for write access to buffer containing height points. float * getPoints() { return m_heightMap.getData(); } /// \brief Accessor for height map. const HeightMap& getHeightMap() const { return m_heightMap; } /// \brief Accessor for write access to height map. HeightMap& getHeightMap() { return m_heightMap; } /// \brief Accessor for buffer containing surface normals. const float * getNormals() const { return m_normals.data(); } /// \brief Accessor for write access to buffer containing surface normals. float * getNormals() { return m_normals.data(); } /// \brief Get the height at a relative integer position in the Segment. float get(int x, int z) const { return m_heightMap.get(x, z); } void getHeight(float x, float y, float &h) const; void getHeightAndNormal(float x, float z, float &h, WFMath::Vector<3> &normal) const; bool clipToSegment(const WFMath::AxisBox<2> &bbox, int &lx, int &hx, int &lz, int &hz) const; void populate(); void populateNormals(); void populateSurfaces(); void populateHeightMap(HeightMap& heightMap); /// \brief Accessor for the maximum height value in this Segment. float getMax() const { return m_heightMap.getMax(); } /// \brief Accessor for the minimum height value in this Segment. float getMin() const { return m_heightMap.getMin(); } /// \brief The 2d area covered by this segment WFMath::AxisBox<2> getRect() const; void updateMod(long id, const TerrainMod *t); void clearMods(); /// \brief Accessor for multimap of Area objects. const Areastore& getAreas() const { return m_areas; } const std::map<long, const TerrainMod*>& getMods() const { return m_terrainMods; } void updateArea(long id, const Area* area, const Shader* shader); private: void applyMod(const TerrainMod *t); void invalidateSurfaces(); }; } // namespace Mercator #endif // MERCATOR_SEGMENT_H 07070100000032000081A4000000000000000000000001656C865A0000038E000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/src/Mercator/Shader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "Shader.h" #include "Segment.h" #include "Surface.h" namespace Mercator { /// \brief Protected constructor for classes which inherit from this /// one. /// /// Permanently sets the color and alpha flags. Shader::Shader(bool color, bool alpha) : m_color(color), m_alpha(alpha) { } /// \brief Destructor does nothing interesting. Shader::~Shader() = default; /// \brief Create a new Surface which matches the requirements of this shader. /// /// Called by terrain when creating a new Segment to add the necessary /// Surface objects to that Segment. std::unique_ptr<Surface> Shader::newSurface(const Segment & segment) const { return std::make_unique<Surface>(segment, *this, m_color, m_alpha); } } // namespace Mercator 07070100000033000081A4000000000000000000000001656C865A000007BD000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/Shader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_SHADER_H #define MERCATOR_SHADER_H #include <string> #include <map> #include <memory> namespace Mercator { class Surface; class Segment; /// \brief Base class for Shader objects which create surface data for use /// when rendering terrain. /// /// Shader objects take heightfield data for a terrain Segment, and use it /// to populate a Surface with data that can then be used to define the /// appearance of the terrain when rendering. The Shader is used both to /// create the Surface object of the right type, and to populate the /// Surface with data once the Segment heightfield has been generated. class Shader { private: /// \brief Flag to control whether this Shader produces color data. const bool m_color; /// \brief Flag to control whether this Shader produces alpha data. const bool m_alpha; protected: explicit Shader(bool color = false, bool alpha = true); public: virtual ~Shader(); /// \brief Accessor for color flag. bool getColor() const { return m_color; } /// \brief Accessor for alpha flag. bool getAlpha() const { return m_alpha; } std::unique_ptr<Surface> newSurface(const Segment &) const; /// \brief Check whether this Shader has any effect on the given Segment. /// /// @return true if the given Segment height range is within the range /// that this Shader uses. e.g. A high altitude snow shader will have /// no effect on low level terrain. virtual bool checkIntersect(const Segment &) const = 0; /// \brief Populate a Surface with data. virtual void shade(Surface &) const = 0; /// STL map of parameter values for a shader constructor. typedef std::map<std::string, float> Parameters; }; } // namespace Mercator #endif // MERCATOR_SHADER_H 07070100000034000081A4000000000000000000000001656C865A000005FE000000000000000000000000000000000000003B00000000mercator-1701611098.a02d15f/src/Mercator/ShaderFactory.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #include "ShaderFactory_impl.h" #include "DepthShader.h" #include "FillShader.h" #include "GrassShader.h" #include "ThresholdShader.h" #include <cassert> namespace Mercator { ShaderKit::ShaderKit() = default; ShaderKit::~ShaderKit() = default; ShaderFactories::ShaderFactories() { m_factories.emplace("grass", std::make_unique<ShaderFactory<GrassShader>>()); m_factories.emplace("depth", std::make_unique<ShaderFactory<DepthShader>>()); m_factories.emplace("fill", std::make_unique<ShaderFactory<FillShader>>()); m_factories.emplace("high", std::make_unique<ShaderFactory<HighShader>>()); m_factories.emplace("low", std::make_unique<ShaderFactory<LowShader>>()); m_factories.emplace("band", std::make_unique<ShaderFactory<BandShader>>()); } ShaderFactories::~ShaderFactories() = default; /// \brief Create a shader of the specified type. /// /// @param type a string giving the type of shader. /// @param params a map of the parameters for the shader /// @returns a pointer to the new shader object std::unique_ptr<Shader> ShaderFactories::newShader(const std::string & type, const Shader::Parameters & params) const { auto I = m_factories.find(type); if (I == m_factories.end()) { return nullptr; } assert(I->second); return I->second->newShader(params); } } // namespace Mercator 07070100000035000081A4000000000000000000000001656C865A000005C8000000000000000000000000000000000000003900000000mercator-1701611098.a02d15f/src/Mercator/ShaderFactory.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifndef MERCATOR_SHADER_FACTORY_H #define MERCATOR_SHADER_FACTORY_H #include "Shader.h" #include <memory> namespace Mercator { /// \brief Interface for shader factory objects. class ShaderKit { protected: explicit ShaderKit(); public: virtual ~ShaderKit(); /// \brief Create a new Shader instance /// /// @return a pointer to the new Shader. virtual std::unique_ptr<Shader> newShader(const Shader::Parameters &) const = 0; }; /// \brief Factory template used to create ordinary shader objects. template <class T> class ShaderFactory : public ShaderKit { public: ShaderFactory(); ~ShaderFactory() override; std::unique_ptr<Shader> newShader(const Shader::Parameters &) const override; }; /// \brief Class which manages all the shader factories available. /// /// Requests for new shaders of a given type are passed here, and /// shader objects are returned. class ShaderFactories { private: /// \brief Map of shader factory pointers keyed on type string. std::map<std::string, std::unique_ptr<ShaderKit>> m_factories; public: ShaderFactories(); ~ShaderFactories(); std::unique_ptr<Shader> newShader(const std::string & type, const Shader::Parameters &) const; }; } // namespace Mercator #endif // MERCATOR_SHADER_FACTORY_H 07070100000036000081A4000000000000000000000001656C865A0000028F000000000000000000000000000000000000003E00000000mercator-1701611098.a02d15f/src/Mercator/ShaderFactory_impl.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifndef MERCATOR_SHADER_FACTORY_IMPL_H #define MERCATOR_SHADER_FACTORY_IMPL_H #include "ShaderFactory.h" namespace Mercator { template <class T> ShaderFactory<T>::ShaderFactory() = default; template <class T> ShaderFactory<T>::~ShaderFactory() = default; template <class T> std::unique_ptr<Shader> ShaderFactory<T>::newShader(const Shader::Parameters & params) const { return std::make_unique<T>(params); } } // namespace Mercator #endif // MERCATOR_SHADER_FACTORY_IMPL_H 07070100000037000081A4000000000000000000000001656C865A000003CF000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/Surface.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "Surface.h" #include "Shader.h" #include <cassert> namespace Mercator { /// \brief Constructor /// /// @param seg the terrain height segment this surface maps on to. /// @param sh the shader used to generate the surface data. /// @param color true if this shader contains color data. /// @param alpha true if this shader contains alpha data. Surface::Surface(const Segment & seg, const Shader & sh, bool color, bool alpha) : Buffer<ColorT>(seg.getSize(), (color ? 3 : 0) + (alpha ? 1 : 0)), m_shader(sh), m_segment(seg) { } /// \brief Populate the data buffer using the correct shader. /// /// Call the shader to full this surface buffer with surface data. void Surface::populate() { if (!isValid()) { allocate(); } m_shader.shade(*this); } } // namespace Mercator 07070100000038000081A4000000000000000000000001656C865A0000049E000000000000000000000000000000000000003300000000mercator-1701611098.a02d15f/src/Mercator/Surface.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_SURFACE_H #define MERCATOR_SURFACE_H #include "Buffer.h" #include "Segment.h" #include <climits> namespace Mercator { class Shader; typedef unsigned char ColorT; static const ColorT colorMax = UCHAR_MAX; static const ColorT colorMin = 0; /// \brief Data store for terrain surface data. class Surface : public Buffer<ColorT> { public: /// \brief The shader that populates this surface. const Shader & m_shader; /// The terrain height segment this buffer is associated with. const Segment & m_segment; explicit Surface(const Segment & segment, const Shader & shader, bool colors = true, bool alpha = true); ~Surface() override = default; void populate(); /// Accessor for the terrain height segment this surface is associated with. const Segment & getSegment() const { return m_segment; } // Do we need an accessor presenting the array in colour form? }; } // namespace Mercator #endif // MERCATOR_SURFACE_H 07070100000039000081A4000000000000000000000001656C865A00002E46000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/src/Mercator/Terrain.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "iround.h" #include "Terrain.h" #include "Matrix.h" #include "Segment.h" #include "TerrainMod.h" #include "Shader.h" #include "Area.h" #include "Surface.h" #include <iostream> #include <algorithm> #include <cstdio> namespace Mercator { const unsigned int Terrain::DEFAULT; const unsigned int Terrain::SHADED; constexpr float Terrain::defaultLevel; Terrain::Terrain(unsigned int options, int resolution) : m_options(options), m_res(resolution), m_spacing((float)resolution) { } Terrain::~Terrain() = default; void Terrain::addShader(const Shader * t, int id) { if (m_shaders.count(id)) { std::cerr << "WARNING: duplicate use of shader ID " << id << std::endl; } m_shaders[id] = t; auto I = m_segments.begin(); auto Iend = m_segments.end(); for (; I != Iend; ++I) { auto J = I->second.begin(); auto Jend = I->second.end(); for (; J != Jend; ++J) { auto& seg=J->second; Segment::Surfacestore & sss = seg->getSurfaces(); sss[id] = t->newSurface(*seg); } } } void Terrain::removeShader(const Shader * t, int id) { m_shaders.erase(m_shaders.find(id)); // Delete all surfaces for this shader auto I = m_segments.begin(); auto Iend = m_segments.end(); for (; I != Iend; ++I) { auto J = I->second.begin(); auto Jend = I->second.end(); for (; J != Jend; ++J) { auto& seg=J->second; Segment::Surfacestore & sss = seg->getSurfaces(); auto K = sss.find(id); if (K != sss.end()) { sss.erase(K); } } } } void Terrain::addSurfaces(Segment & seg) { Segment::Surfacestore & sss = seg.getSurfaces(); if (!sss.empty()) { std::cerr << "WARNING: Adding surfaces to a terrain segment which has surfaces" << std::endl << std::flush; sss.clear(); } auto I = m_shaders.begin(); auto Iend = m_shaders.end(); for (; I != Iend; ++I) { // shader doesn't touch this segment, skip if (!I->second->checkIntersect(seg)) { continue; } sss[I->first] = I->second->newSurface(seg); } } void Terrain::shadeSurfaces(Segment & seg) { seg.populateSurfaces(); } float Terrain::get(float x, float z) const { Segment * s = getSegmentAtIndex(posToIndex(x), posToIndex(z)); if ((s == nullptr) || (!s->isValid())) { return Terrain::defaultLevel; } return s->get(I_ROUND(x) - s->getXRef(), I_ROUND(z) - s->getZRef()); } bool Terrain::getHeight(float x, float z, float& h) const { Segment * s = getSegmentAtIndex(posToIndex(x), posToIndex(z)); if ((!s) || (!s->isValid())) { return false; } s->getHeight(x - s->getXRef(), z - s->getZRef(), h); return true; } bool Terrain::getHeightAndNormal(float x, float z, float & h, WFMath::Vector<3> & n) const { Segment * s = getSegmentAtIndex(posToIndex(x), posToIndex(z)); if ((!s) || (!s->isValid())) { return false; } s->getHeightAndNormal(x - s->getXRef(), z - s->getZRef(), h, n); return true; } bool Terrain::getBasePoint(int x, int z, BasePoint& y) const { auto I = m_basePoints.find(x); if (I == m_basePoints.end()) { return false; } auto J = I->second.find(z); if (J == I->second.end()) { return false; } y = J->second; return true; } void Terrain::setBasePoint(int x, int z, const BasePoint& y) { m_basePoints[x][z] = y; bool pointIsSet[3][3]; BasePoint existingPoint[3][3]; for(int i = x - 1, ri = 0; i < x + 2; ++i, ++ri) { for(int j = z - 1, rj = 0; j < z + 2; ++j, ++rj) { pointIsSet[ri][rj] = getBasePoint(i, j, existingPoint[ri][rj]); } } for(int i = x - 1, ri = 0; i < x + 1; ++i, ++ri) { for(int j = z - 1, rj = 0; j < z + 1; ++j, ++rj) { Segment * existingSegment = getSegmentAtIndex(i, j); if (!existingSegment) { bool complete = pointIsSet[ri][rj] && pointIsSet[ri + 1][rj + 1] && pointIsSet[ri + 1][rj] && pointIsSet[ri][rj + 1]; if (!complete) { continue; } auto newSegment = std::make_unique<Segment>(i * m_res, j * m_res, m_res); Matrix<2, 2, BasePoint> & cp = newSegment->getControlPoints(); for(unsigned int k = 0; k < 2; ++k) { for(unsigned int l = 0; l < 2; ++l) { cp(k, l) = existingPoint[ri + k][rj + l]; } } for (auto& entry : m_terrainMods) { auto& terrainMod = entry.second.terrainMod; if (terrainMod->checkIntersects(*newSegment)) { newSegment->updateMod(entry.first, terrainMod.get()); } } // apply shaders last, after all other data is in place if (isShaded()) { addSurfaces(*newSegment); } newSegment->setCornerPoint(ri ? 0 : 1, rj ? 0 : 1, y); m_segments[i][j] = std::move(newSegment); } else { existingSegment->setCornerPoint(ri ? 0 : 1, rj ? 0 : 1, y); } } } } Segment * Terrain::getSegmentAtIndex(int x, int z) const { auto I = m_segments.find(x); if (I == m_segments.end()) { return nullptr; } auto J = I->second.find(z); if (J == I->second.end()) { return nullptr; } return J->second.get(); } void Terrain::processSegments(const WFMath::AxisBox<2>& area, const std::function<void(Segment&, int, int)>& func) const { int lx = I_ROUND(std::floor((area.lowCorner()[0]) / m_spacing)); int lz = I_ROUND(std::floor((area.lowCorner()[1]) / m_spacing)); int hx = I_ROUND(std::ceil((area.highCorner()[0]) / m_spacing)); int hz = I_ROUND(std::ceil((area.highCorner()[1]) / m_spacing)); for (int i = lx; i < hx; ++i) { for (int j = lz; j < hz; ++j) { Segment *s = getSegmentAtIndex(i, j); if (!s) { continue; } func(*s, i, j); } } } Terrain::Rect Terrain::updateMod(long id, std::unique_ptr<TerrainMod> mod) { std::set<Segment*> removed, added, updated; std::unique_ptr<TerrainMod> old_mod; auto I = m_terrainMods.find(id); Rect old_box; if (I != m_terrainMods.end()) { auto& entry = I->second; old_box = entry.rect; //Make sure old mod survives within this method. old_mod = std::move(entry.terrainMod); int lx=I_ROUND(std::floor((old_box.lowCorner()[0] - 1.f) / m_spacing)); int lz=I_ROUND(std::floor((old_box.lowCorner()[1] - 1.f) / m_spacing)); int hx=I_ROUND(std::ceil((old_box.highCorner()[0] + 1.f) / m_spacing)); int hz=I_ROUND(std::ceil((old_box.highCorner()[1] + 1.f) / m_spacing)); for (int i=lx;i<hx;++i) { for (int j=lz;j<hz;++j) { Segment *s=getSegmentAtIndex(i,j); if (!s) { continue; } removed.insert(s); } // of y loop } // of x loop if (!mod) { m_terrainMods.erase(id); } } if (mod) { auto rect = mod->bbox(); int lx=I_ROUND(std::floor((rect.lowCorner()[0] - 1.f) / m_spacing)); int lz=I_ROUND(std::floor((rect.lowCorner()[1] - 1.f) / m_spacing)); int hx=I_ROUND(std::ceil((rect.highCorner()[0] + 1.f) / m_spacing)); int hz=I_ROUND(std::ceil((rect.highCorner()[1] + 1.f) / m_spacing)); for (int i=lx;i<hx;++i) { for (int j=lz;j<hz;++j) { Segment *s=getSegmentAtIndex(i,j); if (!s) { continue; } auto J = removed.find(s); if (J == removed.end()) { added.insert(s); } else { updated.insert(s); removed.erase(J); } } // of y loop } // of x loop for (auto& segment : added) { if (mod->checkIntersects(*segment)) { segment->updateMod(id, mod.get()); } } for (auto& segment : updated) { if (mod->checkIntersects(*segment)) { segment->updateMod(id, mod.get()); } else { segment->updateMod(id, nullptr); } } m_terrainMods[id] = TerrainModEntry{std::move(mod), rect}; } for (auto& segment : removed) { segment->updateMod(id, nullptr); } return old_box; } bool Terrain::hasMod(long id) const { return m_terrainMods.find(id) != m_terrainMods.end(); } const TerrainMod* Terrain::getMod(long id) const { auto I = m_terrainMods.find(id); if (I != m_terrainMods.end()) { return I->second.terrainMod.get(); } return nullptr; } const Area* Terrain::getArea(long id) const { auto I = m_terrainAreas.find(id); if (I != m_terrainAreas.end()) { return I->second.terrainArea.get(); } return nullptr; } Terrain::Rect Terrain::updateArea(long id, std::unique_ptr<Area> area) { std::set<Segment*> removed, added, updated; std::unique_ptr<Area> old_area; auto I = m_terrainAreas.find(id); Rect old_box; if (I != m_terrainAreas.end()) { auto& entry = I->second; old_box = entry.rect; //Make sure old area survives within this method. old_area = std::move(entry.terrainArea); int lx=I_ROUND(std::floor((old_box.lowCorner()[0] - 1.f) / m_spacing)); int lz=I_ROUND(std::floor((old_box.lowCorner()[1] - 1.f) / m_spacing)); int hx=I_ROUND(std::ceil((old_box.highCorner()[0] + 1.f) / m_spacing)); int hz=I_ROUND(std::ceil((old_box.highCorner()[1] + 1.f) / m_spacing)); for (int i=lx;i<hx;++i) { for (int j=lz;j<hz;++j) { Segment *s=getSegmentAtIndex(i,j); if (!s) { continue; } removed.insert(s); } // of y loop } // of x loop if (!area) { m_terrainAreas.erase(id); } } if (area) { auto rect = area->bbox(); int lx=I_ROUND(std::floor((rect.lowCorner()[0] - 1.f) / m_spacing)); int lz=I_ROUND(std::floor((rect.lowCorner()[1] - 1.f) / m_spacing)); int hx=I_ROUND(std::ceil((rect.highCorner()[0] + 1.f) / m_spacing)); int hz=I_ROUND(std::ceil((rect.highCorner()[1] + 1.f) / m_spacing)); for (int i=lx;i<hx;++i) { for (int j=lz;j<hz;++j) { Segment *s=getSegmentAtIndex(i,j); if (!s) { continue; } auto J = removed.find(s); if (J == removed.end()) { added.insert(s); } else { updated.insert(s); removed.erase(J); } } // of y loop } // of x loop const Shader* shader = nullptr; auto shaderI = m_shaders.find(area->getLayer()); if (shaderI != m_shaders.end()) { shader = shaderI->second; } for (auto& segment : added) { if (area->checkIntersects(*segment)) { segment->updateArea(id, area.get(), shader); } } for (auto& segment : updated) { if (area->checkIntersects(*segment)) { segment->updateArea(id, area.get(), shader); } else { segment->updateArea(id, nullptr, nullptr); } } m_terrainAreas[id] = TerrainAreaEntry{std::move(area), rect}; } for (auto& segment : removed) { segment->updateArea(id, nullptr, nullptr); } return old_box; } } // namespace Mercator 0707010000003A000081A4000000000000000000000001656C865A0000319B000000000000000000000000000000000000003300000000mercator-1701611098.a02d15f/src/Mercator/Terrain.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #ifndef MERCATOR_TERRAIN_H #define MERCATOR_TERRAIN_H #include "Mercator.h" #include "BasePoint.h" #include <wfmath/axisbox.h> #include <wfmath/point.h> #include <map> #include <set> #include <list> #include <cmath> #include <tuple> #include <functional> namespace Mercator { class Segment; class Shader; class TerrainMod; class Area; class Effector; /// \brief Class storing centrally all data about an instance of some terrain. /// /// All the data includes: /// - Base Points which define the terrain. /// - Segment data which is the actual heightfields. /// - Shaders which control how the surface appears. /// - Surfaces which are generated by the Shaders (delegated to Segment). /// - TerrainMods which modify the terrain data (delegated to Segment). class Terrain { public: /// \brief Bounding box typedef WFMath::AxisBox<2> Rect; /// \brief STL map to store sparse array of BasePoints. typedef std::map<int, BasePoint> Pointcolumn; /// \brief STL map to store sparse array of Segments. typedef std::map<int, std::unique_ptr<Segment>> Segmentcolumn; /// \brief STL map to store sparse array of BasePoint columns. typedef std::map<int, Pointcolumn > Pointstore; /// \brief STL map to store sparse array of Segment pointer columns. typedef std::map<int, Segmentcolumn > Segmentstore; /// \brief STL map to store sparse array of Shader pointers. typedef std::map<int, const Shader *> Shaderstore; /// \brief value provided for no flags set. static const unsigned int DEFAULT = 0x0000; /// \brief set if shaders are going to be used on this terrain. static const unsigned int SHADED = 0x0001; // More options go here as bit flags, and below should be a private // test function private: /// \brief Bitset of option flags controlling various aspects of terrain. const unsigned int m_options; /// \brief BasePoint resolution, or distance between adjacent points. const int m_res; /// \brief BasePoints spacing, same as m_res in float form for efficiency const float m_spacing; /// \brief 2D spatial container with all BasePoints. Pointstore m_basePoints; /// \brief 2D spatial container with pointers to all Segments. Segmentstore m_segments; /// \brief List of shaders to be applied to terrain. Shaderstore m_shaders; struct TerrainModEntry { /** * The terrain mod. */ std::unique_ptr<TerrainMod> terrainMod; /** * The area it last affected. */ Rect rect; }; /** * \brief Stores all terrain mods, identified using a long identifier. * * The reason for using an identifier is that we must have a stable sorting * mechanism for terrain mods, so that they are applied in the same order to * Segments. */ std::map<long, TerrainModEntry> m_terrainMods; struct TerrainAreaEntry { /** * The terrain area. */ std::unique_ptr<Area> terrainArea; /** * The area it last affected. */ Rect rect; }; /** * Stores all terrain areas, identified using a long identifier. */ std::map<long, TerrainAreaEntry> m_terrainAreas; /// \brief Add the required Surface objects to a Segment. /// /// If shading is enabled, each Segment has a set of Surface objects /// corresponding to the Shader objects available for this terrain. /// This function creates the necessary Surface objects, and adds them /// to the list in the Segment object. At this point the Segment is /// not yet populated with heightfield data, so the Surface cannot /// be populated. A newly constructed surface does not allocate its /// buffer memory, so there is very little overhead to creating it. void addSurfaces(Segment &); /// \brief Populate the Surface objects associated with a Segment. /// /// This is called after a Segment has been populated with heightfield /// data. The actual responsibility for populating the Surface objects /// is in Segment::populateSurfaces(). void shadeSurfaces(Segment &); /// \brief Determine whether this terrain object has shading enabled. /// /// @return true if shading is enabled, false otherwise. bool isShaded() const { return ((m_options & SHADED) == SHADED); } public: /// \brief Height value used when no data is available. static constexpr float defaultLevel = 8.f; /// \brief Construct a new Terrain object with optional options and resolution. /// /// @param options a bitfield of option flags. Defaults to no flags set. /// - DEFAULT value provided for no flags set. /// - SHADED is set if shaders are going to be used on this terrain. /// @param resolution the spacing between adjacent base points. Defaults to 64. explicit Terrain(unsigned int options = DEFAULT, int resolution = defaultResolution); /// \brief Destroy Terrain object, deleting contained objects. /// /// All Segment objects are deleted, but Shader objects are not yet deleted. /// Probably need to be fixed. ~Terrain(); /// \brief Get the height value at a given coordinate x,z. /// /// This is a convenience function provided to quickly get a height /// value at a given point. It always succeeds, as if no height data /// is available it just returns the default value. If a Segment does /// exist in the right place and is populated, the coords within that /// Segment are determined, and the heightfield queried. This function /// does not cause any data to be populated, and does not attempt to /// do any interpolation to get an accurate height figure. For more /// accurate results see Terrain::getHeightAndNormal. float get(float x, float z) const; /// \brief Get an accurate height at a given coordinate x,z. /// /// This is a more expensive function that Terrain::get() for getting an /// accurate height value. /// The main body of functionality is in the Segment::getHeight() function /// called from here. /// The height is interpolated based on a model where each /// tile of the heightfield comprises two triangles. If no heightfield data /// is available for the given location, this function returns false, and /// no data is returned. /// @param x coordinate of point to be returned. /// @param z coordinate of point to be returned. /// @param h reference to variable which will be used to store the resulting /// height value. /// @return true if heightdata was available, false otherwise. bool getHeight(float x, float z, float& h) const; /// \brief Get an accurate height and normal vector at a given coordinate /// x,z. /// /// This is a more expensive function that Terrain::get() for getting an /// accurate height value and surface normal at a given point. The main /// body of functionality is in the Segment::getHeightAndNormal() function /// called from here. /// The height and normal are interpolated based on a model where each /// tile of the heightfield comprises two triangles. If no heightfield data /// is available for the given location, this function returns false, and /// no data is returned. /// @param x coordinate of point to be returned. /// @param z coordinate of point to be returned. /// @param h reference to variable which will be used to store the resulting /// height value. /// @param n reference to variable which will be used to store the resulting /// normal value. /// @return true if heightdata was available, false otherwise. bool getHeightAndNormal(float x, float z, float& h, WFMath::Vector<3>& n) const; /// \brief Get the BasePoint at a given base point coordinate. /// /// Get the BasePoint value for the given coordinate on the base /// point grid. /// @param x coordinate on the base point grid. /// @param z coordinate on the base point grid. /// @param y reference to variable which will be used to store the /// BasePoint data. /// @return true if a BasePoint is defined at the given coordinate, false /// otherwise. bool getBasePoint(int x, int z, BasePoint& y) const; /// \brief Set the BasePoint value at a given base point coordinate. /// /// Set the BasePoint value for the given coordinate on the base /// point grid. /// If inserting this BasePoint completes the set of points required /// to define one or more Segment objects which were not yet defined, /// new Segment objects are created. If this replaces a point for one /// or more Segment objects that were already defined, the contents of /// those Segment objects are invalidated. /// @param x coordinate on the base point grid. /// @param z coordinate on the base point grid. /// @param y BasePoint value to be used at the given coordinate. void setBasePoint(int x, int z, const BasePoint& y); /// \brief Set the height of the basepoint at x,y to z. void setBasePoint(int x, int y, float z) { BasePoint bp(z); setBasePoint(x, y, bp); } /// \brief Get a pointer to the segment which contains the coord x,y /// /// @return Null if no segment is defined at that location, or a pointer /// to a Segment otherwise. Segment * getSegmentAtPos(float x, float z) const; /// \brief Get the Segment at a given index. /// /// Get the Segment pointer for the given coordinate on the base /// point grid. The Segment in question may not have been populated /// with heightfield or surface data. /// @param x coordinate on the base point grid. /// @param z coordinate on the base point grid. /// @return a valid pointer if a Segment is defined at the given coordinate, /// zero otherwise. Segment * getSegmentAtIndex(int x, int z) const; /// \brief Accessor for base point resolution. int getResolution() const { return m_res; } /// \brief Accessor for base point spacing. float getSpacing() const { return m_spacing; } /// \brief Accessor for 2D sparse array of Segment pointers. const Segmentstore & getTerrain() const { return m_segments; } /// \brief Accessor for 2D sparse array of BasePoint objects. const Pointstore & getPoints() const { return m_basePoints; } /// \brief Accessor for list of Shader pointers. const Shaderstore & getShaders() const { return m_shaders; } /// \brief Add a new Shader to the list for this terrain. /// /// As each shader is added, surfaces are added to all existing segments /// to store the result of the shader. void addShader(const Shader * t, int id); /// \brief remove a Shader from the list for this terrain. /// /// As each shader is removed, surfaces are removed from existing segments void removeShader(const Shader * t, int id); /// \brief Updates the terrain with a mod. /// /// @param id The id of the mod, which is also used for ordering. /// @param mod The terrain mod, or null if the entry for the id should be removed. /// @return The area affected by the terrain mod before it was updated. Rect updateMod(long id, std::unique_ptr<TerrainMod> mod); /// \brief Checks if a mod with the supplied id has been registered with the terrain. /// /// @param id The id of the mod to check for. /// @return True if the mod is added to the terrain. bool hasMod(long id) const; const TerrainMod* getMod(long id) const; /// \brief Updates the terrain affected by an area. /// /// @param a The terrain area which has changed, or null if the entry should be removed. /// @return The area affected by the terrain area before it was updated. Rect updateArea(long id, std::unique_ptr<Area> a); const Area* getArea(long id) const; /** * \brief Converts the supplied position into a segment index. * @param pos A position, either x or y. * @return The index */ int posToIndex(float pos) const; /** * Processes all segments within the supplied area. * @param area An area. * @param func Function called for each segment. X and Y index are submitted as second and third arguments. */ void processSegments(const WFMath::AxisBox<2>& area, const std::function<void(Segment&, int, int)>& func) const; }; inline int Terrain::posToIndex(float pos) const { return (int)std::lround(std::floor(pos / m_spacing)); } inline Segment * Terrain::getSegmentAtPos(float x, float z) const { return getSegmentAtIndex(posToIndex(x), posToIndex(z)); } } // namespace Mercator #endif // MERCATOR_TERRAIN_H 0707010000003B000081A4000000000000000000000001656C865A0000045A000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/src/Mercator/TerrainMod.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch, Damien McGinnes #include "TerrainMod_impl.h" #include "Segment.h" namespace Mercator { TerrainMod::TerrainMod() : m_function(set) { } TerrainMod::~TerrainMod() = default; template class ShapeTerrainMod<WFMath::Ball >; template class ShapeTerrainMod<WFMath::Polygon >; template class ShapeTerrainMod<WFMath::RotBox >; template class LevelTerrainMod<WFMath::Ball >; template class LevelTerrainMod<WFMath::Polygon >; template class LevelTerrainMod<WFMath::RotBox >; template class AdjustTerrainMod<WFMath::Ball >; template class AdjustTerrainMod<WFMath::Polygon >; template class AdjustTerrainMod<WFMath::RotBox >; template class SlopeTerrainMod<WFMath::Ball >; template class SlopeTerrainMod<WFMath::Polygon >; template class SlopeTerrainMod<WFMath::RotBox >; template class CraterTerrainMod<WFMath::Ball >; template class CraterTerrainMod<WFMath::Polygon >; template class CraterTerrainMod<WFMath::RotBox >; } // namespace Mercator 0707010000003C000081A4000000000000000000000001656C865A0000163B000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/src/Mercator/TerrainMod.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes, Alistair Riddoch #ifndef MERCATOR_TERRAIN_MOD_H #define MERCATOR_TERRAIN_MOD_H #include "Effector.h" #include <wfmath/intersect.h> #include <wfmath/ball.h> namespace Mercator { class Segment; /// \brief Base class for modifiers to the procedurally generated terrain. /// /// Anything that modifies the terrain implements this interface. class TerrainMod : public Effector { protected: /// \brief Function used to apply this mod to existing points /// /// This makes the basic mods much more powerful without the need for /// extra classes. It completely obsoletes AdjustTerrainMod, which is /// now the same as LevelTerrainMod with this function changed from /// set() to sum() effector_func m_function; public: TerrainMod(); ~TerrainMod() override; /// \brief Change the function used to apply this mod to existing points void setFunction(effector_func f) { m_function = f; } /// \brief Apply this modifier on a terrain segment /// /// The segment is at x,y in local coordinates. /// Output is placed into point. virtual void apply(float &point, int x, int z) const = 0; }; /// \brief Terrain modifier which is defined by a shape variable. /// /// This template extends TerrainMod by adding the ability to query the /// bounding box of the shape that defines this modification to the terrain. template <template <int> class Shape> class ShapeTerrainMod : public TerrainMod { public: /// \brief Constructor /// /// @param s shape of the modifier. explicit ShapeTerrainMod(const Shape<2> &s); ~ShapeTerrainMod() override; bool checkIntersects(const Segment& s) const override; void setShape(const Shape<2> & s); protected: /// \brief Shape of the modifier. Shape<2> m_shape; }; /// \brief Terrain modifier that defines an area of fixed height. /// /// This modifier sets all points inside the shape to the same altitude template <template <int> class Shape> class LevelTerrainMod : public ShapeTerrainMod<Shape> { public: /// \brief Constructor /// /// @param level The height level of all points affected. /// @param s shape of the modifier. LevelTerrainMod(float level, const Shape<2> &s) : ShapeTerrainMod<Shape>(s), m_level(level) {} /// \brief Copy constructor. LevelTerrainMod(LevelTerrainMod&) = delete; virtual ~LevelTerrainMod(); virtual void apply(float &point, int x, int z) const; void setShape(float level, const Shape<2> & s); protected: /// \brief The height level of all points affected. float m_level; }; /// \brief Terrain modifier that defines an area of adjusted height. /// /// This modifier changes the altitude of all points inside the shape /// by the same amount. template <template <int> class Shape> class AdjustTerrainMod : public ShapeTerrainMod<Shape> { public: /// \brief Constructor /// /// @param dist adjustment to the height of all points affected. /// @param s shape of the modifier. AdjustTerrainMod(float dist, const Shape<2> &s) : ShapeTerrainMod<Shape>(s), m_dist(dist) {} /// \brief Copy constructor. AdjustTerrainMod(AdjustTerrainMod&) = delete; virtual ~AdjustTerrainMod(); virtual void apply(float &point, int x, int z) const; void setShape(float dist, const Shape<2> & s); protected: /// \brief Adjustment to the height of all points affected. float m_dist; }; /// \brief Terrain modifier that defines an area of sloped height. /// /// This modifier creates a sloped area. The center point is set to a level /// and all other points are set based on specified gradients. template <template <int> class Shape> class SlopeTerrainMod : public ShapeTerrainMod<Shape> { public: /// \brief Constructor /// /// @param level the height of the centre point. /// @param dx the rate of change of the height along X. /// @param dz the rate of change of the height along Z. /// @param s shape of the modifier. SlopeTerrainMod(float level, float dx, float dz, const Shape<2> &s) : ShapeTerrainMod<Shape>(s), m_level(level), m_dx(dx), m_dz(dz) {} /// \brief Copy constructor. SlopeTerrainMod(SlopeTerrainMod&) = delete; virtual ~SlopeTerrainMod(); virtual void apply(float &point, int x, int z) const; void setShape(float level, float dx, float dz, const Shape<2> & s); protected: /// \brief The height of the centre point. float m_level; /// \brief The rate of change of the height along X. float m_dx; /// \brief The rate of change of the height along Z. float m_dz; }; /// \brief Terrain modifier that defines a crater. /// /// This modifier creates an area where a sphere shaped volume has been /// subtracted from the terrain surface to create a spherical crater. template <template <int> class Shape> class CraterTerrainMod : public ShapeTerrainMod<Shape> { public: /// \brief Constructor /// /// @param s Sphere that defines the shape of the crater. CraterTerrainMod(float level, const Shape<2> &s) : ShapeTerrainMod<Shape>(s), m_level(level) {} /// \brief Copy constructor. CraterTerrainMod(CraterTerrainMod&) = delete; virtual ~CraterTerrainMod(); virtual void apply(float &point, int x, int z) const; void setShape(float level, const Shape<2> & s); protected: /// \brief The height level of the crater center float m_level; }; } //namespace Mercator #endif // MERCATOR_TERRAIN_MOD_H 0707010000003D000081A4000000000000000000000001656C865A00000C8B000000000000000000000000000000000000003B00000000mercator-1701611098.a02d15f/src/Mercator/TerrainMod_impl.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes, Alistair Riddoch #ifndef MERCATOR_TERRAIN_MOD_IMPL_H #define MERCATOR_TERRAIN_MOD_IMPL_H #include "TerrainMod.h" #include "Segment.h" namespace Mercator { template <template <int> class Shape> ShapeTerrainMod<Shape>::ShapeTerrainMod(const Shape<2> &s) : m_shape(s) { m_box = m_shape.boundingBox(); } template <template <int> class Shape> ShapeTerrainMod<Shape>::~ShapeTerrainMod() = default; template <template <int> class Shape> bool ShapeTerrainMod<Shape>::checkIntersects(const Segment& s) const { return WFMath::Intersect(m_shape, s.getRect(), false) || WFMath::Contains(s.getRect(), m_shape.getCorner(0), false); } template <template <int> class Shape> void ShapeTerrainMod<Shape>::setShape(const Shape<2> & s) { m_shape = s; m_box = m_shape.boundingBox(); } template <template <int> class Shape> LevelTerrainMod<Shape>::~LevelTerrainMod() = default; template <template <int> class Shape> void LevelTerrainMod<Shape>::apply(float &point, int x, int z) const { if (Contains(this->m_shape,WFMath::Point<2>(x,z),true)) { point = this->m_function(point, m_level); } } template <template <int> class Shape> void LevelTerrainMod<Shape>::setShape(float level, const Shape<2> & s) { ShapeTerrainMod<Shape>::setShape(s); m_level = level; } template <template <int> class Shape> AdjustTerrainMod<Shape>::~AdjustTerrainMod() = default; template <template <int> class Shape> void AdjustTerrainMod<Shape>::apply(float &point, int x, int z) const { if (Contains(this->m_shape,WFMath::Point<2>(x,z),true)) { point += m_dist; } } template <template <int> class Shape> void AdjustTerrainMod<Shape>::setShape(float dist, const Shape<2> & s) { ShapeTerrainMod<Shape>::setShape(s); m_dist = dist; } template <template <int> class Shape> SlopeTerrainMod<Shape>::~SlopeTerrainMod() = default; template <template <int> class Shape> void SlopeTerrainMod<Shape>::apply(float &point, int x, int z) const { if (Contains(this->m_shape,WFMath::Point<2>(x,z),true)) { float level = m_level + (this->m_shape.getCenter()[0] - x) * m_dx + (this->m_shape.getCenter()[1] - z) * m_dz; point = this->m_function(point, level); } } template <template <int> class Shape> void SlopeTerrainMod<Shape>::setShape(float level, float dx, float dz, const Shape<2> & s) { ShapeTerrainMod<Shape>::setShape(s); m_level = level; m_dx = dx; m_dz = dz; } template <template <int> class Shape> CraterTerrainMod<Shape>::~CraterTerrainMod() = default; template <template <int> class Shape> void CraterTerrainMod<Shape>::apply(float &point, int x, int z) const { if (Contains(this->m_shape,WFMath::Point<2>(x,z),true)) { point += m_level; } } template <template <int> class Shape> void CraterTerrainMod<Shape>::setShape(float level, const Shape<2> & s) { ShapeTerrainMod<Shape>::setShape(s); m_level = level; } } //namespace Mercator #endif // MERCATOR_TERRAIN_MOD_IMPL_H 0707010000003E000081A4000000000000000000000001656C865A000012DE000000000000000000000000000000000000003D00000000mercator-1701611098.a02d15f/src/Mercator/ThresholdShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include "ThresholdShader.h" #include "Segment.h" #include "Surface.h" #include <cassert> namespace Mercator { const std::string HighShader::key_threshold("threshold"); const float HighShader::default_threshold = 1.f; HighShader::HighShader(float threshold) : m_threshold(threshold) { } HighShader::HighShader(const Parameters & params) : m_threshold(default_threshold) { auto I = params.find(key_threshold); auto Iend = params.end(); if (I != Iend) { m_threshold = I->second; } } HighShader::~HighShader() = default; bool HighShader::checkIntersect(const Segment & s) const { if (s.getMax() > m_threshold) { return true; } else { return false; } } void HighShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); assert(channels > 0); unsigned int colors = channels - 1; ColorT * data = s.getData(); const float * height_data = s.getSegment().getPoints(); if (height_data == 0) { std::cerr << "WARNING: Mercator: Attempting to shade empty segment." << std::endl << std::flush; return; } unsigned int size = s.getSegment().getSize(); unsigned int count = size * size; int j = -1; for (unsigned int i = 0; i < count; ++i) { for (unsigned int k = 0; k < colors; ++k) { data[++j] = colorMax; } data[++j] = ((height_data[i] > m_threshold) ? colorMax : colorMin); } } const std::string LowShader::key_threshold("threshold"); const float LowShader::default_threshold = -1.f; LowShader::LowShader(float threshold) : m_threshold(threshold) { } LowShader::LowShader(const Parameters & params) : m_threshold(default_threshold) { auto I = params.find(key_threshold); auto Iend = params.end(); if (I != Iend) { m_threshold = I->second; } } LowShader::~LowShader() = default; bool LowShader::checkIntersect(const Segment & s) const { if (s.getMin() < m_threshold) { return true; } else { return false; } } void LowShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); assert(channels > 0); unsigned int colors = channels - 1; ColorT * data = s.getData(); const float * height_data = s.getSegment().getPoints(); if (height_data == 0) { std::cerr << "WARNING: Mercator: Attempting to shade empty segment." << std::endl << std::flush; return; } unsigned int size = s.getSegment().getSize(); unsigned int count = size * size; int j = -1; for (unsigned int i = 0; i < count; ++i) { for (unsigned int k = 0; k < colors; ++k) { data[++j] = colorMax; } data[++j] = ((height_data[i] < m_threshold) ? colorMax : colorMin); } } const std::string BandShader::key_lowThreshold("lowThreshold"); const std::string BandShader::key_highThreshold("highThreshold"); const float BandShader::default_lowThreshold = -1.f; const float BandShader::default_highThreshold = 1.f; BandShader::BandShader(float low_threshold, float high_threshold) : m_lowThreshold(low_threshold), m_highThreshold(high_threshold) { } BandShader::BandShader(const Parameters & params) : m_lowThreshold(default_lowThreshold), m_highThreshold(default_highThreshold) { auto I = params.find(key_lowThreshold); auto Iend = params.end(); if (I != Iend) { m_lowThreshold = I->second; } I = params.find(key_highThreshold); if (I != Iend) { m_highThreshold = I->second; } } BandShader::~BandShader() = default; bool BandShader::checkIntersect(const Segment & s) const { if ((s.getMin() < m_highThreshold) && (s.getMax() > m_lowThreshold)) { return true; } else { return false; } } void BandShader::shade(Surface & s) const { unsigned int channels = s.getChannels(); assert(channels > 0); unsigned int colors = channels - 1; ColorT * data = s.getData(); const float * height_data = s.getSegment().getPoints(); if (height_data == nullptr) { std::cerr << "WARNING: Mercator: Attempting to shade empty segment." << std::endl << std::flush; return; } unsigned int size = s.getSegment().getSize(); unsigned int count = size * size; int j = -1; for (unsigned int i = 0; i < count; ++i) { for (unsigned int k = 0; k < colors; ++k) { data[++j] = colorMax; } data[++j] = (((height_data[i] > m_lowThreshold) && (height_data[i] < m_highThreshold)) ? colorMax : colorMin); } } } // namespace Mercator 0707010000003F000081A4000000000000000000000001656C865A00000EF4000000000000000000000000000000000000003B00000000mercator-1701611098.a02d15f/src/Mercator/ThresholdShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_FILL_THRESHOLD_SHADER_H #define MERCATOR_FILL_THRESHOLD_SHADER_H #include "Shader.h" namespace Mercator { /// \brief Surface shader that defines the surface above a given level. class HighShader : public Shader { private: /// The level above which the shader renders. float m_threshold; public: /// Key string used when specifying the threshold parameter. static const std::string key_threshold; /// Default level above which the shader renders. static const float default_threshold; /// \brief Constructor /// /// @param threshold level below which the shader renders. explicit HighShader(float threshold = default_threshold); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit HighShader(const Parameters & params); ~HighShader() override; /// Accessor for level above which the shader renders. float threshold() const { return m_threshold; } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; /// \brief Surface shader that defines the surface below a given level. class LowShader : public Shader { private: /// The level below which the shader renders. float m_threshold; public: /// Key string used when specifying the threshold parameter. static const std::string key_threshold; /// Default level below which the shader renders. static const float default_threshold; /// \brief Constructor /// /// @param threshold level below which the shader renders. explicit LowShader(float threshold = default_threshold); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit LowShader(const Parameters & params); ~LowShader() override; /// Accessor for level below which the shader renders. float threshold() const { return m_threshold; } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; /// \brief Surface shader that defines the surface between two levels. class BandShader : public Shader { private: /// The level above which the shader renders. float m_lowThreshold; /// The level below which the shader renders. float m_highThreshold; public: /// Key string used when specifying the low threshold parameter. static const std::string key_lowThreshold; /// Key string used when specifying the high threshold parameter. static const std::string key_highThreshold; /// Default level above which the shader renders. static const float default_lowThreshold; /// Default level below which the shader renders. static const float default_highThreshold; /// \brief Constructor /// /// @param low_threshold level above which the shader renders. /// @param high_threshold level below which the shader renders. explicit BandShader(float low_threshold = default_lowThreshold, float high_threshold = default_highThreshold); /// \brief Constructor /// /// @param params a map of parameters for the shader. explicit BandShader(const Parameters & params); ~BandShader() override; /// Accessor for the level above which the shader renders. float lowThreshold() const { return m_lowThreshold; } /// Accessor for the level below which the shader renders. float highThreshold() const { return m_highThreshold; } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; } // namespace Mercator #endif // MERCATOR_FILL_THRESHOLD_SHADER_H 07070100000040000081A4000000000000000000000001656C865A000004B1000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/src/Mercator/TileShader.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #include "TileShader.h" #include "Segment.h" #include "Surface.h" #include <cassert> namespace Mercator { TileShader::TileShader() = default; TileShader::~TileShader() = default; bool TileShader::checkIntersect(const Segment & s) const { return true; } void TileShader::shade(Surface & surface) const { ColorT * sdata = surface.getData(); auto sdata_len = surface.getSize() * surface.getSize(); auto I = m_subShaders.begin(); auto Iend = m_subShaders.end(); for (; I != Iend; ++I) { if (!I->second->checkIntersect(surface.getSegment())) { continue; } auto subs = I->second->newSurface(surface.getSegment()); assert(subs); subs->populate(); ColorT * subsdata = subs->getData(); auto channels = subs->getChannels(); for (unsigned int i = 0; i < sdata_len; ++i) { if (subsdata[i * channels + channels - 1] > 127) { sdata[i] = I->first; } } } } } // namespace Mercator 07070100000041000081A4000000000000000000000001656C865A00000553000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/src/Mercator/TileShader.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #ifndef MERCATOR_TILE_SHADER_H #define MERCATOR_TILE_SHADER_H #include "Shader.h" #include <map> namespace Mercator { /// \brief Shader agregating surface data. /// /// Some applications require the terrain surface data be stored in a /// single buffer so specific locations can be queried to determine the type. /// Typically this is used on a server, where lots of surface data optimised /// for rendering is not required, but fast cheap queries about the surface /// at a specific point are required. class TileShader : public Shader { public: /// \brief STL map to store sparse array of Shader pointers. typedef std::map<int, std::unique_ptr<Shader>> Shaderstore; private: /// \brief Store of shaders which are agregated by this shader. Shaderstore m_subShaders; public: explicit TileShader(); ~TileShader() override; /// \brief Add a shader to those agregated by the tile shader. void addShader(std::unique_ptr<Shader> t, int id) { m_subShaders[id] = std::move(t); } bool checkIntersect(const Segment &) const override; void shade(Surface &) const override; }; } // namespace Mercator #endif // MERCATOR_TILE_SHADER_H 07070100000042000081A4000000000000000000000001656C865A00000136000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/src/Mercator/iround.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifndef MERCATOR_IROUND_H #define MERCATOR_IROUND_H #include <cmath> #define I_ROUND(_x) (std::lround(_x)) #endif // MERCATOR_IROUND_H 07070100000043000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000002200000000mercator-1701611098.a02d15f/tests07070100000044000081A4000000000000000000000001656C865A000005E3000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tests/AreaShadertest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/Area.h> #include <Mercator/AreaShader.h> #include <Mercator/Segment.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> typedef WFMath::Point<2> Point2; void testAreaShader() { auto a1 = std::make_unique<Mercator::Area>(1, false); auto a1_ptr = a1.get(); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(3, 4)); p.addCorner(p.numCorners(), Point2(10, 10)); p.addCorner(p.numCorners(), Point2(14, 6)); p.addCorner(p.numCorners(), Point2(18, 4)); p.addCorner(p.numCorners(), Point2(17, 19)); p.addCorner(p.numCorners(), Point2(6, 20)); p.addCorner(p.numCorners(), Point2(-1, 18)); p.addCorner(p.numCorners(), Point2(-8, 11)); a1->setShape(p); Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::AreaShader ashade(1); terrain.addShader(&ashade, 0); terrain.setBasePoint(0, 0, -1); terrain.setBasePoint(0, 1, 8); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 11); terrain.updateArea(1, std::move(a1)); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); assert(a1_ptr->checkIntersects(*seg)); seg->populateSurfaces(); } int main() { testAreaShader(); return 0; } 07070100000045000081A4000000000000000000000001656C865A00001EA7000000000000000000000000000000000000002F00000000mercator-1701611098.a02d15f/tests/Areatest.cpp#include <Mercator/Area.h> #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/Surface.h> #include <Mercator/AreaShader.h> #include <Mercator/FillShader.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cstdlib> #include <cassert> #include <iostream> #include <fstream> typedef WFMath::Point<2> Point2; void writePGMForSurface(const std::string& fileName, int sz, Mercator::Surface* s) { assert(s); std::ofstream file(fileName.c_str()); file << "P5" << std::endl; file << sz << ' ' << sz << " 255" << std::endl; // now just blast out the binary file.write((const char*) s->getData(), sz * sz); file.close(); } void testAreaShader() { auto a1 = std::make_unique<Mercator::Area>(1, false); auto a1_ptr= a1.get(); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(3, 4)); p.addCorner(p.numCorners(), Point2(10, 10)); p.addCorner(p.numCorners(), Point2(14, 6)); p.addCorner(p.numCorners(), Point2(18, 4)); p.addCorner(p.numCorners(), Point2(17, 19)); p.addCorner(p.numCorners(), Point2(6, 20)); p.addCorner(p.numCorners(), Point2(-1, 18)); p.addCorner(p.numCorners(), Point2(-8, 11)); a1->setShape(p); auto a2 = std::make_unique<Mercator::Area>(1, false); WFMath::Polygon<2> p2; p2.addCorner(p2.numCorners(), Point2(25, 18)); p2.addCorner(p2.numCorners(), Point2(72, 22)); p2.addCorner(p2.numCorners(), Point2(60, 30)); p2.addCorner(p2.numCorners(), Point2(27, 28)); p2.addCorner(p2.numCorners(), Point2(25, 45)); p2.addCorner(p2.numCorners(), Point2(3, 41)); p2.addCorner(p2.numCorners(), Point2(-2, 20)); a2->setShape(p2); Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::FillShader base_shader{Mercator::Shader::Parameters()}; terrain.addShader(&base_shader, 0); Mercator::AreaShader ashade(1); terrain.addShader(&ashade, 1); terrain.setBasePoint(0, 0, -1); terrain.setBasePoint(0, 1, 8); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 11); terrain.setBasePoint(2, 0, 2); terrain.setBasePoint(2, 1, 11); terrain.updateArea(1, std::move(a1)); // terrain.addArea(a2); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); assert(a1_ptr->checkIntersects(*seg)); seg->populateSurfaces(); writePGMForSurface("test1.pgm", seg->getSize(), seg->getSurfaces()[1].get()); seg = terrain.getSegmentAtIndex(1,0); seg->populateSurfaces(); writePGMForSurface("test2.pgm", seg->getSize(), seg->getSurfaces()[1].get()); } static const unsigned int seg_size = 8; void testCheckIntersect() { Mercator::Area a1(1, false); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(1, 1)); p.addCorner(p.numCorners(), Point2(6, 1)); p.addCorner(p.numCorners(), Point2(6, 6)); p.addCorner(p.numCorners(), Point2(1, 6)); a1.setShape(p); Mercator::Segment seg1(0,0,seg_size); bool success = a1.checkIntersects(seg1); assert(success); Mercator::Segment seg2 (1 * seg_size,0,seg_size); success = a1.checkIntersects(seg2); assert(!success); } int main(int argc, char* argv[]) { auto a1 = std::make_unique<Mercator::Area>(1, false); auto a1_ptr = a1.get(); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(3, 4)); p.addCorner(p.numCorners(), Point2(10, 10)); p.addCorner(p.numCorners(), Point2(-1, 18)); p.addCorner(p.numCorners(), Point2(-8, 11)); a1->setShape(p); Mercator::Terrain terrain(Mercator::Terrain::SHADED, seg_size); Mercator::AreaShader ashade(1); terrain.addShader(&ashade, 0); terrain.setBasePoint(-2, -1, 5); terrain.setBasePoint(-2, 0, 2); terrain.setBasePoint(-2, 1, 19); terrain.setBasePoint(-1, -1, 4); terrain.setBasePoint(-1, 0, 6); terrain.setBasePoint(-1, 1, 10); terrain.setBasePoint(0, -1, 2); terrain.setBasePoint(0, 0, -1); terrain.setBasePoint(0, 1, 8); terrain.setBasePoint(0, 2, 11); terrain.setBasePoint(1, -1, 7); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 11); terrain.setBasePoint(1, 2, 9); terrain.setBasePoint(2, -1, 3); terrain.setBasePoint(2, 0, 8); terrain.setBasePoint(2, 1, 2); terrain.setBasePoint(3, -1, 6); terrain.setBasePoint(3, 0, 7); terrain.setBasePoint(3, 1, 9); terrain.updateArea(1, std::move(a1)); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_ptr->checkIntersects(*seg)); seg = terrain.getSegmentAtIndex(1,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); assert(a1_ptr->checkIntersects(*seg) == false); WFMath::Polygon<2> clipped = a1_ptr->clipToSegment(*seg); assert(clipped.isValid()); seg = terrain.getSegmentAtIndex(-1,0); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_ptr->checkIntersects(*seg)); clipped = a1_ptr->clipToSegment(*seg); assert(clipped.isValid()); seg = terrain.getSegmentAtIndex(0,1); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_ptr->checkIntersects(*seg)); clipped = a1_ptr->clipToSegment(*seg); assert(clipped.isValid()); seg = terrain.getSegmentAtIndex(2,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); assert(a1_ptr->checkIntersects(*seg) == false); p.clear(); p.addCorner(p.numCorners(), Point2(3 + seg_size, 4)); p.addCorner(p.numCorners(), Point2(10 + seg_size, 10)); p.addCorner(p.numCorners(), Point2(-1 + seg_size, 18)); p.addCorner(p.numCorners(), Point2(-8 + seg_size, 11)); auto a1_2 = std::make_unique<Mercator::Area>(1, false); auto a1_2_ptr = a1_2.get(); a1_2->setShape(p); terrain.updateArea(1, std::move(a1_2)); seg = terrain.getSegmentAtIndex(0,0); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_2_ptr->checkIntersects(*seg)); seg = terrain.getSegmentAtIndex(1,0); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_2_ptr->checkIntersects(*seg)); clipped = a1_2_ptr->clipToSegment(*seg); assert(clipped.isValid()); seg = terrain.getSegmentAtIndex(-1,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); assert(a1_2_ptr->checkIntersects(*seg) == false); seg = terrain.getSegmentAtIndex(0,1); assert(seg->getAreas().size() == 1); assert(seg->getAreas().count(1) == 1); assert(a1_2_ptr->checkIntersects(*seg)); clipped = a1_2_ptr->clipToSegment(*seg); assert(clipped.isValid()); seg = terrain.getSegmentAtIndex(2,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); assert(a1_2_ptr->checkIntersects(*seg) == false); clipped = a1_2_ptr->clipToSegment(*seg); assert(clipped.isValid()); terrain.updateArea(1, nullptr); seg = terrain.getSegmentAtIndex(0,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); seg = terrain.getSegmentAtIndex(1,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); seg = terrain.getSegmentAtIndex(-1,0); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); seg = terrain.getSegmentAtIndex(0,1); assert(seg->getAreas().empty()); assert(seg->getAreas().count(1) == 0); testAreaShader(); testCheckIntersect(); return EXIT_SUCCESS; } 07070100000046000081A4000000000000000000000001656C865A00000256000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/tests/BasePointtest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/BasePoint.h> #include <cassert> int main() { Mercator::BasePoint bp1; bp1.falloff() = 2.0; bp1.height() = 3.0; bp1.roughness() = 4.0; assert(bp1 == Mercator::BasePoint(3.0, 4.0, 2.0)); assert(bp1 != Mercator::BasePoint(3.0, 4.0, 3.0)); assert(bp1.seed() == Mercator::BasePoint(3.0, 4.0, 3.0).seed()); assert(bp1.seed() != Mercator::BasePoint(4.0, 4.0, 3.0).seed()); return 0; } 07070100000047000081A4000000000000000000000001656C865A00000158000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/Buffertest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Buffer.h> #include <Mercator/Segment.h> int main() { Mercator::Segment s(0,0,64); Mercator::Buffer<float> b(64, 4); return 0; } // stubs 07070100000048000081A4000000000000000000000001656C865A00000347000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/CMakeLists.txtwf_add_test(main.cpp) wf_add_test(Terraintest.cpp) wf_add_test(Shadertest.cpp) wf_add_test(TerrainModtest.cpp) wf_add_test(Intersecttest.cpp) wf_add_test(testPhys.cpp) wf_add_test(Planttest.cpp) wf_add_test(Foresttest.cpp) wf_add_test(testQRNG.cpp) wf_add_test(Areatest.cpp) wf_add_test(TileShadertest.cpp) wf_add_test(ShaderFactorytest.cpp) wf_add_test(testWFMath.cpp) wf_add_test(Buffertest.cpp) wf_add_test(Segmenttest.cpp) wf_add_test(AreaShadertest.cpp) wf_add_test(BasePointtest.cpp) wf_add_test(DepthShadertest.cpp) wf_add_test(FillShadertest.cpp) wf_add_test(GrassShadertest.cpp) wf_add_test(ThresholdShadertest.cpp) wf_add_test(Matrixtest.cpp) wf_add_test(TerrainaddAreatest.cpp) wf_add_test(Segmentperf.cpp) CHECK_INCLUDE_FILE(unistd.h HAS_UNISTD) if (HAS_UNISTD) wf_add_test(timeSeg.cpp util_timer.cpp util_timer.h) endif() 07070100000049000081A4000000000000000000000001656C865A000004C7000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/tests/DepthShadertest.cpp // This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/DepthShader.h> #include <Mercator/Segment.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> typedef WFMath::Point<2> Point2; void testDepthShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; params[Mercator::DepthShader::key_waterLevel] = 0.f; params[Mercator::DepthShader::key_murkyDepth] = -12.f; Mercator::DepthShader dshade(params); terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, -20); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 0.5); terrain.setBasePoint(2, 0, 2); terrain.setBasePoint(2, 1, 0.5); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populateSurfaces(); seg->populate(); seg->populateSurfaces(); seg = terrain.getSegmentAtIndex(1,0); dshade.checkIntersect(*seg); } int main() { testDepthShader(); return 0; } 0707010000004A000081A4000000000000000000000001656C865A0000039E000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tests/FillShadertest.cpp // This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/FillShader.h> #include <Mercator/Segment.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> typedef WFMath::Point<2> Point2; void testFillShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; Mercator::FillShader dshade{params}; terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, -20); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 0.5); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populate(); seg->populateSurfaces(); } int main() { testFillShader(); return 0; } 0707010000004B000081A4000000000000000000000001656C865A00000E1E000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/Foresttest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <Mercator/Forest.h> #include <Mercator/Plant.h> #include <Mercator/Area.h> #include <iostream> #include <cassert> typedef WFMath::Point<2> Point2; void dumpPlants(const Mercator::Forest::PlantStore & plants) { auto I = plants.begin(); for(; I != plants.end(); ++I) { auto J = I->second.begin(); for(; J != I->second.end(); ++J) { const Mercator::Plant & p = J->second; std::cout << "Query found plant at [" << I->first << ", " << J->first << "] with height " << p.m_height; std::cout << " displaced to " << (WFMath::Vector<2>(I->first, J->first) + p.m_displacement) << std::endl << std::flush; } } } int countPlants(const Mercator::Forest::PlantStore & plants) { int plant_count = 0; auto I = plants.begin(); for(; I != plants.end(); ++I) { plant_count += I->second.size(); } return plant_count; } int main() { // Test constructor { Mercator::Forest mf; } // Test constructor { Mercator::Forest mf(23); } // Test getArea() { Mercator::Forest mf; Mercator::Area * a = mf.getArea(); assert(a == 0); } // Test species() { Mercator::Forest mf; Mercator::Forest::PlantSpecies & mps = mf.species(); assert(mps.empty()); } { Mercator::Forest forest(4249162ul); Mercator::Forest::PlantSpecies & species = forest.species(); const Mercator::Forest::PlantStore & plants = forest.getPlants(); // Forest is not yet populated assert(plants.empty()); assert(species.empty()); forest.populate(); // Forest has zero area, so even when populated it is empty assert(plants.empty()); assert(species.empty()); Mercator::Area ar(1, false); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(5, 8)); p.addCorner(p.numCorners(), Point2(40, -1)); p.addCorner(p.numCorners(), Point2(45, 16)); p.addCorner(p.numCorners(), Point2(30, 28)); p.addCorner(p.numCorners(), Point2(-2, 26)); p.addCorner(p.numCorners(), Point2(1, 5)); ar.setShape(p); forest.setArea(&ar); forest.populate(); // Forest has no species, so even when populated it is empty assert(plants.empty()); assert(species.empty()); { Mercator::Species pine; pine.m_probability = 0.04; pine.m_deviation = 1.f; species.push_back(pine); } forest.populate(); // Forest should now contain some plants assert(!plants.empty()); dumpPlants(plants); int plant_count = countPlants(plants); { Mercator::Species oak; oak.m_probability = 0.02; oak.m_deviation = 1.f; species.push_back(oak); } forest.populate(); // Forest should now contain some plants assert(!plants.empty()); assert(countPlants(plants) > plant_count); dumpPlants(plants); std::cout << countPlants(plants) << "," << plant_count << std::endl << std::flush; } } 0707010000004C000081A4000000000000000000000001656C865A00000560000000000000000000000000000000000000003600000000mercator-1701611098.a02d15f/tests/GrassShadertest.cpp // This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/GrassShader.h> #include <Mercator/Segment.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> typedef WFMath::Point<2> Point2; void testGrassShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; params[Mercator::GrassShader::key_lowThreshold] = 2.f; params[Mercator::GrassShader::key_highThreshold] = 15.f; params[Mercator::GrassShader::key_cutoff] = 0.4f; params[Mercator::GrassShader::key_intercept] = 4.f; Mercator::GrassShader dshade{params}; terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, 20); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 0.5); terrain.setBasePoint(2, 0, 2); terrain.setBasePoint(2, 1, 0.5); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populateSurfaces(); seg->populate(); seg->populateSurfaces(); // This segment is too low to shade seg = terrain.getSegmentAtIndex(1,0); dshade.checkIntersect(*seg); } int main() { testGrassShader(); return 0; } 0707010000004D000081A4000000000000000000000001656C865A00001CBB000000000000000000000000000000000000003400000000mercator-1701611098.a02d15f/tests/Intersecttest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/Intersect.h> #include <iostream> #include <cstdlib> #include <vector> #include <string> #include <sstream> #include <cassert> #include <algorithm> int main() { Mercator::Terrain terrain; terrain.setBasePoint(0, 0, 2.8); terrain.setBasePoint(1, 0, 7.1); terrain.setBasePoint(0, 1, 0.2); terrain.setBasePoint(1, 1, 14.7); Mercator::Segment * segment = terrain.getSegmentAtIndex(0, 0); if (!segment) { std::cerr << "Segment not created by addition of required basepoints" << std::endl; return 1; } segment->populate(); //test box definitely outside terrain WFMath::AxisBox<3> highab(WFMath::Point<3> (10.0, segment->getMax() + 3.0, 10.0), WFMath::Point<3> (20.0, segment->getMax() + 6.1, 20.0)); if (Mercator::Intersect(terrain, highab)) { std::cerr << "axisbox intersects with terrain even though it should be above it" << std::endl; return 1; } //test box definitely inside terrain WFMath::AxisBox<3> lowab(WFMath::Point<3> (10.0, segment->getMin() - 6.1, 10.0), WFMath::Point<3> (20.0, segment->getMax() - 3.0, 20.0)); if (!Mercator::Intersect(terrain, lowab)) { std::cerr << "axisbox does not intersect with terrain even though it should be below it" << std::endl; return 1; } //test axis box moved from above terrain to below it. bool inter=false; auto dy = highab.highCorner()[1] - highab.lowCorner()[1] - 0.1; while (highab.highCorner()[1] > segment->getMin()) { highab.shift(WFMath::Vector<3>(0.0, -dy, 0.0)); if (Mercator::Intersect(terrain, highab)) { inter=true; break; } } if (!inter) { std::cerr << "axisbox passed through terrain with no intersection" << std::endl; return 1; } //test axisbox that spans two segments terrain.setBasePoint(0, 2, 4.8); terrain.setBasePoint(1, 2, 3.7); Mercator::Segment *segment2 = terrain.getSegmentAtIndex(0, 1); segment2->populate(); float segmax=std::max(segment->getMax(), segment2->getMax()); float segmin=std::min(segment->getMin(), segment2->getMin()); WFMath::AxisBox<3> ab(WFMath::Point<3> (50.0, segmax + 3.0, 10.0), WFMath::Point<3> (70.0, segmax + 6.1, 20.0)); if (Mercator::Intersect(terrain, ab)) { std::cerr << "axisbox2 intersects with terrain even though it should be above it" << std::endl; return 1; } WFMath::AxisBox<3> ab2(WFMath::Point<3> (50.0, segmin - 6.1, 10.0), WFMath::Point<3> (70.0, segmin + 3.0, 20.0)); if (!Mercator::Intersect(terrain, ab2)) { std::cerr << "axisbox2 does not intersect with terrain even though it should be below it" << std::endl; return 1; } WFMath::Point<3> intPoint; WFMath::Vector<3> intNorm; double par; //test vertical ray if (Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(0.0,50.0,0.0), intPoint, intNorm, par)) { std::cerr << "vertical ray intersected when it shouldnt" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(0.0,-50.0,0.0), intPoint, intNorm, par)) { std::cerr << "vertical ray didnt intersect when it should" << std::endl; return 1; } //test each quadrant if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(10.0,-100.0,10.0), intPoint, intNorm, par)) { std::cerr << "quad1 ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(10.0,-50.0,-15.0), intPoint, intNorm, par)) { std::cerr << "quad2 ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(-10.0,-50.0,-10.0), intPoint, intNorm, par)) { std::cerr << "quad3 ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(-10.0,-50.0,10.0), intPoint, intNorm, par)) { std::cerr << "quad4 ray didnt intersect when it should" << std::endl; return 1; } //test dx==0 and dy==0 if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(0.0,-50.0,10.0), intPoint, intNorm, par)) { std::cerr << "y+ ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(0.0,-50.0,-10.0), intPoint, intNorm, par)) { std::cerr << "y- ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(-10.0,-50.0,0.0), intPoint, intNorm, par)) { std::cerr << "x- ray didnt intersect when it should" << std::endl; return 1; } if (!Mercator::Intersect(terrain, WFMath::Point<3>(20.1, segmax + 3, 20.2), WFMath::Vector<3>(10.0,-50.0,0.0), intPoint, intNorm, par)) { std::cerr << "x+ ray didnt intersect when it should" << std::endl; return 1; } //test a longer ray if (!Mercator::Intersect(terrain, WFMath::Point<3>(-10.08, segmax + 3, -20.37), WFMath::Vector<3>(100.0,-50.0,183.0), intPoint, intNorm, par)) { std::cerr << "long ray didnt intersect when it should" << std::endl; return 1; } //check the height value float h; WFMath::Vector<3> n; terrain.getHeightAndNormal((float)intPoint[0], (float)intPoint[2], h, n); n.normalize(); if (n != intNorm) { std::cerr << "calculated normal is different from getHeightAndNormal" << std::endl; std::cerr << intPoint << std::endl; std::cerr << intNorm << "!=" << n << std::endl; // return 1; } // We can't check for equality here is it just doesn't work with // floats. Look it up in any programming book if you don't believe me. // - 20040721 <alriddoch@zepler.org> if (!WFMath::Equal(h, (float)intPoint[1])) { std::cerr << "calculated height is different from getHeightAndNormal" << std::endl; std::cerr << h << "!=" << intPoint[1] << std::endl; return 1; } return 0; } 0707010000004E000081A4000000000000000000000001656C865A00000135000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/Matrixtest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Matrix.h> int main() { Mercator::Matrix<2,2> m; Mercator::Matrix<4,4> n; m(0,0) = 1.f; return 0; } 0707010000004F000081A4000000000000000000000001656C865A00000499000000000000000000000000000000000000003000000000mercator-1701611098.a02d15f/tests/Planttest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #include <Mercator/Plant.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> int main() { { Mercator::Plant a, b; const WFMath::Point<2> & p1 = a.m_displacement; assert(!p1.isValid()); WFMath::Point<2> p2 = a.m_displacement; assert(!p2.isValid()); a.m_displacement = WFMath::Point<2>(2.5f, 3.f); const WFMath::Point<2> & p3 = a.m_displacement; assert(p3.isValid()); const WFMath::Quaternion & q1 = b.m_orientation; assert(!q1.isValid()); WFMath::Quaternion q2 = b.m_orientation; assert(!q2.isValid()); b.m_orientation = WFMath::Quaternion(2, 2.124f); const WFMath::Quaternion & q3 = b.m_orientation; assert(q3.isValid()); Mercator::Plant * c = new Mercator::Plant(); c->m_height = 5.5f; delete c; Mercator::Plant * d = new Mercator::Plant[10]; d->m_height = 15.5f; delete [] d; } } 07070100000050000081A4000000000000000000000001656C865A00000343000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/tests/Segmentperf.cpp // This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Segment.h> #include <wfmath/point.h> #include <wfmath/axisbox.h> #include <cstdlib> int main(int argc, char ** argv) { int iterations = 1; if (argc > 1) { iterations = strtol(argv[1], 0, 10); } Mercator::Segment s(0,0,64); Mercator::Matrix<2,2,Mercator::BasePoint> & points = s.getControlPoints(); points(0, 0).roughness() = 1.85; points(1, 0).roughness() = 1.75; points(0, 1).roughness() = 1.65; points(1, 1).roughness() = 1.95; for (int i = 0; i < iterations; ++i) { s.populate(); } return 0; } // stubs #include <Mercator/Shader.h> #include <Mercator/Surface.h> 07070100000051000081A4000000000000000000000001656C865A0000036E000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/tests/Segmenttest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Segment.h> #include <wfmath/point.h> #include <wfmath/axisbox.h> int main() { Mercator::Segment s(0,0,64); s.populate(); s.populateNormals(); s.populateSurfaces(); s.invalidate(); s.populate(); s.populateNormals(); s.populateSurfaces(); float h; WFMath::Vector<3> normal; s.getHeightAndNormal(17.0, 23.0, h, normal); s.getHeightAndNormal(17.9, 23.1, h, normal); s.getHeightAndNormal(17.1, 23.9, h, normal); int lx, ly, hx, hy; s.clipToSegment(WFMath::AxisBox<2>(WFMath::Point<2>(50,50), WFMath::Point<2>(100,100)), lx, hx, ly, hy); return 0; } // stubs #include <Mercator/Shader.h> #include <Mercator/Surface.h> 07070100000052000081A4000000000000000000000001656C865A0000131B000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/tests/ShaderFactorytest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Alistair Riddoch #include <Mercator/ShaderFactory.h> #include <Mercator/FillShader.h> #include <Mercator/ThresholdShader.h> #include <Mercator/DepthShader.h> #include <Mercator/GrassShader.h> #include <iostream> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> using Mercator::GrassShader; using Mercator::DepthShader; using Mercator::FillShader; using Mercator::HighShader; using Mercator::LowShader; using Mercator::BandShader; int main() { Mercator::ShaderFactories factories; Mercator::Shader::Parameters params; std::unique_ptr<Mercator::Shader> shader; //////////////////////// Grass Shader ////////////////////////////// shader = factories.newShader("grass", params); GrassShader * grass_shader = dynamic_cast<GrassShader *>(shader.get()); assert(grass_shader != 0); assert(grass_shader->lowThreshold() == GrassShader::default_lowThreshold); assert(grass_shader->highThreshold() == GrassShader::default_highThreshold); assert(grass_shader->cutoff() == GrassShader::default_cutoff); assert(grass_shader->intercept() == GrassShader::default_intercept); params[GrassShader::key_lowThreshold] = 2.f; params[GrassShader::key_highThreshold] = 40.f; params[GrassShader::key_cutoff] = 2.f; params[GrassShader::key_intercept] = 3.f; shader = factories.newShader("grass", params); grass_shader = dynamic_cast<GrassShader *>(shader.get()); assert(grass_shader != 0); assert(grass_shader->lowThreshold() == 2.f); assert(grass_shader->highThreshold() == 40.f); assert(grass_shader->cutoff() == 2.f); assert(grass_shader->intercept() == 3.f); params.clear(); //////////////////////// Depth Shader ////////////////////////////// shader = factories.newShader("depth", params); DepthShader * depth_shader = dynamic_cast<DepthShader *>(shader.get()); assert(depth_shader != 0); assert(depth_shader->waterLevel() == DepthShader::default_waterLevel); assert(depth_shader->murkyDepth() == DepthShader::default_murkyDepth); params[DepthShader::key_waterLevel] = 1.f; params[DepthShader::key_murkyDepth] = -40.f; shader = factories.newShader("depth", params); depth_shader = dynamic_cast<DepthShader *>(shader.get()); assert(depth_shader != 0); assert(depth_shader->waterLevel() == 1.f); assert(depth_shader->murkyDepth() == -40.f); params.clear(); //////////////////////// Fill Shader ////////////////////////////// shader = factories.newShader("fill", params); assert(dynamic_cast<FillShader *>(shader.get()) != 0); params.clear(); //////////////////////// High Shader ////////////////////////////// shader = factories.newShader("high", params); HighShader * high_shader = dynamic_cast<HighShader *>(shader.get()); assert(high_shader != 0); assert(high_shader->threshold() == HighShader::default_threshold); params[HighShader::key_threshold] = 2.f; shader = factories.newShader("high", params); high_shader = dynamic_cast<HighShader *>(shader.get()); assert(high_shader != 0); assert(high_shader->threshold() == 2.f); params.clear(); //////////////////////// Low Shader ////////////////////////////// shader = factories.newShader("low", params); LowShader * low_shader = dynamic_cast<LowShader *>(shader.get()); assert(low_shader != 0); assert(low_shader->threshold() == LowShader::default_threshold); params[LowShader::key_threshold] = -2.f; shader = factories.newShader("low", params); low_shader = dynamic_cast<LowShader *>(shader.get()); assert(low_shader != 0); assert(low_shader->threshold() == -2.f); params.clear(); //////////////////////// Band Shader ////////////////////////////// shader = factories.newShader("band", params); BandShader * band_shader = dynamic_cast<BandShader *>(shader.get()); assert(band_shader != 0); assert(band_shader->lowThreshold() == BandShader::default_lowThreshold); assert(band_shader->highThreshold() == BandShader::default_highThreshold); params[BandShader::key_lowThreshold] = -2.f; params[BandShader::key_highThreshold] = 2.f; shader = factories.newShader("band", params); band_shader = dynamic_cast<BandShader *>(shader.get()); assert(band_shader != 0); assert(band_shader->lowThreshold() == -2.f); assert(band_shader->highThreshold() == 2.f); params.clear(); //////////////////////// No Shader ////////////////////////////// shader = factories.newShader("", params); assert(shader == 0); params.clear(); shader = factories.newShader("unknown_shader", params); assert(shader == 0); return 0; } 07070100000053000081A4000000000000000000000001656C865A00000513000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/Shadertest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include <Mercator/Segment.h> #include <Mercator/Surface.h> #include <Mercator/FillShader.h> #include <Mercator/ThresholdShader.h> #include <Mercator/DepthShader.h> #include <Mercator/GrassShader.h> template <class ShaderType> int shadeTest(Mercator::Segment & segment) { ShaderType shader; Mercator::Surface surface(segment, shader); if (surface.getChannels() != 4) { std::cerr << "Surface does not have 4 channels." << std::endl << std::flush; return 1; } if (shader.checkIntersect(segment)) { surface.populate(); } return 0; } int main() { Mercator::Segment segment(0,0,Mercator::defaultResolution); segment.populate(); int errorCount = 0; errorCount += shadeTest<Mercator::FillShader>(segment); errorCount += shadeTest<Mercator::HighShader>(segment); errorCount += shadeTest<Mercator::LowShader>(segment); errorCount += shadeTest<Mercator::BandShader>(segment); errorCount += shadeTest<Mercator::DepthShader>(segment); errorCount += shadeTest<Mercator::GrassShader>(segment); return (errorCount ? 1 : 0); } 07070100000054000081A4000000000000000000000001656C865A00000E3C000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tests/TerrainModtest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/TerrainMod.h> #include <iostream> #include <cassert> #include <memory> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif int terrain_mod_context_test(Mercator::Terrain & terrain) { const WFMath::Ball<2> circ2(WFMath::Point<2>(0.0,0.0), 12.0); auto mp = std::make_unique<Mercator::LevelTerrainMod<WFMath::Ball>>(10.0f, circ2); mp->setContext(std::make_unique<Mercator::TerrainMod::Context>()); mp->context()->m_id = "foo"; terrain.updateMod(1, std::move(mp)); terrain.updateMod(1, nullptr); return 0; } int main() { Mercator::Terrain terrain(Mercator::Terrain::SHADED); terrain.setBasePoint(0, 0, 2.8); terrain.setBasePoint(1, 0, 7.1); terrain.setBasePoint(2, 0, 7.1); terrain.setBasePoint(0, 1, 0.2); terrain.setBasePoint(1, 1, 0.2); terrain.setBasePoint(2, 1, 0.2); terrain.setBasePoint(0, 2, 14.7); terrain.setBasePoint(1, 2, 14.7); terrain.setBasePoint(2, 2, 14.7); const WFMath::Ball<2> circ2(WFMath::Point<2>(0.0,0.0), 12.0); auto mp1 = std::make_unique<Mercator::LevelTerrainMod<WFMath::Ball>>(10.0f, circ2); terrain.updateMod(1, std::move(mp1)); Mercator::Segment * segment = terrain.getSegmentAtIndex(0, 0); assert(segment->getMods().size() == 1); auto mp1_1 = std::make_unique<Mercator::LevelTerrainMod<WFMath::Ball>>(10.0f, circ2); auto ptr = mp1_1.get(); terrain.updateMod(1, std::move(mp1_1)); assert(segment->getMods().size() == 1); assert(segment->getMods().find(1)->second == ptr); const WFMath::RotBox<2> rot( WFMath::Point<2>(-80.,-130.) , WFMath::Vector<2>(150.0,120.0), WFMath::RotMatrix<2>().rotation(WFMath::numeric_constants<WFMath::CoordType>::pi()/4)); auto mp2 = std::make_unique<Mercator::LevelTerrainMod<WFMath::RotBox>>(10.0f, rot); terrain.updateMod(2, std::move(mp2)); const WFMath::Ball<2> ball(WFMath::Point<2>(80, 80), 10); auto mp3 = std::make_unique<Mercator::CraterTerrainMod<WFMath::Ball>>(-5.f, ball); terrain.updateMod(3, std::move(mp3)); segment->populate(); segment = terrain.getSegmentAtIndex(1, 1); if (segment == nullptr) { std::cerr << "Segment not created by addition of required basepoints" << std::endl << std::flush; return 1; } segment->populate(); assert(segment->isValid()); auto mp3_rect1 = terrain.updateMod(3, std::make_unique<Mercator::CraterTerrainMod<WFMath::Ball>>(-5.f, ball)); assert(!segment->isValid()); //Check that the stored bbox is correctly updated when calling updateMod(). auto new_mp3 = std::make_unique<Mercator::CraterTerrainMod<WFMath::Ball>>(-5.f, ball); new_mp3->setShape(-5.f, WFMath::Ball<2>(WFMath::Point<2>(-80, 80), 10)); auto mp3_rect2 = new_mp3->bbox(); WFMath::AxisBox<2> mp3_rect3 = terrain.updateMod(3, std::move(new_mp3)); assert(mp3_rect1 == mp3_rect3); auto another_new_mp3 = std::make_unique<Mercator::CraterTerrainMod<WFMath::Ball>>(-5.f, ball); another_new_mp3->setShape(-5.f, WFMath::Ball<2>(WFMath::Point<2>(-80, -80), 10)); WFMath::AxisBox<2> mp3_rect4 = terrain.updateMod(3, std::move(another_new_mp3)); assert(mp3_rect2 == mp3_rect4); terrain.updateMod(1, nullptr); terrain.updateMod(2, nullptr); terrain.updateMod(3, nullptr); return terrain_mod_context_test(terrain); } 07070100000055000081A4000000000000000000000001656C865A00000E94000000000000000000000000000000000000003900000000mercator-1701611098.a02d15f/tests/TerrainaddAreatest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2010 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/Area.h> #include <Mercator/Segment.h> #include <Mercator/Shader.h> #include <Mercator/Surface.h> #include <wfmath/point.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> // This is a relatively specific tests which ensures Terrain::addArea // behaves as defined with respect to invalidating surfaces, to verify // a refactoring. Previous cases where std::map::count() was used followed // by [] are inefficient, and I wanted to verify consistent bahviour before // checking to use std::map::find() class TestShader : public Mercator::Shader { public: virtual bool checkIntersect(const Mercator::Segment &) const { return true; } /// \brief Populate a Surface with data. virtual void shade(Mercator::Surface &) const { } }; int main() { Mercator::Terrain t; // Add a null test shader to the terrain TestShader shader{}; t.addShader(&shader, 0); // Create a test area with a shape which intersects // the Segment at 0,0 auto a1 = std::make_unique<Mercator::Area>(0, false); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), WFMath::Point<2>(3, 4)); p.addCorner(p.numCorners(), WFMath::Point<2>(10, 10)); p.addCorner(p.numCorners(), WFMath::Point<2>(14, 6)); p.addCorner(p.numCorners(), WFMath::Point<2>(18, 4)); p.addCorner(p.numCorners(), WFMath::Point<2>(17, 19)); p.addCorner(p.numCorners(), WFMath::Point<2>(6, 20)); p.addCorner(p.numCorners(), WFMath::Point<2>(-1, 18)); p.addCorner(p.numCorners(), WFMath::Point<2>(-8, 11)); a1->setShape(p); // Add enough base points to force the creation of the Segment at 0,0 t.setBasePoint(0, 0, -1); t.setBasePoint(0, 1, 8); t.setBasePoint(1, 0, 2); t.setBasePoint(1, 1, 11); // Get the Segment at 0,0 Mercator::Segment * seg = t.getSegmentAtIndex(0,0); assert(seg); // Get the surfaces, and add one corresponding to the shader we added. // We need to do this as the functions that would normally make it happen // have been stubbed out. Mercator::Segment::Surfacestore & sss = seg->getSurfaces(); auto* sfce = new Mercator::Surface(*seg, shader); // Force allocation of the surface buffer so we can check later that it // gets destroyed when the area is added to the terrain. sfce->allocate(); assert(sfce->isValid()); // Add the surface to the store for this segment sss[0].reset(sfce); // Add the area which should cause relevant surface date to be invalidated t.updateArea(1, std::move(a1)); // We assert this to ensure that the buffer has been de-allocated // by a call to Surface::invalidate caused by adding the Area. assert(!sfce->isValid()); // force the surface to re-allocate sfce->allocate(); assert(sfce->isValid()); // Modify the areas shape p.addCorner(p.numCorners(), WFMath::Point<2>(-9, 12)); auto a1_2 = std::make_unique<Mercator::Area>(0, false); a1_2->setShape(p); // and cause an area update t.updateArea(1, std::move(a1_2)); // Check the surface has been invalidated again assert(!sfce->isValid()); // force the surface to re-allocate sfce->allocate(); assert(sfce->isValid()); t.updateArea(1, nullptr); // Check the surface has been invalidated again assert(!sfce->isValid()); } // stubs #include <Mercator/Area.h> #include <Mercator/Buffer_impl.h> #include <Mercator/Shader.h> #include <Mercator/TerrainMod.h> 07070100000056000081A4000000000000000000000001656C865A00001F67000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/tests/Terraintest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/FillShader.h> #include <wfmath/const.h> #include <iostream> #include <cstdlib> #include <vector> #include <string> #include <sstream> #include <cassert> #include <algorithm> int main() { { Mercator::Terrain::Pointcolumn mtpc; Mercator::Terrain::Segmentcolumn mtsc; Mercator::Terrain::Pointstore mtps; Mercator::Terrain::Segmentstore mtss; } { Mercator::Terrain fineTerrain(Mercator::Terrain::DEFAULT, 8); unsigned int res = fineTerrain.getResolution(); if (res != 8) { std::cerr << "Terrain with res specified does not have correct res." << std::endl << std::flush; std::cerr << "Resolution " << 8 << " was specified, but " << res << " was returned." << std::endl << std::flush; return 1; } } Mercator::Terrain terrain(Mercator::Terrain::SHADED, 64); unsigned int res = terrain.getResolution(); if (res != Mercator::defaultResolution) { std::cerr << "Terrain with no res specified does not have default" << std::endl << std::flush; std::cerr << "Resolution " << Mercator::defaultResolution << " is default, but " << res << " was returned." << std::endl << std::flush; return 1; } for (int i = 0; i < 100; ++i) { float testHeight = terrain.get((float)rand(), (float)rand()); if (testHeight != Mercator::Terrain::defaultLevel) { std::cerr << "Randomly selected point in empty terrain object was not default height" << std::endl << std::flush; std::cerr << "Point had height " << testHeight << " but default is " << Mercator::Terrain::defaultLevel << std::endl << std::flush; return 1; } } Mercator::Segment * seg = terrain.getSegmentAtIndex(rand(), rand()); if (seg != 0) { std::cerr << "Randomly selected segment position did not return NULL segment pointer on empty terrain" << std::endl << std::flush; return 1; } const Mercator::Terrain::Segmentstore & tSegments = terrain.getTerrain(); const Mercator::Terrain::Pointstore & tPoints = terrain.getPoints(); const Mercator::Terrain::Shaderstore & tShaders = terrain.getShaders(); if (!tSegments.empty()) { std::cerr << "Segment store for empty terrain is not empty" << std::endl << std::flush; return 1; } if (!tPoints.empty()) { std::cerr << "Point store for empty terrain is not empty" << std::endl << std::flush; return 1; } if (!tShaders.empty()) { std::cerr << "Shader store for empty terrain is not empty" << std::endl << std::flush; return 1; } Mercator::FillShader fillShader{}; terrain.addShader(&fillShader, 0); if (tShaders.empty()) { std::cerr << "Shader store for terrain is empty after shader was added" << std::endl << std::flush; return 1; } terrain.setBasePoint(0, 0, 2.8); terrain.setBasePoint(1, 0, -7.1); terrain.setBasePoint(0, 1, 0.2); terrain.setBasePoint(1, 1, 14.7); if (tPoints.empty()) { std::cerr << "Point store for populated terrain is empty" << std::endl << std::flush; return 1; } if (tSegments.empty()) { std::cerr << "Segment store for populated terrain is empty" << std::endl << std::flush; return 1; } Mercator::BasePoint bp; terrain.getBasePoint(0, 0, bp); if (bp.seed() != 2800) { std::cerr << "BasePoint seed calculation is incorrect." << std::endl << std::flush; return 1; } terrain.getBasePoint(1, 0, bp); if (bp.seed() != -7100U) { std::cerr << "BasePoint seed calculation is incorrect." << std::endl << std::flush; return 1; } terrain.getBasePoint(0, 1, bp); if (bp.seed() != 200) { std::cerr << "BasePoint seed calculation is incorrect." << std::endl << std::flush; return 1; } terrain.getBasePoint(1, 1, bp); if (bp.seed() != 14700) { std::cerr << "BasePoint seed calculation is incorrect." << std::endl << std::flush; return 1; } Mercator::Segment * segment = terrain.getSegmentAtIndex(0, 0); if (segment == 0) { std::cerr << "Segment not created by addition of required basepoints" << std::endl << std::flush; return 1; } Mercator::Segment::Surfacestore & surfaces = segment->getSurfaces(); if (surfaces.size() != tShaders.size()) { std::cerr << "Number of surfaces in the Segment does not match number of shaders on the terrain" << std::endl << std::flush; return 1; } //Now let's check that the underlying algorithm used for calculating heights is intact. //We've previously determined three height values from sampling random points in the terrain. //Given the previous input to the terrain system these heights should always return the same value. //If not, something has changed regarding the algorithm used for generating the terrain. segment->populate(); float height = 0; WFMath::Vector<3> normal; terrain.getHeightAndNormal(5.5f, 6.5f, height, normal); if (!WFMath::Equal(height, 2.00456953f)) { std::cerr << "Height sampling is incorrect. This is caused by the underlying algorithm being changed." << std::endl << std::flush; return 1; } terrain.getHeightAndNormal(15.5f, 12.6f, height, normal); if (!WFMath::Equal(height, 2.221810579f)) { std::cerr << "Height sampling is incorrect. This is caused by the underlying algorithm being changed." << std::endl << std::flush; return 1; } terrain.getHeightAndNormal(20.2f, 17.4f, height, normal); if (!WFMath::Equal(height, 0.9405912161f)) { std::cerr << "Height sampling is incorrect. This is caused by the underlying algorithm being changed." << std::endl << std::flush; return 1; } std::vector<std::string> segments; auto pushSegmentsFn = [&](Mercator::Segment& s, int x, int y) { std::stringstream ss; ss << x << "x" << y; segments.push_back(ss.str()); }; terrain.processSegments(WFMath::AxisBox<2>(WFMath::Point<2>(1,1), WFMath::Point<2>(2,2)), pushSegmentsFn); assert(segments.size() == 1); assert(segments[0] == "0x0"); segments.clear(); //We only have four base points, so we should still get only one segment terrain.processSegments(WFMath::AxisBox<2>(WFMath::Point<2>(1,1), WFMath::Point<2>(65,65)), pushSegmentsFn); assert(segments.size() == 1); assert(segments[0] == "0x0"); //Now let's add more basepoints, for four segments terrain.setBasePoint(0, 2, 10); terrain.setBasePoint(1, 2, 10); terrain.setBasePoint(2, 2, 10); terrain.setBasePoint(2, 1, 10); terrain.setBasePoint(2, 0, 10); segments.clear(); terrain.processSegments(WFMath::AxisBox<2>(WFMath::Point<2>(1,1), WFMath::Point<2>(65,65)), pushSegmentsFn); assert(segments.size() == 4); assert(std::count(segments.begin(), segments.end(), "0x0")); assert(std::count(segments.begin(), segments.end(), "0x1")); assert(std::count(segments.begin(), segments.end(), "1x0")); assert(std::count(segments.begin(), segments.end(), "1x1")); return 0; } 07070100000057000081A4000000000000000000000001656C865A00000A7F000000000000000000000000000000000000003A00000000mercator-1701611098.a02d15f/tests/ThresholdShadertest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2009 Alistair Riddoch #include <Mercator/Terrain.h> #include <Mercator/ThresholdShader.h> #include <Mercator/Segment.h> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> typedef WFMath::Point<2> Point2; void testHighShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; params[Mercator::HighShader::key_threshold] = 5.f; Mercator::HighShader dshade{params}; terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, 20); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 2); terrain.setBasePoint(1, 1, 0.5); terrain.setBasePoint(2, 0, 2); terrain.setBasePoint(2, 1, 0.5); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populateSurfaces(); seg->populate(); seg->populateSurfaces(); seg = terrain.getSegmentAtIndex(1,0); dshade.checkIntersect(*seg); } void testLowShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; params[Mercator::LowShader::key_threshold] = 5.f; Mercator::LowShader dshade{params}; terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, 2); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 20); terrain.setBasePoint(1, 1, 10); terrain.setBasePoint(2, 0, 15); terrain.setBasePoint(2, 1, 19); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populateSurfaces(); seg->populate(); seg->populateSurfaces(); seg = terrain.getSegmentAtIndex(1,0); dshade.checkIntersect(*seg); } void testBandShader() { Mercator::Terrain terrain(Mercator::Terrain::SHADED, 16); Mercator::Shader::Parameters params; params[Mercator::BandShader::key_lowThreshold] = 2.f; params[Mercator::BandShader::key_highThreshold] = 8.f; Mercator::BandShader dshade{params}; terrain.addShader(&dshade, 0); terrain.setBasePoint(0, 0, 2); terrain.setBasePoint(0, 1, 1); terrain.setBasePoint(1, 0, 20); terrain.setBasePoint(1, 1, 10); terrain.setBasePoint(2, 0, 15); terrain.setBasePoint(2, 1, 19); Mercator::Segment* seg = terrain.getSegmentAtIndex(0,0); seg->populateSurfaces(); seg->populate(); seg->populateSurfaces(); seg = terrain.getSegmentAtIndex(1,0); dshade.checkIntersect(*seg); } int main() { testHighShader(); testLowShader(); testBandShader(); return 0; } 07070100000058000081A4000000000000000000000001656C865A000003E3000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tests/TileShadertest.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Alistair Riddoch #include <Mercator/Segment.h> #include <Mercator/Surface.h> #include <Mercator/FillShader.h> #include <Mercator/ThresholdShader.h> #include <Mercator/DepthShader.h> #include <Mercator/GrassShader.h> #include <Mercator/TileShader.h> int main() { Mercator::Segment segment(0, 0, Mercator::defaultResolution); segment.populate(); Mercator::TileShader tileShader; tileShader.addShader(std::make_unique<Mercator::FillShader>(), 0); tileShader.addShader(std::make_unique<Mercator::BandShader>(-2.f, 1.5f), 1); tileShader.addShader(std::make_unique<Mercator::GrassShader>(1.f, 80.f, .5f, 1.f), 2); tileShader.addShader(std::make_unique<Mercator::DepthShader>(0.f, -10.f), 3); tileShader.addShader(std::make_unique<Mercator::HighShader>(110.f), 4); auto surface = tileShader.newSurface(segment); surface->populate(); } 07070100000059000081A4000000000000000000000001656C865A00000600000000000000000000000000000000000000002B00000000mercator-1701611098.a02d15f/tests/main.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes, Alistair Riddoch #include <Mercator/Segment.h> #include <Mercator/Terrain.h> #include <Mercator/Matrix.h> #include <Mercator/BasePoint.h> #include <iostream> int main() { int size = 64; Mercator::Segment s(0, 0, size); Mercator::Matrix<2, 2, Mercator::BasePoint> & base = s.getControlPoints(); base[0] = Mercator::BasePoint(10.f, 3.f); base[1].height() = 15.f; base[2] = Mercator::BasePoint(10.f, 10.f); base[3] = Mercator::BasePoint(9.32f, 1.9f); s.populate(); /* s.populateNormals(); float *n=s.getNormals(); i*/ //for (int i=0; i<=size; ++i) { int i=0; for (int j=0; j<=size; ++j) { std::cout << j << ":" << s.get(i,j) << ", " ; } //} /* std::cout << s.get(i,j) << " ; "; std::cout << n[j * size * 3 + i * 3 ] << " : "; std::cout << n[j * size * 3 + i * 3 + 1] << " : "; std::cout << n[j * size * 3 + i * 3 + 2]; std::cout << std::endl; } std::cout << std::endl; } */ Mercator::Terrain t; t.setBasePoint(0,0,10.0); t.setBasePoint(0,1,12.0); t.setBasePoint(1,0,14.0); t.setBasePoint(1,1,16.0); std::cout << t.getSegmentAtIndex(0,0); t.setBasePoint(1,1,12.0); std::cout << t.getSegmentAtIndex(0,0); std::cout << std::endl; return 0; } 0707010000005A000081A4000000000000000000000001656C865A000002A1000000000000000000000000000000000000003000000000mercator-1701611098.a02d15f/tests/testCache.cpp#include <Mercator/RandCache.h> #include <iostream> int main(){ SpiralOrdering m(1,1); for (int i =2;i>-3;i--) { std::cout << "y" << i << ":"; for (int j =-2;j<3;j++) { std::cout << j << " " << m(j,i) << " || "; } std::cout << std::endl; } RandCache rc(123, new ZeroSpiralOrdering()); RandCache rc2(123, new ZeroSpiralOrdering()); RandCache rc3(323, new ZeroSpiralOrdering()); std::cout << rc(2,2) << std::endl; std::cout << rc2(2,2) << std::endl; std::cout << rc3(2,2) << std::endl; // std::cout << rc(1,2) << ":" << rc(10,12) << rc(11,13) << rc(2,2) << std::endl; return 0; } 0707010000005B000081A4000000000000000000000001656C865A00000970000000000000000000000000000000000000002F00000000mercator-1701611098.a02d15f/tests/testPhys.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/Intersect.h> #include <iostream> //test intersection using a rudimentary physics simulation //this drops a particle onto the terrain and it bounces around a bit int main() { Mercator::Terrain terrain; terrain.setBasePoint(0, 0, 2.8); terrain.setBasePoint(1, 0, 7.1); terrain.setBasePoint(0, 1, 0.2); terrain.setBasePoint(1, 1, 14.7); Mercator::Segment * segment = terrain.getSegmentAtIndex(0, 0); if (segment == 0) { std::cerr << "Segment not created by addition of required basepoints" << std::endl << std::flush; return 1; } segment->populate(); WFMath::Point<3> pos(30.0,100.0,30.0); //starting position WFMath::Vector<3> vel(0.0,0.0,1.0); //starting velocity WFMath::Vector<3> grav(0.0,-9.8,0.0); //gravity WFMath::Point<3> intersection; WFMath::Vector<3> intnormal; float timestep = 0.1; float e = 0.2; //elasticity of collision float totalT = 20.0; //time limit double par = 0.0; float t = timestep; while (totalT > timestep) { vel += t * grav; if (Mercator::Intersect(terrain, pos, vel * t, intersection, intnormal, par)) { //set pos to collision time, //less a small amout to keep objects apart pos = intersection - (vel * .01 * t); WFMath::Vector<3> impulse = intnormal * (Dot(vel, intnormal) * -2); std::cerr << "HIT" << std::endl; vel = (vel + impulse) * e; //not sure of the impulse equation, but this will do if (vel.sqrMag() < 0.01) { //stop if velocities are small std::cerr << "friction stop" << std::endl; break; } totalT -= par*t; t = (1.0-par)*t; } else { pos += vel*t; totalT -= t; t = timestep; } std::cerr << "timeLeft:" << totalT << " end pos" << pos << " vel" << vel << std::endl; } return 0; } 0707010000005C000081A4000000000000000000000001656C865A000003E7000000000000000000000000000000000000002F00000000mercator-1701611098.a02d15f/tests/testQRNG.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2004 Alistair Riddoch #include <wfmath/MersenneTwister.h> #include <iostream> #ifdef NDEBUG #undef NDEBUG #endif #ifndef DEBUG #define DEBUG #endif #include <cassert> int main() { static WFMath::MTRand::uint32 results[] = { 2221777491u, 2873750246u, 4067173416u, 794519497u, 3287624630u, 3357287912u, 1212880927u, 2464917741u, 949382604u, 1898004827u }; WFMath::MTRand rng; int exit = 0; rng.seed(23); // rng.randInt(); for(int i = 0; i < 10; ++i) { WFMath::MTRand::uint32 rnd = rng.randInt(); if (rnd != results[i]) { std::cerr << "Mismatch between QRNG and known result sequuence" << std::endl << rnd << " != " << results[i] << std::endl << std::flush; exit = 1; } assert(rnd == results[i]); } return exit; } 0707010000005D000081A4000000000000000000000001656C865A00000B23000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/testWFMath.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Al Riddoch #include <wfmath/polygon_intersect.h> #include <iostream> int main() { WFMath::Polygon<2> p1, p2, p3, p4; p1.addCorner(0, WFMath::Point<2>(0,0)); p1.addCorner(1, WFMath::Point<2>(0,10)); p1.addCorner(2, WFMath::Point<2>(10,10)); p1.addCorner(3, WFMath::Point<2>(10,0)); p2.addCorner(0, WFMath::Point<2>(0,0)); p2.addCorner(1, WFMath::Point<2>(0,5)); p2.addCorner(2, WFMath::Point<2>(5,5)); p2.addCorner(3, WFMath::Point<2>(5,0)); p3.addCorner(0, WFMath::Point<2>(1,1)); p3.addCorner(1, WFMath::Point<2>(1,5)); p3.addCorner(2, WFMath::Point<2>(5,5)); p3.addCorner(3, WFMath::Point<2>(5,1)); p4.addCorner(0, WFMath::Point<2>(15,15)); p4.addCorner(1, WFMath::Point<2>(15,20)); p4.addCorner(2, WFMath::Point<2>(20,20)); p4.addCorner(3, WFMath::Point<2>(20,15)); WFMath::AxisBox<2> box1(WFMath::Point<2>(0,0), WFMath::Point<2>(10,10)); if (WFMath::Intersect(p1, p2, true)) { std::cout << "p1 and p2 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p2 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p2, true)) { std::cout << "p1 and p2 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p2 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p3, true)) { std::cout << "p1 and p3 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p3 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p4, true)) { std::cout << "p1 and p4 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p4 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, box1, false)) { std::cout << "p1 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p2, box1, false)) { std::cout << "p2 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p2 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p3, box1, false)) { std::cout << "p3 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p3 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p4, box1, false)) { std::cout << "p4 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p4 and box1 don't itersect" << std::endl << std::flush; } } 0707010000005E000081A4000000000000000000000001656C865A00000EA7000000000000000000000000000000000000003700000000mercator-1701611098.a02d15f/tests/testWFMath.cpp-extra// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2005 Al Riddoch #include <wfmath/polygon_intersect.h> #include <iostream> int main() { WFMath::Polygon<2> p1, p2, p3, p4; p1.addCorner(0, WFMath::Point<2>(0,0)); p1.addCorner(1, WFMath::Point<2>(0,10)); p1.addCorner(2, WFMath::Point<2>(10,10)); p1.addCorner(3, WFMath::Point<2>(10,0)); p2.addCorner(0, WFMath::Point<2>(0,0)); p2.addCorner(1, WFMath::Point<2>(0,5)); p2.addCorner(2, WFMath::Point<2>(5,5)); p2.addCorner(3, WFMath::Point<2>(5,0)); p3.addCorner(0, WFMath::Point<2>(1,1)); p3.addCorner(1, WFMath::Point<2>(1,5)); p3.addCorner(2, WFMath::Point<2>(5,5)); p3.addCorner(3, WFMath::Point<2>(5,1)); p4.addCorner(0, WFMath::Point<2>(15,15)); p4.addCorner(1, WFMath::Point<2>(15,20)); p4.addCorner(2, WFMath::Point<2>(20,20)); p4.addCorner(3, WFMath::Point<2>(20,15)); WFMath::AxisBox<2> box1(WFMath::Point<2>(0,0), WFMath::Point<2>(10,10)); if (WFMath::Intersect(p1, p2, true)) { std::cout << "p1 and p2 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p2 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p2, true)) { std::cout << "p1 and p2 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p2 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p3, true)) { std::cout << "p1 and p3 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p3 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, p4, true)) { std::cout << "p1 and p4 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and p4 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p1, box1, false)) { std::cout << "p1 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p1 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p2, box1, false)) { std::cout << "p2 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p2 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p3, box1, false)) { std::cout << "p3 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p3 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(p4, box1, false)) { std::cout << "p4 and box1 intersect propper" << std::endl << std::flush; } else { std::cout << "p4 and box1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(box1, p1, false)) { std::cout << "box1 and p1 intersect propper" << std::endl << std::flush; } else { std::cout << "box1 and p1 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(box1, p2, false)) { std::cout << "box1 and p2 intersect propper" << std::endl << std::flush; } else { std::cout << "box1 and p2 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(box1, p3, false)) { std::cout << "box1 and p3 intersect propper" << std::endl << std::flush; } else { std::cout << "box1 and p3 don't itersect" << std::endl << std::flush; } if (WFMath::Intersect(box1, p4, false)) { std::cout << "box1 and p4 intersect propper" << std::endl << std::flush; } else { std::cout << "box1 and p4 don't itersect" << std::endl << std::flush; } } 0707010000005F000081A4000000000000000000000001656C865A0000086D000000000000000000000000000000000000002E00000000mercator-1701611098.a02d15f/tests/timeSeg.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2003 Damien McGinnes #include <Mercator/Terrain.h> #include <Mercator/Segment.h> #include <Mercator/Intersect.h> #include <Mercator/Forest.h> #include <Mercator/Area.h> #include "util_timer.h" #include <iostream> typedef WFMath::Point<2> Point2; int main() { Mercator::Terrain terrain; terrain.setBasePoint(0, 0, 2.8); terrain.setBasePoint(1, 0, 7.1); terrain.setBasePoint(0, 1, 0.2); terrain.setBasePoint(1, 1, 14.7); Mercator::Segment * segment = terrain.getSegmentAtIndex(0, 0); if (segment == 0) { std::cerr << "Segment not created by addition of required basepoints" << std::endl << std::flush; return 1; } Util::Timer time; time.start(); for (int q=0;q<1000;q++) { segment->populate(); } time.stop(); std::cout << "time per segment = "<< (time.interval()/1.0) << " ms" << std::endl; Mercator::Forest forest(4249162ul); WFMath::Polygon<2> p; p.addCorner(p.numCorners(), Point2(-50, -50)); p.addCorner(p.numCorners(), Point2(50, -50)); p.addCorner(p.numCorners(), Point2(50, 50)); p.addCorner(p.numCorners(), Point2(-50, 50)); Mercator::Area ar(1, false); ar.setShape(p); forest.setArea(&ar); time.start(); for (int q=0;q<10;q++) { forest.populate(); } time.stop(); std::cout << "time per 100x100 forest = "<< (time.interval()*100.0) << " ms" << std::endl; p.clear(); p.addCorner(p.numCorners(), Point2(-100, -100)); p.addCorner(p.numCorners(), Point2(100, -100)); p.addCorner(p.numCorners(), Point2(100, 100)); p.addCorner(p.numCorners(), Point2(-100, 100)); Mercator::Area ar2(1, false); ar2.setShape(p); forest.setArea(&ar2); time.start(); for (int q=0;q<10;q++) { forest.populate(); } time.stop(); std::cout << "time per 200x200 forest = "<< (time.interval()*100.0) << " ms" << std::endl; return 0; } 07070100000060000081A4000000000000000000000001656C865A000003E4000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tests/util_timer.cpp// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2002 Jari Sundell #include "util_timer.h" namespace Util { Timer::Timer() { gettimeofday(&m_start,0); } void Timer::start() { gettimeofday(&m_start,0); } void Timer::stop() { gettimeofday(&m_stop,0); } double Timer::interval() { struct timeval time; double inter; gettimeofday(&time,0); inter=(time.tv_sec-m_start.tv_sec)+((double)(time.tv_usec-m_start.tv_usec))/1000000.0; gettimeofday(&m_start,0); return inter; } double Timer::time() { return (m_stop.tv_sec-m_start.tv_sec)+((double)(m_stop.tv_usec-m_start.tv_usec))/1000000.0; } double Timer::now() { gettimeofday(&m_temp,0); return (double)(m_temp.tv_sec-m_start.tv_sec)+(double)(m_temp.tv_usec-m_start.tv_usec)/1000000.0; } double Timer::real() { struct timeval t; gettimeofday(&t,0); return (double)t.tv_sec + (double)t.tv_usec / 1000000.0; } } 07070100000061000081A4000000000000000000000001656C865A0000020F000000000000000000000000000000000000002F00000000mercator-1701611098.a02d15f/tests/util_timer.h// This file may be redistributed and modified only under the terms of // the GNU General Public License (See COPYING for details). // Copyright (C) 2002 Jari Sundell #ifndef STAGE_UTIL_TIMER #define STAGE_UTIL_TIMER #include <sys/time.h> #include <unistd.h> namespace Util { class Timer { protected: struct timeval m_start; struct timeval m_stop; struct timeval m_temp; public: Timer(); void start(); void stop(); double interval(); double time(); double now(); static double real(); }; } #endif 07070100000062000041ED000000000000000000000004656C865A00000000000000000000000000000000000000000000002200000000mercator-1701611098.a02d15f/tools07070100000063000081A4000000000000000000000001656C865A000002FC000000000000000000000000000000000000003200000000mercator-1701611098.a02d15f/tools/Config.cmake.in# Find @PROJECT_NAME@ includes and library # # This module defines # @PROJECT_NAME@_INCLUDE_DIR - the @PROJECT_NAME@ include directories # @PROJECT_NAME@_LIBRARIES - link these to use the @PROJECT_NAME@ # @PROJECT_NAME@_LIBRARY_DIR - the location of the libraries # # A target "@PROJECT_NAME@::@PROJECT_NAME@" is also provided. set(@PROJECT_NAME@_VERSION @VERSION@) set(@PROJECT_NAME@_LIBRARIES @PROJECT_NAME@) @PACKAGE_INIT@ set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") set_and_check(@PROJECT_NAME@_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@") include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") include(CMakeFindDependencyMacro) find_dependency(wfmath) check_required_components(@PROJECT_NAME@)07070100000064000041ED000000000000000000000003656C865A00000000000000000000000000000000000000000000002800000000mercator-1701611098.a02d15f/tools/conan07070100000065000081A4000000000000000000000001656C865A0000071C000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tools/conan/conanfile.pyimport os from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain from conan.tools.files import copy, update_conandata, collect_libs from conan.tools.scm import Git from conans.errors import ConanException class MercatorConan(ConanFile): name = "mercator" version = "0.4.0" license = "GPL-2.0+" homepage = "https://www.worldforge.org" url = "https://github.com/worldforge/mercator" description = "A terrain generation library for the Worldforge system." topics = ("mmorpg", "worldforge") settings = "os", "compiler", "build_type", "arch" options = {"shared": [False, True], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} user = "worldforge" generators = "CMakeDeps", "CMakeToolchain" package_type = "library" def requirements(self): self.requires("wfmath/1.0.3@worldforge", transitive_headers=True) def export(self): git = Git(self, self.recipe_folder) try: scm_url, scm_commit = git.get_url_and_commit() update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) except ConanException: pass def export_sources(self): folder = os.path.join(self.recipe_folder, "../..") copy(self, "*", folder, self.export_sources_folder, excludes=["build"]) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def layout(self): self.folders.root = "../.." cmake_layout(self) def build(self): cmake = CMake(self) cmake.configure() cmake.build() def package(self): cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = collect_libs(self) 07070100000066000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000003500000000mercator-1701611098.a02d15f/tools/conan/test_package07070100000067000081A4000000000000000000000001656C865A000000FE000000000000000000000000000000000000004400000000mercator-1701611098.a02d15f/tools/conan/test_package/CMakeLists.txtcmake_minimum_required(VERSION 2.8.12) project(PackageTest CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED on) find_package(mercator CONFIG REQUIRED) add_executable(example example.cpp) target_link_libraries(example mercator::mercator) 07070100000068000081A4000000000000000000000001656C865A0000027E000000000000000000000000000000000000004200000000mercator-1701611098.a02d15f/tools/conan/test_package/conanfile.pyimport os from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout from conan.tools.build import can_run class TestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain" def requirements(self): self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) cmake.configure() cmake.build() def layout(self): cmake_layout(self) def test(self): if can_run(self): cmd = os.path.join(self.cpp.build.bindir, "example") self.run(cmd, env="conanrun") 07070100000069000081A4000000000000000000000001656C865A00000063000000000000000000000000000000000000004100000000mercator-1701611098.a02d15f/tools/conan/test_package/example.cpp#include <iostream> #include <Mercator/Terrain.h> int main() { Mercator::Terrain terrain{}; } 0707010000006A000081A4000000000000000000000001656C865A0000011B000000000000000000000000000000000000003100000000mercator-1701611098.a02d15f/tools/mercator.pc.inprefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/include Name: @PROJECT_NAME@ Description: @DESCRIPTION@ Requires: @REQUIRES@ Version: @VERSION@ Libs: -L${libdir} -lmercator Cflags: -I${includedir}/@PROJECT_NAME@ 0707010000006B000041ED000000000000000000000002656C865A00000000000000000000000000000000000000000000002A00000000mercator-1701611098.a02d15f/tools/support0707010000006C000081A4000000000000000000000001656C865A0000C964000000000000000000000000000000000000003800000000mercator-1701611098.a02d15f/tools/support/ChangeLog-CVS2012-11-08 Al Riddoch <alriddoch@googlemail.com> * A minor performance improvement to the way constants are defined, and a small fix for more recent compilers. 2011-02-13 Al Riddoch <alriddoch@googlemail.com> * Release 0.3.0, interface version 1 2011-02-12 Al Riddoch <alriddoch@googlemail.com> * Major overhaul of the area and mod systems removing code duplication, and to make them more consistent. Allow areas and terrain mods to be updated in place. Fix a number of issues and memory leaks. 2010-11-14 Al Riddoch <alriddoch@googlemail.com> * NEWS: Update news. * Release 0.2.9, interface version 8 2010-11-12 Al Riddoch <alriddoch@googlemail.com> * Mercator/Segment.h: Add an accessor so the mods stored in a segment are accessible for testing. * Mercator/TerrainMod.cpp, Mercator/TerrainMod.h: Add support for storing context data from the application in each terrain mod object. 2010-08-19 Al Riddoch <alriddoch@googlemail.com> * NEWS: Update news. * Release 0.2.8, interface version 7 2010-08-19 Al Riddoch <alriddoch@googlemail.com> * Mercator/Buffer.h, Mercator/DepthShader.cpp, Mercator/GrassShader.cpp, Mercator/ShaderFactory.cpp, Mercator/ThresholdShader.cpp, Mercator/TileShader.cpp: Remove <cassert> from the library headers. * Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Terrain.cpp, Mercator/Terrain.h: Modify the interface to refer to Areas and Shaders as const where appropriate. * Mercator/TerrainMod.cpp, Mercator/TerrainMod,h: Remove a large inline function. 2009-02-25 Al Riddoch <alriddoch@googlemail.com> * tests/testTerrain.cpp: Add required cstdlib include to get rand(). 2009-02-25 Al Riddoch <alriddoch@googlemail.com> * mercator.spec.in: Add Packager tag. Fix the included docs to be consistent with other packages. 2009-02-24 Al Riddoch <alriddoch@googlemail.com> * configure.ac: Increment version. * NEWS: Update news. * Release 0.2.7, interface version 6 2009-01-12 Al Riddoch <alriddoch@googlemail.com> * Mercator/GrassShader.cpp: Add required <cmath> include. 2009-01-04 Simon Goodall <simon@worldforge.org> * Mercator/Terrain.cpp, Mercator/Terrain.h: Add a removeShader method to remove previously added shaders. Fix removeArea so that surfaces with no areas are removed. 2009-01-04 Simon Goodall <simon@worldforge.org> * Mercator/Segment.cpp: Fix iterator erase logic in removeArea. Erase invalidates iterators. 2008-11-10 Al Riddoch <alriddoch@googlemail.com> * tests/testForest.cpp, tests/testPlant.cpp: Fix a warning caused by defining DEBUG to force asserts in the tests. 2008-11-09 Al Riddoch <alriddoch@googlemail.com> * tests/testForest.cpp, tests/testPlant.cpp: Force debug mode before including asserts so checks are always run. 2008-11-08 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.cpp: Convert #warnings to FIXMEs. 2008-11-04 Al Riddoch <alriddoch@googlemail.com> * configure.ac: Added AC_PROG_CXX as it is required to set up the C++ compiler correctly. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * NEWS: Update news. * Release 0.2.6 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * mercator.spec.in: Remove packager tag, as it should be set in the packagers macros. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.cpp: When created a new Segment, apply existing mods now that we actually store them in the right place. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * Mercator/Segment.cpp, Mercator/Segment.h: Make Segment::clipToSegment() public as it's useful, and const as it should be. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.cpp, Mercator/Segment.cpp: Redefine the x and y reference for the terrain to be in world coords, not grid offset, to simplify the arithmetic considerably. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.h: Accompany each stored mod with information about its bbox at the time it was added, so we can more effectively move it around. * Mercator/Terrain.cpp: Implement moving mods around more effectively. 2008-08-14 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.h: Accompany each stored area with information about its bbox at the time it was added, so we can more effectively move it around. * Mercator/Terrain.cpp: Implement moving areas around more effectively. 2008-08-13 Al Riddoch <alriddoch@googlemail.com> * Mercator/Segment.cpp, Mercator/Segment.h: Remove code that handled ownership of allocated terrain mods, as Terrain now owns them. Implement API for removing an individual TerrainMod. Convert storage over to a set for easy removal. * Mercator/Terrain.cpp, Mercator/Terrain.h: Add storage for terrain mods. Flesh out the API for mods and areas allowing them to be modified in place, and allowing mods to be removed. * tests/testArea.cpp: Add test stub for removing terrain mods. 2008-08-13 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.cpp: Don't mess around with surface data for segments which don't intersect with a modifier. 2008-08-12 Al Riddoch <alriddoch@googlemail.com> * configure.ac: Increment the interface version as the API has changed. 2008-08-12 Al Riddoch <alriddoch@googlemail.com> * Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Terrain.cpp, Mercator/Terrain.h: Add new interface to remove Area mods from the terrain. * tests/testArea.cpp: Update the tests to cover removeArea(). 2008-08-07 Al Riddoch <alriddoch@googlemail.com> * Mercator/Segment.cpp: Fix applyMod() so it correctly calculates mod offset in segments other than 0,0. * tests/testTerrainMod.cpp: Re-order setup of modified terrain in such an order that the modifiers actually have an effect. 2008-08-04 Al Riddoch <alriddoch@googlemail.com> * Mercator/Terrain.cpp: Fix one of the more obvious gratuitous ineffeciencies. Use I_ROUND rather than integer casting. Add some debug code for debugging issues with modifiers. 2008-07-02 Erik Hjortsberg <erik.hjortsberg@iteam.se> * Mercator/Segment.cpp: Delete surfaces at shut down, else we'll have a memory leak. 2008-07-01 Alexey Torkhov <atorkhov@gmail.com> * Mercator/RandCache.h, Mercator/AreaShader.h, Mercator/AreaShader.cpp: Add standard headers required by versions of GCC 4.3 or later. 2007-11-25 Al Riddoch <alriddoch@googlemail.com> * mercator.spec.in: Break out the static libraries into their own package. Add a new sub package for the documentation. * Doxyfile: Do an automated update of the doxygen configuration. 2007-11-05 Al Riddoch <alriddoch@googlemail.com> * acinclude.m4: Update to the latest pkgconfig check macros. * configure.ac: Use the latest pkgconfig macros, provide more useful error messages when libraries can't be found. Increment the version number for future release. * NEWS: Add news to test distribution of latest version. * AUTHORS: Update maintainers email address. * mercator.spec.in: Disable dependencies, and use multiple CPU cores when building the rpm. 2007-11-05 Al Riddoch <alriddoch@zepler.org> * tests/testForest.cpp: Add some more straightforward coverage. 2007-09-22 Al Riddoch <alriddoch@zepler.org> * Doxyfile: Update to a more recent version. 2007-09-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Area.cpp, Mercator/Area.h, Mercator/AreaShader.cpp, Mercator/AreaShader.h, Mercator/BasePoint.h, Mercator/RandCache.h: Add doc comments for some members. 2007-09-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Buffer.h, Mercator/DepthShader.h, Mercator/FillShader.h, Mercator/GrassShader.h, Mercator/RandCache.h, Mercator/Segment.cpp, Mercator/ThresholdShader.h: Add doc comments for some members. 2007-09-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp, Mercator/ShaderFactory.cpp, Mercator/ShaderFactory.h, Mercator/ThresholdShader.h: Add doc comments for some members. 2007-09-18 Al Riddoch <alriddoch@zepler.org> * Mercator/Area.cpp, Mercator/Forest.h, Mercator/Surface.cpp, Mercator/Surface.h, Mercator/TileShader.h: Add doc comments for some members. 2007-09-18 Al Riddoch <alriddoch@zepler.org> * Mercator/Area.cpp, Mercator/Area.h, Mercator/AreaShader.cpp, Mercator/AreaShader.h, Mercator/BasePoint.h, Mercator/Buffer.h, Mercator/DepthShader.h, Mercator/FillShader.h, Mercator/Forest.h, Mercator/GrassShader.h, Mercator/RandCache.h, Mercator/Segment.cpp, Mercator/ShaderFactory.h, Mercator/Surface.h, Mercator/ThresholdShader.h, Mercator/TileShader.h: Add doc comments for all compounds and types. Many members now to be done. 2007-09-17 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h, Mercator/Plant.h, Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Shader.h, Mercator/Terrain.cpp, Mercator/Terrain.h, Mercator/TerrainMod.h: Add doxygen comments documenting all members that area currently reported as undocumented. 2007-09-17 Al Riddoch <alriddoch@zepler.org> c Mercator/TerrainMod.h: Add some API documentation to the naughty undocumented classes. 2007-08-11 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp: Ensure any subsequent species candidates are skipped once the species for a given node has been instanced. * tests/testForest.cpp: Test the plant counts increase in the expected proportions as species are added. 2007-08-11 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h: Shuffle the namespacing around a little to make code less verbose and clearer. * tests/testForest.cpp: Add tests to cover the new species code. 2007-08-10 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h, Mercator/Plant.h: First pass at re-implementing the forest code as a flexible general case, rather than a quick hack. 2006-08-22 Al Riddoch <alriddoch@zepler.org> * configure.ac: Increment version number. * NEWS: Update news. * Release 0.2.5 2006-01-03 Al Riddoch <alriddoch@zepler.org> * configure.ac, Mercator/iround.h, Mercator/GrassShader.cpp, Mercator/Segment.cpp: Add macro for absolute value of floating point numbers. Check for fabsf() and fall back to fabs() on non C99 systems. 2005-12-02 James Turner <james@worldforge.org> * Add X-Code 2.0 project file (ProjectBuilder project will be deleted shortly). 2005-07-13 Al Riddoch <alriddoch@zepler.org> * Mercator/BasePoint.h: Re-order "const static" to "static const" to eliminate some warnings. 2005-06-16 Al Riddoch <alriddoch@zepler.org> * configure.ac: Increment version number. * NEWS: Update news. * Releases 0.2.4 2005-06-14 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp, Mercator/DepthShader.h, Mercator/GrassShader.cpp, Mercator/GrassShader.h, Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h: Move static variable definitions into the cpp files, as gcc 4 isn't happy otherwise. 2005-06-11 Al Riddoch <alriddoch@zepler.org> * configure.ac: Increment interface version. * NEWS: Update NEWS. * Release 0.2.3 2005-06-02 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp, Mercator/DepthShader.h, Mercator/GrassShader.cpp, Mercator/GrassShader.h, Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h: Rename static variables that hold parameter key strings to be prefixed with key_. Add static variables to hold the default values of parameters. Make sure the default values of parameters are set in the constructor that takes named paramters. Add accessors for all shader parameters. * tests/testShaderFactory.cpp: Add code to test whether shaders correctly set their paramaters when passes in as named paramters. Includes check to make sure parameters all default to the right value. 2005-05-28 Al Riddoch <alriddoch@zepler.org> * Mercator/GrassShader.cpp: Added missing static variable definitions. 2005-05-28 Al Riddoch <alriddoch@zepler.org> * configure.ac: Increment version for dependency handling. * Mercator/DepthShader.h, Mercator/GrassShader.h, Mercator/ThresholdShader.h: Add static string variable declarations for parameter names for shaders that take parameters. Provide a more in depth explanation of the algorithm used by GrassShader. * Mercator/DepthShader.cpp, Mercator/FillShader.cpp, Mercator/GrassShader.cpp, Mercator/ThresholdShader.cpp: Implement the code in the Parameters version of the constructor to set the parameters of the shader by named values. 2005-05-24 James Turner <james@worldforge.org> * Mercator/Area.cpp: fix ::checkIntersect to handle the case where the Area is fully contained by a segment. 2005-05-18 Al Riddoch <alriddoch@zepler.org> * tests/testWFMath.cpp: Clear up some of the reporting. 2005-05-18 Al Riddoch <alriddoch@zepler.org> * tests/testWFMath.cpp, tests/Makefile.am: Add a test for wfmath Intersect functions. 2005-05-18 Al Riddoch <alriddoch@zepler.org> * tests/testShaderFactory.cpp: Forgot to add test. 2005-05-17 Al Riddoch <alriddoch@zepler.org> * Mercator/TileShader.cpp: Delete subShaders from destructor. * Mercator/DepthShader.cpp, Mercator/DepthShader.h, Mercator/FillShader.cpp, Mercator/FillShader.h, Mercator/GrassShader.cpp, Mercator/GrassShader.h, Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h, Mercator/Shader.h: Add a second constructor to all shaders which takes a generic parameter map type, to allow creation of shaders to be automated. * Mercator/ShaderFactory.h, Mercator/ShaderFactory.cpp, Mercator/ShaderFactory_impl.h: New factory classes to handle creating shaders from a string giving the shader type. * tests/testShaderFactory.cpp: Test for new shader factory classes. 2005-05-09 James Turner <james@worldforge.org> * Mercator/AreaShader.cpp: zero out the Buffer before shading it, to avoid problems if the memory allocator doesn't zero it for us. 2005-05-08 Al Riddoch <alriddoch@zepler.org> * NEWS: Set date on 0.2.2 release entry. * configure.ac: Increment interface version for release. * Release 0.2.2, interface version 3. 2005-05-08 James Turner <james@worldforge.org> * Mercator/Terrain.cpp: when adding an area, if the segment already has a shader for the area's layer, mark the surface as invalid. * Mercator/Segment.h, Mercator/Segment.cpp: rename 'getBox' to 'getRect', and make a real 'getBox' that returns an AxisBox<3>, where the z values are defined by the min and max height of the segment. * Mercator/AreaShader.cpp: update for the changed Segment API 2005-05-08 Al Riddoch <alriddoch@zepler.org> * Mercator/Area.cpp, Mercator/Area.h, Mercator/Buffer.h, Mercator/Buffer_impl.h, Mercator/GrassShader.cpp, Mercator/Shader.cpp, Mercator/Shader.h, Mercator/Surface.cpp, Mercator/Surface.h: Surfaces now have a const reference to Segment so they can't modify the Segment data. 2005-05-05 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h: Add accessor for segment position on the basepoint grid. 2005-04-30 Al Riddoch <alriddoch@zepler.org> * acinclude.m4: Remove unused CPPUnit macro, and add required pkg-config macro. 2005-04-30 Al Riddoch <alriddoch@zepler.org> * NEWS: Add a pending news item for the upcoming release. * configure.ac: Update autoconf usage. Remove MERCATOR_VERSION. * tests/Makefile.am: Add test*.pgm to the DISTCLEANFILES so that distcheck runs cleanly. 2005-04-23 Al Riddoch <alriddoch@zepler.org> * mercator.spec.in: Remove some unnecessary Requires lines from the rpm spec. 2005-04-21 Al Riddoch <alriddoch@zepler.org> * Mercator/TileShader.cpp: Fix shader so it allocates surface store before shading, and does not attempt to shade subsurfaces that will contain no data. 2005-04-21 Al Riddoch <alriddoch@zepler.org> * Mercator/TileShader.h, Mercator/TileShader.cpp: Implement shading the tile buffer, and method required to add sub shaders. * tests/testTileShader.cpp: Unit test for TileShader. 2005-04-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h: Fix documentation comment now that member has been changed. * Mercator/TileShader.h, Mercator/TileShader.cpp: Starting point for new class to handle determining what the surface is made of. 2005-04-12 James Turner <james@worldforge.org> * Mercator/Terrain.cpp: when adding an area to a segment, check if any shaders now intersect the segment, and if so, add a surface for them. * Mercator/Terrain.cpp: re-order Segment building code in setBasePoint, so areas are added before surfaces. * Mercator/Segment.cpp, Mercator/Segment.h: factor segment invalidation into a helper method, and invalidate segments when an Area is added to a Segment. * Mercator/Area.cpp: remove debug code. 2005-04-12 Al Riddoch <alriddoch@zepler.org> * tests/testShader.cpp: Check if a shader being tested intersects with a given Segment before attempting to populate it. 2005-04-12 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.cpp, Mercator/Segment.cpp: Fix use of iterators in for loops to be more efficient. 2005-04-12 James Turner <james@worldforge.org> * Mercator/Terrain.cpp: formatting / style changes to appease the great dark lord of Soton. 2005-04-12 James Turner <james@worldforge.org> * Mercator/Shader.h: change checkIntersects to work on Segments (as the comments suggest it originally did). * Mercator/Terrain.cpp, Mercator/Terrain.h: when adding a shader, clients must now specify a unique integer ID, which is used to identify the shader in a Segment's surfacestore. As a result, the Shaderstore is now a std::map<>. When adding shaders to a Segment, checkIntersects is now used to only add shaders which affect the segment. * Mercator/Segment.cpp, Mercator/Segment.h: change Surfacestore to be sparse, implement as a map, where the index value is the ID of the shader which generated the surface. * Mercator/AreaShader.cpp, Mercator/AreaShader.h, Mercator/DepthShader.h, Mercator/DepthShader.cpp, Mercator/FillShader.cpp, Mercator/FillShader.h, Mercator/GrassShader.cpp, Mercator/GrassShader.h, Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h: update the revised shader API. In all cases the only change is removed a level of indirection, since every implementation of checkIntersect simply called 's.m_segment' to do useful work. * tests/testArea.cpp, tests/testTerrain.cpp: update tests for new shader API. 2005-04-11 James Turner <james@worldforge.org> * tests/timeSeg.cpp: fix up for changes to Forest API. 2005-04-10 Al Riddoch <alriddoch@zepler.org> * Mercator/Area.h: Fix bbox() accessor to return by reference, and add an accessor for the area polygon. * configure.ac: Bump version to 0.2.2, so apps can test for new Forest and Area API. 2005-04-10 James Turner <james@worldforge.org> * Mercator/Forrest.cpp, Mercator/Forrest.h: make Forrest objects own an area, replacing their own Box + Polygon storage, which was only partially supported. * tests/testForrest.cpp: update for changed Forrest API * Mercator/Terrain.cpp, Mercator/Terrain.h: make Terrain track a list of areas, and install them on newly created segments if required. Necessary to allow Areas to be defined prior to segments they may intersect. 2005-04-05 James Turner <james@worldforge.org> * Mercator/AreaShader.cpp, Mercator/Area.cpp: remove #pragmas I left in, which GCC moans about. 2005-03-28 Al Riddoch <alriddoch@zepler.org> * Mercator/AreaShader.cpp: Fix iterator usage in shade(). * tests/Makefile.am: Enable testArea again. 2005-03-26 Al Riddoch <alriddoch@zepler.org> * tests/Makefile.am: Remove testArea from tests so its not run as its broken. 2005-03-26 Al Riddoch <alriddoch@zepler.org> * tests/Makefile.am: Add testArea to the check programs so it builds. 2005-03-25 Al Riddoch <alriddoch@zepler.org> * Mercator/AreaShader.cpp: Include config.h so that iround.h works right. 2005-03-25 James Turner <james@worldforge.org> * Mercator/Area.cpp, Mercator/Area.h, Mercator/AreaShader.cpp, Mercator/AreaShader.h: adding missing copyright statements on the new files. 2005-03-25 James Turner <james@worldforge.org> * Mercator/Area.cpp, Mercator/Area.h: initial work on supporting polygonal areas in Mercator. * Mercator/AreaShader.cpp, Mercator/AreaShader.h: shader which scan- converts areas into a Surface, with basic anti-aliasing. * test/testArea.cpp: basic tests of the Area API 2005-03-03 Al Riddoch <alriddoch@zepler.org> * Mercator/TerrainMod.cpp, Mercator/TerrainMod.h: Add a virtual destructor to TerrainMod. 2005-02-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp, Mercator/Segment.h: Remove obsolete unused vertex cache code. 2004-12-31 Al Riddoch <alriddoch@zepler.org> * mercator.spec.in: Update spec with License URL Package Vendor and Distribution tags. 2004-08-05 Al Riddoch <alriddoch@zepler.org> * tests/testIntersect.cpp: Fix equality test in the tests and add a commenting explaining why. * Commit configure.ac changes for the 0.2.1 release. Actual 0.2.1 release date was 2004-07-21. 2004-08-05 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h, Mercator/Matrix.h, Mercator/Plant.h, Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Shader.cpp, Mercator/Shader.h, Mercator/Terrain.cpp, Mercator/Terrain.h: Some minor API tweaks and cleanups. * tests/main.cpp, tests/testShader.cpp: Update tests to take account of API changes. 2004-06-07 Al Riddoch <alriddoch@zepler.org> * Mercator/TerrainMod_impl.h: Fixes to work with gcc 3.4 stricter template compiler thanks to Erik Hjortsberg. 2004-06-06 Al Riddoch <alriddoch@zepler.org> * Fix devel dependencies in rpm spec. 2004-06-05 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h: Add method to set min and max at creation time. * Mercator/Terrain.cpp: When creating a new segment, set its min and max to the min and max height of the BasePoints. 2004-06-03 James Turner <james@worldforge.org> * XCode project updates 2004-06-03 Al Riddoch <alriddoch@zepler.org> * Mercator/iround.h, Mercator/DepthShader.cpp, Mercator/Forest.cpp, Mercator/Segment.cpp, Mercator/Terrain.cpp: Clean up use of the I_ROUND macro by moving its definition into a build only header. * Mercator/Segment.cpp: Ensure floats are used not doubles in calculations, and use the float version of libm calls where apropriate. 2004-05-18 Al Riddoch <alriddoch@zepler.org> * Release 0.2.0, interface version 1.0.0 2004-05-18 Al Riddoch <alriddoch@zepler.org> * Final tweak to rpm spec. 2004-05-18 Al Riddoch <alriddoch@zepler.org> * Tweak configure.ac. 2004-05-18 Al Riddoch <alriddoch@zepler.org> * tests/testIntersect.cpp: Provide more details when getHeightAndNormal test fails. 2004-05-18 Al Riddoch <alriddoch@zepler.org> * Mercator/BasePoint.cpp: Tweak roughnes and falloff to give nicer looking terrain. * Mercator/Segment.cpp: Clarify the qRMD implementation function. 2004-05-18 Al Riddoch <alriddoch@zepler.org> * Get canonical system for cross compiling. 2004-05-17 Al Riddoch <alriddoch@zepler.org> * Migrate to configure.ac and fix rpm spec. 2004-05-15 Al Riddoch <alriddoch@zepler.org> * Switch to configure.ac, bump up version numbers, fix spec and prepare for release. 2004-04-08 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp: Fix the normal calculation. Really right now. 2004-04-07 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h, Mercator/Terrain.cpp: Fixes to be compatible with other compilers. * Mercator/Segment.cpp: Fix seem normals, and avoid using variable size local arrays, and handle systems with no rint. * Mercator/Forest.cpp, Mercator/DepthShader.cpp: Handle systems with no rint. 2004-03-19 Al Riddoch <alriddoch@zepler.org> * Mercator/GrassShader.cpp: Fix uninitialised 0,0 corner tile in grass shader. 2004-02-22 Damien McGinnes <mcginnes at netspeed dot com.au> * README: minor mods, added Vegetation section 2004-02-07 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/Forest.cpp: fixed 'bbox to polygon' calc; also test inside polygon during populate. 2004-02-06 Al Riddoch <alriddoch@zepler.org> * tests/testForest.cpp: Update tests to use new accessors for forest area. 2004-02-06 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.h, Mercator/Forest.cpp: Modify accessors so area of a forest is stored as Polygon instead of a box. 2004-02-03 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/RandCache.h: make RandCache store uint32 rather than double. Should halve memory usage. 2004-01-24 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/Forest.h, Mercator/Forest.cpp: make forest use RandCache. 2004-01-24 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/RandCache.h: add code to provide a pool of repeatable (2d indexed) random numbers for use by Forest etc. thanks to rsteinke. 2004-01-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp: Use WFMath's value of PI, as windows does not include it in math.h. 2004-01-17 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp: Revert changes to rng seeding as the behavoir broke some of the key repeatability features required. Add comments explaining what the valued properties of the algorithm are. 2004-01-17 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/Forest.cpp, Mercator/Forest.h : modified seeding arrangement so that number of rng seeds is proportional to number of trees, not number of gridpoints. This significantly speeds up forest generation and has the byproduct of improving the randomness of forests. I defaulted the seed to 0 in the constructor so hopefully existing code will still compile * tests/testForest.cpp put a seed in the forest constructor * tests/timeSeg.cpp added a test to time forest population 2004-01-17 Damien McGinnes <mcginnes at netspeed dot com.au> * Mercator/Forest.cpp : modified seeding in forest to use an array 2004-01-15 James Turner <james@worldforge.org> * Update XCode project : proper WFMath dependancy, and many more tests, plus an aggregate target which builds all the tests. 2004-01-15 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp, Mercator/Forest.cpp, Mercator/Terrain.cpp: Make sure config.h and cmath are being included as required. 2004-01-15 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp: Reduce probability of tree at given node by factor of 10. 2004-01-13 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h, Mercator/Plant.h: Add accessors for plant and forest properties. Implement populating the forest with plants. * tests/testPlant.cpp: Add tests for new accessors. * tests/testForest.cpp: Add test for populating code. 2004-01-13 Al Riddoch <alriddoch@zepler.org> * tests/testQRNG.cpp: Unit test to verify predictability of quasi random number generator. 2004-01-13 Al Riddoch <alriddoch@zepler.org> * Mercator/Forest.cpp, Mercator/Forest.h, Mercator/Plant.cpp, Mercator/Plant.h, tests/testPlant.cpp: New classes for handling vegetation, including basics of functionality, and unit tests. 2004-01-13 Al Riddoch <alriddoch@zepler.org> * Mercator/BasePoint.h, Mercator/BasePoint.cpp: Move static float variable definition into cpp file for strict C++ compliance. 2003-12-19 Al Riddoch <alriddoch@zepler.org> * Remove Serial from rpm spec as it is not required, and messes up deps. 2003-11-27 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.cpp: Use lrintf or equivalent for clean fast float-int conversion. 2003-11-03 James Turner <james@worldforge.org> * Add ProjectBuilder project, Mercator builds with no problems, but hasn't been tested. 2003-11-01 Al Riddoch <alriddoch@zepler.org> * Fix BuildRequires in rpm spec. 2003-10-31 Damien McGinnes * fixed tests/util_timer compile and link 2003-10-31 Damien McGinnes * Added timeSeg test 2003-10-31 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp: Use apropriate rint() function to convert float to int. * Mercator/Intersect.cpp, Mercator/Intersect.h, tests/main.cpp: Add copyright notice. * Mercator/TerrainMod.h, Mercator/TerrainMod_impl.h: Fix copyright notice. 2003-10-31 Damien McGinnes * Mercator/DepthShader.cpp: fixed type warning * README: Added some text 2003-10-24 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp: Fix incorrect assert. 2003-09-22 Damien McGinnes * Mercator/Segment.cpp: minor changes to interpolation to improve performance in the general case. (gives about a 5% speedup) * Mercator/Intersect.cpp: made some file scope functions static on advice from rsteinke. init'ed som vars to keep gcc happy. made ray intersect return true if ray begins below terrain. 2003-09-14 Damien McGinnes * testPhys.cpp: added a rudimentary physics model to do a more useful test of the ray-terrain intersection * Mercator/Intersect.cpp,h: some cleanups for bugs found during the above test 2003-09-13 Damien McGinnes * TODO: cleaned up a few old TODOs 2003-09-13 Damien McGinnes * Mercator/Intersect.cpp,h: some intersection code cleanup ray intersection now returns the point of intersection and normal. * Mercator/Segment.cpp: fixed normal for intersection on diagonal of a cell (between the two triangles of the quad) also normalised the returned normal 2003-09-12 Damien McGinnes * Mercator/Intersect.cpp,h: maybe finished ray intersection needs more testing * tests/testIntersect.cpp: added more tests 2003-09-11 Damien McGinnes * Mercator/Intersect.cpp,h: added ray intersection with terrain not complete yet, ray/triangle tests not added * tests/testIntersect.cpp: added ray intersection test - not finished 2003-09-10 Damien McGinnes * Mercator/Intersect.cpp,h: added point intersection with terrain and height over terrain functions 2003-09-10 Damien McGinnes * Mercator/Intersect.cpp,h: added files for axisbox intersection with terrain * tests/testIntersect.cpp: added files for intersection unit tests 2003-09-06 Damien McGinnes * Mercator/Surface.cpp: fixed a segfault in invalidate; slight cleanup to the rounding code in clipToSegment. 2003-09-03 Al Riddoch <alriddoch@zepler.org> * Mercator/Surface.h: Use <climits> to get the max value of a char. * Mercator/Surface.cpp, Mercator/Buffer.h, Mercator/Buffer_impl.h: Modify buffers and thus surfaces to handle their memory dynamically, providing facilities for allocating and deleting the buffer. * Mercator/Segment.h, Mercator/Segment.cpp: Implement easier memory management, getting rid of the flags for points and normals, using the value of the pointer instead. Add a few to be called to cause the segment to free its data, with the option to keep hold of the height field. 2003-09-01 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h, Mercator/Terrain.cpp: Add new getHeightAndNormal() method which makes available the method of the same name from Segment on the whole terrain. 2003-08-31 Al Riddoch <alriddoch@zepler.org> * Mercator/Shader.h: Add default arguments for constructor, which default to alpha channel only. * Mercator/ThresholdShader.cpp, Mercator/GrassShader.cpp, Mercator/FillShader.cpp, Mercator/DepthShader.cpp: Stop specifying arguements to the shader constructor, and thus accept the defaults. Net effect is that surface buffers now just contain alpha values by default. 2003-08-22 Damien McGinnes * Mercator/Segment.cpp: fixed edge and corner normals. 2003-08-17 Al Riddoch <alriddoch@zepler.org> * Buffer_impl.h: Add to distribution. * Mercator/Segment.cpp: Make sure math functions are specified as being from the global namespace, and add support for rintf as its better than rint, and available under FreeBSD. 2003-08-17 Al Riddoch <alriddoch@zepler.org> * Mercator/Buffer.h: Make segment this buffer is bound to public. * Mercator/Segment.cpp: Set m_min and m_max to values other that 0, so that they end up with the right value. * Mercator/DepthShader.h, Mercator/DepthShader.cpp, Mercator/FillShader.h, Mercator/FillShader.cpp, Mercator/GrassShader.h, Mercator/GrassShader.cpp, Mercator/ThresholdShader.h, Mercator/ThresholdShader.cpp, Mercator/Shader.h: Add virtual method to shaders to allow a check whether the min and max values of a segment intersect with the range affected by this shader. * Mercator/Surface.h, Mercator/Surface.cpp: Make shader reference public, and add a check so that we only shade surfaces where the shader usefully applies to the segment. 2003-08-15 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp: Add test for lrintf() which is more suitable and faster than rint() on platforms which have it. 2003-08-14 Damien McGinnes * Mercator/Segment.cpp: use MersenneTwister from wfmath 2003-08-12 Al Riddoch <alriddoch@zepler.org> * Update to use wfmath 0.3 for compatability with eris 1.2. We are now clear to use Mersenne Twister from wfmath. 2003-08-11 Al Riddoch <alriddoch@zepler.org> * Mercator/Buffer.cpp, Mercator/Buffer.h, Mercator/Buffer_impl.h: Convert to template so that buffer data can be an array of any type. * Mercator/Surface.cpp, Mercator/Surface.h: Specialise Buffer as unsigned bytes. Much more compact than floats. * Mercator/ThresholdShader.cpp, Mercator/GrassShader.h, Mercator/GrassShader.cpp, Mercator/FillShader.cpp, Mercator/DepthShader.cpp: Re-write shaders to be largely buffer type independant. 2003-08-09 Damien McGinnes * Mercator/Segment.cpp, Mercator/MersenneTwister.h, configure,in: put MersenneTwister in Mercator until clients are ready to move across to wfmath-0.3 2003-08-09 Damien McGinnes * Mercator/Segment.cpp: use a local random number generator to ensure the rng state cant be affected by other use of rand() in an app. Change the RNG code to utilise the MersenneTwister. * configure.in: require wfmath 0.3 for the MersenneTwister RNG. * Mercator/BasePoint.h: seed() now returns an unsigned int. * this RNG gives a 20% spped increase on optimized (-O2) code compared with rand(). (unoptimized it's roughly the same) generate 400 tiles (height only, res 64) std rand = 1.75 seconds = 4.4 ms per tile mt rand = 1.41 seconds = 3.5 ms per tile 2003-08-08 Damien McGinnes * Mercator/Segment.cpp: changed round() to rint() * updated TODO 2003-08-06 Al Riddoch <alriddoch@zepler.org> * Removed depency on Atlas-C++ for now. 2003-08-06 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h, Mercator/Segment.cpp: Add vertex cache pointer to segment. Vertex buffer is handled by client. 2003-07-31 Al Riddoch <alriddoch@zepler.org> * Mercator/TerrainMod.h, Mercator/TerrainMod_impl.h, Mercator/TerrainMod.cpp: Move definition of virtual methods out of the headers, as they can't be inlined. * tests/testTerrainMod.cpp: Add unit test for terrain mods. 2003-07-28 Al Riddoch <alriddoch@zepler.org> * Mercator/Buffer.cpp, Mercator/Buffer.h: Add accessor operators so data can be accessed by coordinate and channel. Store size locally. * Mercator/Matrix.h: Use unsigned int for indexs. Safer. * Mercator/GrassShader.cpp Mercator/GrassShader.h: Add new shader for bands which also have a slope dependence. * tests/testShader.cpp: Include GrassShader in tests. 2003-07-28 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp, Mercator/DepthShader.h: Fix some bugs. * Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h: Fix order of constructor argments. 2003-07-27 Al Riddoch <alriddoch@zepler.org> * Mercator/DepthShader.cpp, Mercator/DepthShader.h: Add a shader for tinting terrain below water level to simulate light attenuation due to water. 2003-07-27 Al Riddoch <alriddoch@zepler.org> * Mercator/Shader.cpp, Mercator/Shader.h: Add flags to shader to specify whether this shader requires colour and alpha elements in the surface buffer. Add a method which creates a surface with the required kind of buffer. * Mercator/Surface.cpp, Mercator/Surface.h: Make a couple of references const. Add flags which provide hints about the number of channels required in the surface. * Mercator/Terrain.cpp: Use new method in shader to create surface objects. * Mercator/FillShader.cpp, Mercator/FillShader.h, Mercator/ThresholdShader.cpp, Mercator/ThresholdShader.h: Update shaders to new base class. * tests/testShader.cpp: Update tests, check for a bit more info, and ensure that exit status reflects if an error occured. 2003-07-26 Damien McGinnes * Mercator/Segment.cpp: check segment validity before applying mod to prevent a segfault. 2003-07-26 Al Riddoch <alriddoch@zepler.org> * Mercator/FillShader.cpp: Fix unsigned int warning. * Mercator/ThresholdShader.cpp Mercator/ThresholdShader.h: Implement threshold shaders for simple landscape concepts. * tests/testShader.cpp: Update shader unit test to test all current shaders. 2003-07-25 Al Riddoch <alriddoch@zepler.org> * We're not using CppUnit, so get rid of the check. 2003-07-25 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.cpp, Mercator/Terrain.h: Add new argment to to constructor for options, which amongst others will define whether the terrain has surfaces. Implement code for adding surfaces to a segment, and shading those surfaces. * Mercator/Segment.h, Mercator/Segment.cpp: Add a typedef and accessors for the surface list. Add a method to call populate on all the segments surfaces. * tests/testTerrain.cpp: Add tests to overall unit test to check the shader functionality of Terrain. 2003-07-24 Al Riddoch <alriddoch@zepler.org> * Mercator/FillShader.h: Make FillShader inherit from Shader, as it should have done all along. * Mercator/Segment.h: Add list of surfaces of this segment. Fill out some comments. * Mercator/Surface.cpp, Mercator/Surface.h: Store a reference to its shader in a surface. Add populate member which causes the shader to shade this surface. This allows the code to populate a set of surfaces without knowing what the shaders are supposed to be. * Mercator/Terrain.cpp, Mercator/Terrain.h: Add methods to add and shade the surfaces of a segment. * tests/testShader.cpp: Modify unit test to account for modified API. 2003-07-24 Al Riddoch <alriddoch@zepler.org> * Mercator/Buffer.h, Mercator/Buffer.cpp: Add member to store number of channels, and add accessors for channels, and Segment reference. * Mercator/Shader.cpp, Mercator/Shader.h: Remove constructor arguments, and segment reference member. A shader is not bound to a segment, not restricted to a fixed number of channels. Add shade() vertual method which applies the given shader to a surface. * Mercator/FillShader.cpp, Mercator/FillShader.h: Add demo shader that just fills the surface with 1s. * tests/testShader.cpp: Add a shader unit test which uses FillShader for now. 2003-07-24 Al Riddoch <alriddoch@zepler.org> * tests/testTerrain.cpp: Add unit test for terrain class. 2003-07-24 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h: Add storage and accessors for shaders. 2003-07-21 Al Riddoch <alriddoch@zepler.org> * Tweak configure.in to be a little more compatable with older autoconf. 2003-07-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h: Add accessor for the size member. * Mercator/Buffer.h, Mercator/Buffer.cpp, Mercator/Surface.h, Mercator/Surface.cpp: Make a base class for handling float buffers for vertex, texture coord and colour data. Use it as the basis for Surface. * Mercator/Shader.h, Mercator/Shader.cpp: Place holder for shaders which implement rules creating a surface from the segment height data according to a rule. 2003-07-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp: Free the float buffers using the correct array delete operator. 2003-07-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h, Mercator/Segment.cpp: Allocate point data on the fly. Use m_res and m_size in the terrain population functions rather than recalculating, or passing values. 2003-07-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Surface.h, Mercator/Surface.cpp: Make surface class a little more flexible by paramaterising the number of channels. * Mercator/Segment.h, Mercator/Segment.cpp: Add convenience membe m_size which is m_res + 1, so we don't have to keep doing that calculation. 2003-07-06 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h: Re-name getSize() to getResolution() * Mercator/Surface.h, Mercator/Surface.cpp: Store a reference to the the segment this is a layer of, and add an enumeration for indicating the orientation of the texturing on this layer. 2003-07-06 Al Riddoch <alriddoch@zepler.org> * Clean up configure.in a bit. 2003-07-05 Damien McGinnes * Mercator/TerrainMod.h: added a CraterTerrainMod that subtracts a sphere from the terrain. 2003-07-03 Al Riddoch <alriddoch@zepler.org> * Update rpm spec to be cleaner, and make the technical sections more generic. 2003-07-03 Al Riddoch <alriddoch@zepler.org> * Remove legacy mercator-config script and m4 macro, as we don't want people using them. 2003-06-27 Damien McGinnes * Mercator/Terrain.cpp, Terrain.h: made addMod take a const ref to a terrain mod (bit cleaner) * Mercator/TerrainMod.h: made clone methods const 2003-06-26 Damien McGinnes * Mercator/Segment.cpp, Segment.h: Added the location of the segment. Changed applyMod to work with mods in absolute coords * Mercator/Terrain.cpp, Terrain.h: added addMod to apply mods to the terrain - this allows a mod to span several segments * Mercator/TerrainMod.h: added a clone method, fixed the virtual keyword on a few methods, disabled copy constructors 2003-06-23 Al Riddoch <alriddoch@zepler.org> * Fix Makefile.ams so that distcheck works. * tests/main.cpp: Fix tests to work with recent API changes. 2003-06-22 Al Riddoch <alriddoch@zepler.org> * Mercator/Mercator.h, Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Terrain.cpp, Mercator/Terrain.h: Clean up the way the default segment resolution and size is handled. * Mercator/Surface.cpp, Mercator/Surface.h: Framework for class representation texture layers on the terrain. 2003-06-22 Al Riddoch <alriddoch@zepler.org> * Updated copyright statements to include Damien a bit more. 2003-06-22 Damien McGinnes * Mercator/Segment.cpp: fixed an error in the clip code (x and y were switched) 2003-06-22 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h: Make invalidate() private. * Mercator/Terrain.cpp, Mercator/Terrain.h: Fix bugs in revised setBasePoint. Remove obsolete methods, and simply to one getSegment call, as two are no longer required. Add destructor. 2003-06-21 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp, Mercator/Segment.h: Store control points in the segment object, so it can be re-populated. * Mercator/Terrain.cpp, Mercator/Terrain.h: Manage the creation of new Segment objects when inserting new base points, and handle invalidation at this point too. getSegmentSafe is now deprecated. Untested. * tests/main.cpp: Update tests for API change, and clean up output. 2003-06-21 Damien McGinnes * Mercator/Terrain.cpp: - fixed a bug in invalidatePoint (i, j), not (x,y) - removed the erase line in invalidateSegment (mem leak, and loses mods to the segment) - fixed one of the loop limits in refresh 2003-06-20 Al Riddoch <alriddoch@zepler.org> * Mercator/Matrix.cpp: Add template instantiations, which I assume was the effect intended by the previous code. * Mercator/Terrain.h, Mercator/Terrain.cpp: Re-work segment invalidation code. operator[] should never be used to test for a key in an STL map. * Mercator/Segment.cpp, Mercator/Segment.h, Mercator/TerrainMod.h: Fix comment and code formatting. 2003-06-20 Damien McGinnes * Mercator/Terrain.cpp: changed invalidate and getSegmentSafe to use the validity flags * tests/main.cpp: did a 30 second test of the above code 2003-06-20 Damien McGinnes * Mercator/Segment.cpp: added validity flags for points and normals, and fixed up a few code alignment probs * Mercator/Terrain.h: started to change invalidate. (commented out right now) Need to modify getSegmentSafe to use the validity flags and only create a new segment when one is not already there. 2003-06-19 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h: Add support for legacy interface. 2003-06-19 Al Riddoch <alriddoch@zepler.org> * tests/main.cpp: Move the test prog out of the main code. * Mercator/BasePoint.h: Re-work BasePoint class to be more inline with the main style. * Mercator/Segment.cpp: Fix up the code to use the new BasePoint style. 2003-06-15 Damien McGinnes * new BasePoint.h replaces floats for basepoints * Mercator/Segment.cpp : variable roughness implemented * added a basic test file - doesnt do much 2003-06-09 Damien McGinnes * Mercator/Segment.cpp : modified the normals, this time hopefully so they will work 2003-06-09 Damien McGinnes * Mercator/Segment.cpp : modified the normal array to be same size as the heights array. bottom and right boundaries are a bit of a hack 2003-06-09 Damien McGinnes * Mercator/Segment.cpp : added in an attempt at values for the normal array. Array is one row and column smaller than the height array. 2003-06-08 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h, Mercator/Segment.cpp: Tidy up some code, and add the beginnings of the normal calculation code. 2003-06-08 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h, Mercator/Terrain.cpp: Get rid of the passing over extra surrounding basepoints into Segment::populate. * Mercator/Segment.h, Mercator/Segment.cpp: No longer require surrounding basepoints when doing qRMD. Add API and stubs for storing an entire array of normals. Segment::populateNormals() currently just allocates the array of normals. It does nothing else. 2003-06-06 Damien McGinnes * TerrainMod.h: fixed where I called Center() instead of getCenter() 2003-06-06 Damien McGinnes * TerrainMod.h : added. Defines modifiers for the terrain. * Segment.h/Segment.cpp : modified to use TerrainMod objects, stored in a list, applied in order during populate * removed Segment_impl.h refactored out. 2003-06-03 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment_impl.h Mercator/Segment.cpp: Fix problem with wfmath template instances, and clean up code. 2003-06-03 Damien McGinnes * Segment.cpp Segment.h Segment_impl.h: started work on modification of terrain. Still got a problem that the Contains call in Segment_impl.h doesnt work (link error) 2003-05-24 Damien McGinnes * Mercator/Segment.h Mercator/Segment.cpp: Cleaned up Segment, removed tile.cpp and tile.h and moved them into Segment * TODO: added some ideas * AUTHORS: added some authors * added getHeightAndNormal to segment * addded some test code for modifying terrain to segment 2003-05-14 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.h, Mercator/Segment.cpp: Add a destructor so we can free the vertex storage. 2003-04-25 Al Riddoch <alriddoch@zepler.org> * Mercator/Segment.cpp, Mercator/Segment.h: Initialise min and max properly, and make their accessors const. 2003-04-25 Damien McGinnes * Mercator/tile.cpp,h: Added min and max calcs * Mercator/Segment.cpp,h: added accessors for min and max 2003-04-19 Al Riddoch <alriddoch@zepler.org> * Mercator/Terrain.h: Add accessor for resolution variable. 2003-04-17 Al Riddoch <alriddoch@zepler.org> * Mercator/Matrix.cpp, Mercator/Segment.cpp, Mercator/Segment.h, Mercator/Terrain.cpp: Move source into Mercator subdir for portability. 2003-03-31 Damien McGinnes * src/tile.cpp: modified algorithm, cleaned up code slightly algorithm now generates 1 tile very quickly, but has problems on steep tiles where one side is quite flat. (seams are more visible). 2003-03-29 Al Riddoch <alriddoch@zepler.org> * src/tile.cpp: Tweak tile() to create a size+1 * size+1 segment. * src/Segment.cpp: Switch to using damien's algorithm for testing. 2003-03-28 Al Riddoch <alriddoch@zepler.org> * src/Matrix.h, src/Matrix.cpp: Add matrix class for handling basepoints. * src/tile.h, src/tile.cpp: damiens experimental qRMD implementation. * src/Terrain.h, src/Terrain.cpp, src/Segment.cpp: Use Matrix to handle basepoints. * src/Segment.cpp: Use memcpy to make copying rows more efficient. 2003-03-19 Al Riddoch <alriddoch@zepler.org> * src/Terrain.h, src/Terrain.cpp: Make value for missing points the the average of surrounding points that are present. Makes edges of know terrain more sane. 2003-03-19 Al Riddoch <alriddoch@zepler.org> * src/Terrain.cpp: Back off change to default height points to make terrain seamless again. 2003-02-23 Al Riddoch <alriddoch@zepler.org> * src/Terrain.cpp: Make default height points work more sanely. 2003-02-23 Al Riddoch <alriddoch@zepler.org> * src/Terrain.cpp: Make refreshing work more sanely. 2003-02-21 Al Riddoch <alriddoch@zepler.org> * src/Terrain.h: Add accessor for point store. 2003-02-17 Al Riddoch <alriddoch@zepler.org> * src/Segment.h, src/Segment.cpp: Add a row and column of extra heightpoints to the segment to make it easier to render. 2003-01-31 Al Riddoch <alriddoch@zepler.org> * Convert to using pkg-config 2003-01-28 Al Riddoch <alriddoch@zepler.org> * src/Segment.cpp, src/Segment.h: Fully implement qRMD with roughness and falloff. 2003-01-28 Al Riddoch <alriddoch@zepler.org> * src/Segment.cpp, src/Segment.h: First stab at qRMD algorithm. 2003-01-28 Al Riddoch <alriddoch@zepler.org> * src/Terrain.cpp: Fix segment dependencies. 2003-01-28 Al Riddoch <alriddoch@zepler.org> * src/Segment.cpp, src/Segment.h, src/Terrain.cpp: Implement midpoint based terrain algorithm, currently without any displacement. 2003-01-20 Al Riddoch <alriddoch@zepler.org> * src/Segment.cpp, src/Segment.h, src/Terrain.cpp, src/Terrain.h: Switch to using floats instead of doubles internally for performance. 2003-01-19 Al Riddoch <alriddoch@zepler.org> * src/Segment.h, src/Segment.cpp: Add class for terrain segment, which currently contains an interpolated sloped area. * src/Terrain.h, src/Terrain.cpp: Add functionality required to manage segments in the terrain. 0707010000006D000081ED000000000000000000000001656C865A000006E0000000000000000000000000000000000000004000000000mercator-1701611098.a02d15f/tools/support/generate-ChangeLog.sh#!/bin/bash #A script for combining the legacy ChangeLog found in ChangeLog-CVS with one output from git. The script will only run if the current ChangeLog contains exactly one line. #This makes it possible to do a new "make dist" from an existing source distribution (as the ChangeLog would then be complete.). top_srcdir=$1 distdir=$2 commitid=$3 if [[ x${distdir} = "x" ]] || [[ x${top_srcdir} = "x" ]] || [[ x${commitid} = "x" ]]; then echo "This script will generate an aggregated ChangeLog by combining the legacy ChangeLog-CVS file with the output from git log. It therefore needs to be run in a git source directory." echo "Params: <source directory path> <distribution directory path> <SHA1 of first git commit>" exit 1 fi #Only do the aggregation if the ChangeLog file is exactly one line. If not the aggregation has already been done. if [[ $(wc -l < "${distdir}/ChangeLog") = "0" ]]; then echo "Generating ChangeLog by appending the old CVS ChangeLog to the one generated from git. This requires that you create the dist in the git repository." cd "${top_srcdir}" || exit chmod u+w "${distdir}/ChangeLog" && git log "${commitid}"..HEAD --stat --name-only --date=short --abbrev-commit > "${distdir}"/ChangeLog && echo "" >> "${distdir}/ChangeLog" && cat "${top_srcdir}/tools/support/ChangeLog-CVS" >> "${distdir}/ChangeLog" #Put a notice in the legacy ChangeLog-CVS file, thus bringing the size of the dist down a bit. chmod u+w "${distdir}/tools/support/ChangeLog-CVS" && echo "This file was needed for generating the proper ChangeLog as an aggregate of the code held in git and older code in CVS. It's now empty, but needs to be included in the source distribution to not upset automake." > "${distdir}/tools/support/ChangeLog-CVS" fi 0707010000006E000081ED000000000000000000000001656C865A00000914000000000000000000000000000000000000004100000000mercator-1701611098.a02d15f/tools/support/generate_abi_report.sh#!/bin/bash if [ $# -ne 1 ] then echo "Performs an ABI check against an older version, using the ABI_compliance_checker tool." echo "You must have the ABI_compliance_checker installed to use this script. Get it from http://ispras.linuxbase.org/index.php/ABI_compliance_checker" echo "This script must be run from the Git source directory." echo "Usage: `basename $0` <older_version>" echo "<older_version> is the name of an older tag (or commit) which this script will check out from Git" exit -1 fi command -v git >/dev/null 2>&1 || { echo "Git command not available." > $1; exit 0; } command -v abi-compliance-checker >/dev/null 2>&1 || { echo "abi-compliance-checker command not available; get it from http://ispras.linuxbase.org/index.php/ABI_compliance_checker." > $1; exit 0; } SOURCE_DIR=$PWD #Figure out the name of the lib by looking in "configure" LIBRARY_NAME=`grep PACKAGE_NAME= $SOURCE_DIR/configure | sed -e s/PACKAGE_NAME=\'//g | sed -e s/\'//g` ABI_REPORT_DIR=$PWD/abi_report #Disable warnings to counteract -Werror (older code might cause warnings with newer compilers, and fail through -Werror). export CXXFLAGS="$CXXFLAGS -w" OLD_VERSION=$1 OLD_SOURCE_DIR=$ABI_REPORT_DIR/${OLD_VERSION}_source OLD_BUILD_DIR=$ABI_REPORT_DIR/${OLD_VERSION}_build OLD_INSTALL_DIR=$ABI_REPORT_DIR/${OLD_VERSION}_install MASTER_BUILD_DIR=$ABI_REPORT_DIR/master_build MASTER_INSTALL_DIR=$ABI_REPORT_DIR/master_install mkdir -p $ABI_REPORT_DIR mkdir -p $OLD_SOURCE_DIR mkdir -p $OLD_BUILD_DIR mkdir -p $MASTER_BUILD_DIR #Check out the older version into a separate tree git archive $OLD_VERSION | tar -x -C $OLD_SOURCE_DIR if [ $? != 0 ] then echo "Could not check out '$OLD_VERSION'. Make sure that this is something that's available in Git." exit -1 fi echo "Building master version" cd $MASTER_BUILD_DIR && $SOURCE_DIR/configure --prefix $MASTER_INSTALL_DIR && make install echo "Building older version" cd $OLD_SOURCE_DIR && NOCONFIGURE=1 ./autogen.sh && cd $OLD_BUILD_DIR && $OLD_SOURCE_DIR/configure --prefix $OLD_INSTALL_DIR && make install if [ $? != 0 ] then echo "Error when building old version." exit -1 fi cd $ABI_REPORT_DIR echo "Performing ABI compliance check" abi-compliance-checker -l $LIBRARY_NAME -v1 $OLD_VERSION -v2 master -old $OLD_INSTALL_DIR -new $MASTER_INSTALL_DIR 0707010000006F000081ED000000000000000000000001656C865A00000DFB000000000000000000000000000000000000004000000000mercator-1701611098.a02d15f/tools/support/run_coverage_tests.sh#!/bin/bash check_coverage() { source_file=$1 source_dir=$(dirname "${source_file}") base_file=$(basename "${source_file}" .cpp) test_program=tests/${base_file}test coverage_data=${source_dir}/${base_file}.gcda if [ ! -f "${test_program}".cpp ] then if [ "${report}" -eq 1 -o "${single}" -eq 1 ] then echo No test for "${source_file}" fi return fi if [ "${report}" -eq 1 ] then return fi if [ ! -x "${test_program}" ] then echo Test programs have not been built for "${source_file}" exit 1 fi if [ "${source_file}" -nt "${test_program}" ] then echo Test build is out of date for "${source_file}" exit 1 fi if [ -f "${coverage_data}" ] then rm -f "${coverage_data}" fi ${test_program} > /dev/null 2>&1 if [ $? -ne 0 ] then echo FAIL exit 1 fi if [ ! -f "${coverage_data}" ] then if [ ! -f "${source_dir}"/"${base_file}".gcno ] then if [ "${single}" -eq 1 ] then echo No code to be covered in "${source_file}" fi return fi echo No coverage data "${coverage_data}" for "${source_file}" exit 1 fi # shellcheck disable=SC2086 if [ "${test_program}" -nt ${coverage_data} ] then echo Coverage is out of date for ${source_file} exit 1 fi coverage_percent=$( (cd "${source_dir}" && LC_ALL=C gcov "${source_file}") | \ grep -A 1 "^File '$(basename "${source_file}")" | \ grep ^Lines | \ head -n 1 | \ sed "s/^Lines executed:\([0-9]\+\)\.[0-9]\+% of .*$/\1/") echo "${source_file}" "${coverage_percent}" } usage() { echo "Automate running coverage tools, and generate concise report." echo "usage: run_coverage_tests.sh [OPTION]" echo " run_coverage_tests.sh [SOURCEFILE]" echo "Options:" echo " -r Report source files with a coverage test" echo " -c Re-configure the build to include coverage data" echo " -h Display this usage data" cat <<EOF To pruduce results run this build requires an in-tree build with gcc configured to include coverage data. Use the -c option to run configure with the right options, and run "make clean all check" to fully prepare the build. Running without arguments shows results for all source files in the configured directories. Each file is covered by a test derived from it's name. For example the following file: rulesets/Character.cpp should be covered by; tests/Charactertest.cpp To see line by line data, run this script on Character.cpp only: ./scripts/run_coverage_tests.sh rulesets/Character.cpp and the line by line report will be in this file: rulesets/Character.cpp.gcov EOF } DIRS="Mercator" declare -i report=0 declare -i configure=0 declare -i single=0 while getopts "hrc" options do case $options in r ) report=1;; c ) configure=1;; h ) usage exit 0;; * ) usage exit 1;; esac done if [ ${configure} -eq 1 ] then CXXFLAGS="-g --coverage" ./configure --prefix=/opt/worldforge --enable-debug=yes --enable-binreloc=no exit 0 fi shift $((OPTIND-1)) if [ -n "$1" ] then if [ -f "$1" ] then single=1 check_coverage "$1" exit 0 else usage exit 1 fi fi for dir in ${DIRS} do for source_file in "${dir}"/*.cpp do check_coverage "${source_file}" done done 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!894 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor