1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2

This commit is contained in:
Gefüllte Taubenbrust 2024-11-17 12:02:30 +01:00
commit 00ef9b14d0
1043 changed files with 44800 additions and 28934 deletions

View file

@ -1,4 +1,4 @@
project(minetest)
project(luanti)
INCLUDE(CheckTypeSize)
INCLUDE(CheckIncludeFiles)
@ -6,12 +6,12 @@ INCLUDE(CheckLibraryExists)
check_type_size(int SIZEOF_INT BUILTIN_TYPES_ONLY LANGUAGE CXX)
if(SIZEOF_INT LESS 4)
message(FATAL_ERROR "Minetest will not work with int less than 32 bits wide.")
message(FATAL_ERROR "${PROJECT_NAME_CAPITALIZED} will not work with int less than 32 bits wide.")
endif()
check_type_size(size_t SIZEOF_SIZE_T LANGUAGE CXX)
if(SIZEOF_SIZE_T LESS 4)
message(FATAL_ERROR "Minetest will not work with size_t less than 32 bits wide.")
message(FATAL_ERROR "${PROJECT_NAME_CAPITALIZED} will not work with size_t less than 32 bits wide.")
endif()
# Add custom SemiDebug build mode
@ -379,87 +379,92 @@ add_custom_target(GenerateVersion
add_subdirectory(threading)
add_subdirectory(content)
add_subdirectory(database)
add_subdirectory(gui)
add_subdirectory(mapgen)
add_subdirectory(network)
add_subdirectory(script)
add_subdirectory(unittest)
add_subdirectory(benchmark)
add_subdirectory(util)
add_subdirectory(irrlicht_changes)
add_subdirectory(server)
set(common_SRCS
${database_SRCS}
${mapgen_SRCS}
${server_SRCS}
${content_SRCS}
# Source files that are identical between server & client builds.
# This means they don't use or include anything that depends on the
# CHECK_CLIENT_BUILD() macro. If you wrongly add something here there will be
# a compiler error and you need to instead add it to client_SRCS or common_SRCS.
set(independent_SRCS
chat.cpp
clientdynamicinfo.cpp
collision.cpp
content_mapnode.cpp
content_nodemeta.cpp
convert_json.cpp
craftdef.cpp
debug.cpp
defaultsettings.cpp
emerge.cpp
environment.cpp
face_position_cache.cpp
filesys.cpp
gettext.cpp
gettext_plural_form.cpp
httpfetch.cpp
hud.cpp
inventory.cpp
inventorymanager.cpp
itemdef.cpp
itemstackmetadata.cpp
light.cpp
lighting.cpp
log.cpp
main.cpp
map.cpp
map_settings_manager.cpp
mapblock.cpp
mapnode.cpp
mapsector.cpp
metadata.cpp
modchannels.cpp
nameidmapping.cpp
nodedef.cpp
nodemetadata.cpp
nodetimer.cpp
noise.cpp
objdef.cpp
object_properties.cpp
particles.cpp
pathfinder.cpp
player.cpp
porting.cpp
profiler.cpp
raycast.cpp
reflowscan.cpp
remoteplayer.cpp
rollback_interface.cpp
serialization.cpp
server.cpp
serverenvironment.cpp
servermap.cpp
settings.cpp
staticobject.cpp
terminal_chat_console.cpp
texture_override.cpp
tileanimation.cpp
tool.cpp
${common_network_SRCS}
${content_SRCS}
${database_SRCS}
${threading_SRCS}
${util_SRCS}
)
# /!\ Consider carefully before adding files here /!\
set(common_SRCS
clientdynamicinfo.cpp
collision.cpp
content_mapnode.cpp
defaultsettings.cpp
emerge.cpp
environment.cpp
filesys.cpp
gettext.cpp
inventorymanager.cpp
itemdef.cpp
light.cpp
main.cpp
map_settings_manager.cpp
map.cpp
mapblock.cpp
mapnode.cpp
mapsector.cpp
nodedef.cpp
pathfinder.cpp
player.cpp
porting.cpp
raycast.cpp
reflowscan.cpp
remoteplayer.cpp
rollback_interface.cpp
server.cpp
serverenvironment.cpp
servermap.cpp
translation.cpp
version.cpp
voxel.cpp
voxelalgorithms.cpp
hud.cpp
${common_network_SRCS}
${JTHREAD_SRCS}
${common_SCRIPT_SRCS}
${UTIL_SRCS}
${common_server_SRCS}
${mapgen_SRCS}
${server_network_SRCS}
)
if(ANDROID)
@ -467,10 +472,12 @@ if(ANDROID)
endif()
if(BUILD_UNITTESTS)
add_subdirectory(unittest)
set(common_SRCS ${common_SRCS} ${UNITTEST_SRCS})
endif()
if(BUILD_BENCHMARKS)
add_subdirectory(benchmark)
set(common_SRCS ${common_SRCS} ${BENCHMARK_SRCS})
endif()
@ -481,7 +488,7 @@ endif()
# This gives us the icon and file version information
if(WIN32)
set(WINRESOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc")
set(MINETEST_EXE_MANIFEST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/minetest.exe.manifest")
set(EXE_MANIFEST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/luanti.exe.manifest")
if(MINGW)
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER "windres.exe")
@ -491,10 +498,10 @@ if(WIN32)
-i${WINRESOURCE_FILE}
-o ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${WINRESOURCE_FILE} ${MINETEST_EXE_MANIFEST_FILE})
DEPENDS ${WINRESOURCE_FILE} ${EXE_MANIFEST_FILE})
SET(extra_windows_SRCS ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o)
else(MINGW) # Probably MSVC
set(extra_windows_SRCS ${WINRESOURCE_FILE} ${MINETEST_EXE_MANIFEST_FILE})
set(extra_windows_SRCS ${WINRESOURCE_FILE} ${EXE_MANIFEST_FILE})
endif(MINGW)
endif()
@ -502,6 +509,8 @@ endif()
# Client sources
if (BUILD_CLIENT)
add_subdirectory(client)
add_subdirectory(gui)
add_subdirectory(irrlicht_changes)
endif(BUILD_CLIENT)
set(client_SRCS
@ -521,13 +530,11 @@ if(BUILD_BENCHMARKS)
set(client_SRCS ${client_SRCS} ${BENCHMARK_CLIENT_SRCS})
endif()
list(SORT client_SRCS)
# Server sources
# (nothing here because a client always comes with a server)
set(server_SRCS
${common_SRCS}
)
list(SORT server_SRCS)
# Avoid source_group on broken CMake version.
# see issue #7074 #7075
@ -549,7 +556,7 @@ include_directories(SYSTEM
${GMP_INCLUDE_DIR}
${JSON_INCLUDE_DIR}
${LUA_BIT_INCLUDE_DIR}
# on Android, Minetest depends on SDL2 directly
# on Android, Luanti depends on SDL2 directly
# on other platforms, only IrrlichtMt depends on SDL2
"$<$<PLATFORM_ID:Android>:${SDL2_INCLUDE_DIRS}>"
)
@ -571,18 +578,89 @@ endif()
# When cross-compiling assume the user doesn't want to run the executable anyway,
# otherwise place it in <source dir>/bin/ since Minetest can only run from there.
# otherwise place it in <source dir>/bin/ since Luanti can only run from there.
if(NOT CMAKE_CROSSCOMPILING)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
endif()
# shared object target
add_library(EngineCommon OBJECT
${independent_SRCS}
)
add_dependencies(EngineCommon GenerateVersion)
target_link_libraries(EngineCommon
sha256
)
get_target_property(
IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(EngineCommon PRIVATE ${IRRLICHT_INCLUDES})
if(PRECOMPILE_HEADERS)
target_precompile_headers(EngineCommon PRIVATE ${PRECOMPILED_HEADERS_LIST})
endif()
if(APPLE)
# Configure the Info.plist file
configure_file(
"${CMAKE_SOURCE_DIR}/misc/macos/Info.plist.in"
"${CMAKE_BINARY_DIR}/Info.plist"
)
endif()
if(BUILD_CLIENT)
# client target
if(ANDROID)
add_library(${PROJECT_NAME} SHARED ${client_SRCS})
add_library(${PROJECT_NAME} SHARED)
else()
add_executable(${PROJECT_NAME} ${client_SRCS} ${extra_windows_SRCS})
add_executable(${PROJECT_NAME})
endif()
add_dependencies(${PROJECT_NAME} GenerateVersion)
if(CMAKE_GENERATOR STREQUAL "Xcode")
# File with used entitlements
set(XCODE_CODE_SIGN_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/misc/macos/entitlements/release.entitlements" CACHE FILEPATH "Path to entitlements file to be used with Xcode signing")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/build")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/build")
target_sources(${PROJECT_NAME} PUBLIC ${client_RESOURCES})
add_dependencies(${PROJECT_NAME} translations)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/Info.plist"
RESOURCE "${client_RESOURCES}"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.luanti.luanti"
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES"
XCODE_ATTRIBUTE_INSTALL_PATH "/Applications"
XCODE_ATTRIBUTE_SKIP_INSTALL "NO"
XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES"
XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "$(inherited)"
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${XCODE_CODE_SIGN_ENTITLEMENTS}"
)
# Prinv env variables to file, for debugging purposes
#add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E env bash ${CMAKE_SOURCE_DIR}/util/xcode/capture_env.sh ${CMAKE_BINARY_DIR}/post_env.log
#)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/util/xcode/install_resources.cmake
-DTARGET_DIR=$<TARGET_FILE_DIR:${PROJECT_NAME}>
-DBINARY_DIR=${CMAKE_BINARY_DIR}
-DPROJECT_NAME=${PROJECT_NAME}
COMMENT "Checking INSTALL_ROOT and copying resources"
)
endif()
list(SORT client_SRCS)
target_sources(${PROJECT_NAME} PRIVATE
$<TARGET_OBJECTS:EngineCommon>
${client_SRCS}
${extra_windows_SRCS}
)
target_link_libraries(
${PROJECT_NAME}
${ZLIB_LIBRARIES}
@ -597,10 +675,11 @@ if(BUILD_CLIENT)
sha256
${FREETYPE_LIBRARY}
${PLATFORM_LIBS}
# on Android, Minetest depends on SDL2 directly
# on Android, Luanti depends on SDL2 directly
# on other platforms, only IrrlichtMt depends on SDL2
"$<$<PLATFORM_ID:Android>:${SDL2_LIBRARIES}>"
)
target_compile_definitions(${PROJECT_NAME} PRIVATE "MT_BUILDTARGET=1")
if(NOT USE_LUAJIT)
set_target_properties(${PROJECT_NAME} PROPERTIES
# This is necessary for dynamic Lua modules
@ -659,12 +738,18 @@ endif(BUILD_CLIENT)
if(BUILD_SERVER)
add_executable(${PROJECT_NAME}server ${server_SRCS} ${extra_windows_SRCS})
add_dependencies(${PROJECT_NAME}server GenerateVersion)
# server target
add_executable(${PROJECT_NAME}server)
list(SORT server_SRCS)
target_sources(${PROJECT_NAME}server PRIVATE
$<TARGET_OBJECTS:EngineCommon>
${server_SRCS}
${extra_windows_SRCS}
)
# don't link the irrlicht library
get_target_property(
IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
# Doesn't work without PRIVATE/PUBLIC/INTERFACE mode specified.
target_include_directories(${PROJECT_NAME}server PRIVATE ${IRRLICHT_INCLUDES})
target_link_libraries(
${PROJECT_NAME}server
@ -678,8 +763,7 @@ if(BUILD_SERVER)
${GMP_LIBRARY}
${PLATFORM_LIBS}
)
set_target_properties(${PROJECT_NAME}server PROPERTIES
COMPILE_DEFINITIONS "SERVER")
target_compile_definitions(${PROJECT_NAME}server PRIVATE "MT_BUILDTARGET=2")
if(NOT USE_LUAJIT)
set_target_properties(${PROJECT_NAME}server PROPERTIES
# This is necessary for dynamic Lua modules
@ -777,7 +861,7 @@ elseif(NOT MSVC)
check_c_source_compiles("#include <lua.h>\nint main(){return sizeof(lua_atccall);}" HAVE_ATCCALL)
if(NOT HAVE_ATCCALL)
string(CONCAT explanation_msg
"It looks like you're trying to build Minetest using a system-wide "
"It looks like you're trying to build ${PROJECT_NAME_CAPITALIZED} using a system-wide "
"Lua installation. This is no longer supported because PUC Lua "
"cannot interoperate with C++ correctly. Read src/unittest/test_lua.cpp "
" for technical details.")
@ -820,8 +904,7 @@ if(MSVC)
endif()
else()
# GCC or compatible compilers such as Clang
set(WARNING_FLAGS "-Wall -Wextra")
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-parameter")
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror=vla")
if(WARN_ALL)
set(RELEASE_WARNING_FLAGS "${WARNING_FLAGS}")
else()
@ -951,6 +1034,14 @@ if(WIN32)
endif()
endif()
macro(CreateLegacyAlias _cmake_target _old_path _new_name)
add_custom_target("${_cmake_target}" ALL
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${_new_name}" "${_old_path}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
add_dependencies("${_cmake_target}" "${_new_name}")
install(PROGRAMS "${_old_path}" DESTINATION ${BINDIR})
endmacro()
if(BUILD_CLIENT AND NOT ANDROID)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${BINDIR}
@ -958,6 +1049,9 @@ if(BUILD_CLIENT AND NOT ANDROID)
ARCHIVE DESTINATION ${BINDIR}
BUNDLE DESTINATION .
)
if(UNIX)
CreateLegacyAlias(minetest_alias "${EXECUTABLE_OUTPUT_PATH}/minetest" ${PROJECT_NAME})
endif()
if(APPLE)
install(CODE "
@ -981,6 +1075,9 @@ endif()
if(BUILD_SERVER)
install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR})
if(UNIX)
CreateLegacyAlias(minetestserver_alias "${EXECUTABLE_OUTPUT_PATH}/minetestserver" ${PROJECT_NAME}server)
endif()
endif()
if (ANDROID)

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 Minetest Authors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Minetest Authors
#include "benchmark/benchmark.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 Minetest Authors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Minetest Authors
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 Minetest Authors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Minetest Authors
#include "catch.h"
#include "voxelalgorithms.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2023 Minetest Authors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2023 Minetest Authors
#include "catch.h"
#include "mapblock.h"
@ -49,7 +34,7 @@ static inline void freeAll(MBContainer &vec) { freeSome(vec, vec.size()); }
static void workOnMetadata(const MBContainer &vec)
{
for (MapBlock *block : vec) {
#ifndef SERVER
#if CHECK_CLIENT_BUILD()
bool foo = !!block->mesh;
#else
bool foo = true;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2023 sfan5
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2023 sfan5
#include "catch.h"
#include "util/container.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 Minetest Authors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Minetest Authors
#include "catch.h"
#include "util/serialize.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "chat.h"
@ -25,6 +10,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "config.h"
#include "debug.h"
#include "settings.h"
#include "util/strfnd.h"
#include "util/string.h"
#include "util/numeric.h"

View file

@ -1,24 +1,10 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
#include <set>
#include <string>
#include <vector>
#include <list>
@ -26,7 +12,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes.h"
#include "util/enriched_string.h"
#include "settings.h"
// Chat console related classes

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2015 est31 <MTest31@outlook.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2015 est31 <MTest31@outlook.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
#include <cmath>
#include <log.h>

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2018 nerzhul, Loic BLOT <loic.blot@unix-experience.fr>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "camera.h"
#include "debug.h"
@ -38,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "script/scripting_client.h"
#include "gettext.h"
#include <SViewFrustum.h>
#include <IGUIFont.h>
#include <IVideoDriver.h>
#define CAMERA_OFFSET_STEP 200

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include <iostream>
#include <algorithm>
@ -33,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/renderingengine.h"
#include "client/sound.h"
#include "client/texturepaths.h"
#include "client/texturesource.h"
#include "client/mesh_generator_thread.h"
#include "client/particles.h"
#include "client/localplayer.h"
@ -779,7 +765,7 @@ bool Client::loadMedia(const std::string &data, const std::string &filename,
std::string name;
const char *image_ext[] = {
".png", ".jpg", ".bmp", ".tga",
".png", ".jpg", ".tga",
NULL
};
name = removeStringEnd(filename, image_ext);
@ -841,16 +827,12 @@ bool Client::loadMedia(const std::string &data, const std::string &filename,
return true;
}
const char *translate_ext[] = {
".tr", NULL
};
name = removeStringEnd(filename, translate_ext);
if (!name.empty()) {
if (Translations::isTranslationFile(filename)) {
if (from_media_push)
return false;
TRACESTREAM(<< "Client: Loading translation: "
<< "\"" << filename << "\"" << std::endl);
g_client_translations->loadTranslation(data);
g_client_translations->loadTranslation(filename, data);
return true;
}

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -36,8 +21,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "script/common/c_types.h" // LuaError
#include "util/numeric.h"
#include "util/string.h" // StringMap
#include "config.h"
#ifdef SERVER
#if !IS_CLIENT_BUILD
#error Do not include in server builds
#endif

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "util/serialize.h"
#include "util/pointedthing.h"
@ -111,7 +96,6 @@ void ClientEnvironment::step(float dtime)
/*
Maximum position increment
*/
//f32 position_max_increment = 0.05*BS;
f32 position_max_increment = 0.1*BS;
// Maximum time increment (for collision detection etc)
@ -191,12 +175,11 @@ void ClientEnvironment::step(float dtime)
}
/*
Move the lplayer.
Move the local player.
This also does collision detection.
*/
lplayer->move(dtime_part, this, position_max_increment,
&player_collisions);
lplayer->move(dtime_part, this, &player_collisions);
}
bool player_immortal = false;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2017 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -23,9 +8,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h" // IntervalLimiter
#include "activeobjectmgr.h" // client::ActiveObjectMgr
#include "irr_ptr.h"
#include "config.h"
#include <set>
#ifdef SERVER
#if !IS_CLIENT_BUILD
#error Do not include in server builds
#endif

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#pragma once

View file

@ -1,26 +1,11 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "IAttributes.h"
#include "gui/mainmenumanager.h"
#include "clouds.h"
#include "gui/touchcontrols.h"
#include "server.h"
#include "filesys.h"
#include "gui/guiMainMenu.h"
#include "game.h"
@ -34,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "clientlauncher.h"
#include "version.h"
#include "renderingengine.h"
#include "network/networkexceptions.h"
#include "settings.h"
#include "util/tracy_wrapper.h"
#include <IGUISpriteBank.h>
#include <ICameraSceneNode.h>
@ -71,8 +56,8 @@ static void dump_start_data(const GameStartData &data)
ClientLauncher::~ClientLauncher()
{
delete input;
g_settings->deregisterChangedCallback("dpi_change_notifier", setting_changed_callback, this);
g_settings->deregisterChangedCallback("gui_scaling", setting_changed_callback, this);
g_settings->deregisterAllChangedCallbacks(this);
delete g_fontengine;
g_fontengine = nullptr;
@ -133,6 +118,7 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
guienv = m_rendering_engine->get_gui_env();
config_guienv();
g_settings->registerChangedCallback("dpi_change_notifier", setting_changed_callback, this);
g_settings->registerChangedCallback("display_density_factor", setting_changed_callback, this);
g_settings->registerChangedCallback("gui_scaling", setting_changed_callback, this);
g_fontengine = new FontEngine(guienv);

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "clientmap.h"
#include "client.h"
@ -140,8 +125,7 @@ void ClientMap::onSettingChanged(std::string_view name, bool all)
ClientMap::~ClientMap()
{
for (const auto &name : ClientMap_settings)
g_settings->deregisterChangedCallback(name, on_settings_changed, this);
g_settings->deregisterAllChangedCallbacks(this);
}
void ClientMap::updateCamera(v3f pos, v3f dir, f32 fov, v3s16 offset, video::SColor light_color)

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "clientmedia.h"
#include "gettext.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "clientobject.h"
#include "debug.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "client/renderingengine.h"
#include "client/shader.h"
@ -47,16 +32,13 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
m_seed(seed)
{
assert(ssrc);
m_enable_shaders = g_settings->getBool("enable_shaders");
m_material.BackfaceCulling = true;
m_material.FogEnable = true;
m_material.AntiAliasing = video::EAAM_SIMPLE;
if (m_enable_shaders) {
{
auto sid = ssrc->getShader("cloud_shader", TILE_MATERIAL_ALPHA);
m_material.MaterialType = ssrc->getShaderInfo(sid).material;
} else {
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
m_params = SkyboxDefaults::getCloudDefaults();
@ -75,10 +57,7 @@ Clouds::Clouds(scene::ISceneManager* mgr, IShaderSource *ssrc,
Clouds::~Clouds()
{
g_settings->deregisterChangedCallback("enable_3d_clouds",
&cloud_3d_setting_changed, this);
g_settings->deregisterChangedCallback("soft_clouds",
&cloud_3d_setting_changed, this);
g_settings->deregisterAllChangedCallbacks(this);
}
void Clouds::OnRegisterSceneNode()
@ -136,15 +115,11 @@ void Clouds::updateMesh()
// Colors with primitive shading
video::SColorf c_top_f(m_color);
video::SColorf c_side_1_f(m_color);
video::SColorf c_side_2_f(m_color);
video::SColorf c_bottom_f(m_color);
if (m_enable_shaders) {
// shader mixes the base color, set via ColorParam
c_top_f = c_side_1_f = c_side_2_f = c_bottom_f = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
}
video::SColorf shadow = m_params.color_shadow;
video::SColorf c_top_f(1, 1, 1, 1);
video::SColorf c_side_1_f(1, 1, 1, 1);
video::SColorf c_side_2_f(1, 1, 1, 1);
video::SColorf c_bottom_f(1, 1, 1, 1);
const video::SColorf shadow = m_params.color_shadow;
c_side_1_f.r *= shadow.r * 0.25f + 0.75f;
c_side_1_f.g *= shadow.g * 0.25f + 0.75f;
@ -407,8 +382,7 @@ void Clouds::render()
}
m_material.BackfaceCulling = is3D();
if (m_enable_shaders)
m_material.ColorParam = m_color.toSColor();
m_material.ColorParam = m_color.toSColor();
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->setMaterial(m_material);

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -184,7 +169,7 @@ private:
v3s16 m_camera_offset;
bool m_camera_inside_cloud = false;
bool m_enable_shaders, m_enable_3d;
bool m_enable_3d;
video::SColorf m_color = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);
CloudParams m_params;
};

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "content_cao.h"
#include <IBillboardSceneNode.h>
@ -364,8 +349,6 @@ bool GenericCAO::collideWithObjects() const
void GenericCAO::initialize(const std::string &data)
{
processInitData(data);
m_enable_shaders = g_settings->getBool("enable_shaders");
}
void GenericCAO::processInitData(const std::string &data)
@ -618,7 +601,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
m_material_type_param = 0.5f; // May cut off alpha < 128 depending on m_material_type
if (m_enable_shaders) {
{
IShaderSource *shader_source = m_client->getShaderSource();
MaterialType material_type;
@ -631,13 +614,6 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
u32 shader_id = shader_source->getShader("object_shader", material_type, NDT_NORMAL);
m_material_type = shader_source->getShaderInfo(shader_id).material;
} else {
if (m_prop.use_texture_alpha) {
m_material_type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
m_material_type_param = 1.0f / 256.f; // minimal alpha for texture rendering
} else {
m_material_type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
}
}
auto grabMatrixNode = [this] {
@ -703,9 +679,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
// Set material
setMaterial(buf->getMaterial());
if (m_enable_shaders) {
buf->getMaterial().ColorParam = c;
}
buf->getMaterial().ColorParam = c;
// Add to mesh
mesh->addMeshBuffer(buf);
@ -729,9 +703,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
// Set material
setMaterial(buf->getMaterial());
if (m_enable_shaders) {
buf->getMaterial().ColorParam = c;
}
buf->getMaterial().ColorParam = c;
// Add to mesh
mesh->addMeshBuffer(buf);
@ -809,7 +781,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
/* Set VBO hint */
// wieldmesh sets its own hint, no need to handle it
if (m_enable_shaders && (m_meshnode || m_animated_meshnode)) {
if (m_meshnode || m_animated_meshnode) {
// sprite uses vertex animation
if (m_meshnode && m_prop.visual != "upright_sprite")
m_meshnode->getMesh()->setHardwareMappingHint(scene::EHM_STATIC);
@ -907,10 +879,7 @@ void GenericCAO::updateLight(u32 day_night_ratio)
// Encode light into color, adding a small boost
// based on the entity glow.
if (m_enable_shaders)
light = encode_light(light_at_pos, m_prop.glow);
else
final_color_blend(&light, light_at_pos, day_night_ratio);
light = encode_light(light_at_pos, m_prop.glow);
if (light != m_last_light) {
m_last_light = light;
@ -926,19 +895,11 @@ void GenericCAO::setNodeLight(const video::SColor &light_color)
return;
}
if (m_enable_shaders) {
{
auto *node = getSceneNode();
if (!node)
return;
setColorParam(node, light_color);
} else {
if (m_meshnode) {
setMeshColor(m_meshnode->getMesh(), light_color);
} else if (m_animated_meshnode) {
setMeshColor(m_animated_meshnode->getMesh(), light_color);
} else if (m_spritenode) {
m_spritenode->setColor(light_color);
}
}
}
@ -1154,11 +1115,10 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
box.MinEdge *= BS;
box.MaxEdge *= BS;
collisionMoveResult moveresult;
f32 pos_max_d = BS*0.125; // Distance per iteration
v3f p_pos = m_position;
v3f p_velocity = m_velocity;
moveresult = collisionMoveSimple(env,env->getGameDef(),
pos_max_d, box, m_prop.stepheight, dtime,
box, m_prop.stepheight, dtime,
&p_pos, &p_velocity, m_acceleration,
this, m_prop.collideWithObjects);
// Apply results

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -131,8 +116,6 @@ private:
// Material
video::E_MATERIAL_TYPE m_material_type;
f32 m_material_type_param;
// Settings
bool m_enable_shaders = false;
bool visualExpiryRequired(const ObjectProperties &newprops) const;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "content_cso.h"
#include <IBillboardSceneNode.h>

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include <cmath>
#include "content_mapblock.h"
@ -82,8 +67,6 @@ MapblockMeshGenerator::MapblockMeshGenerator(MeshMakeData *input, MeshCollector
nodedef(data->nodedef),
meshmanip(mm),
blockpos_nodes(data->m_blockpos * MAP_BLOCKSIZE),
enable_mesh_cache(g_settings->getBool("enable_mesh_cache") &&
!data->m_smooth_lighting), // Mesh cache is not supported with smooth lighting
smooth_liquids(g_settings->getBool("enable_water_reflections"))
{
}
@ -1672,31 +1655,27 @@ void MapblockMeshGenerator::drawMeshNode()
} else if (cur_node.f->param_type_2 == CPT2_WALLMOUNTED ||
cur_node.f->param_type_2 == CPT2_COLORED_WALLMOUNTED) {
// Convert wallmounted to 6dfacedir.
// When cache enabled, it is already converted.
facedir = cur_node.n.getWallMounted(nodedef);
if (!enable_mesh_cache)
facedir = wallmounted_to_facedir[facedir];
facedir = wallmounted_to_facedir[facedir];
} else if (cur_node.f->param_type_2 == CPT2_DEGROTATE ||
cur_node.f->param_type_2 == CPT2_COLORED_DEGROTATE) {
degrotate = cur_node.n.getDegRotate(nodedef);
}
if (!data->m_smooth_lighting && cur_node.f->mesh_ptr[facedir] && !degrotate) {
// use cached meshes
private_mesh = false;
mesh = cur_node.f->mesh_ptr[facedir];
} else if (cur_node.f->mesh_ptr[0]) {
// no cache, clone and rotate mesh
if (cur_node.f->mesh_ptr) {
// clone and rotate mesh
private_mesh = true;
mesh = cloneMesh(cur_node.f->mesh_ptr[0]);
mesh = cloneMesh(cur_node.f->mesh_ptr);
if (facedir)
rotateMeshBy6dFacedir(mesh, facedir);
else if (degrotate)
rotateMeshXZby(mesh, 1.5f * degrotate);
recalculateBoundingBox(mesh);
meshmanip->recalculateNormals(mesh, true, false);
} else
} else {
warningstream << "drawMeshNode(): missing mesh" << std::endl;
return;
}
int mesh_buffer_count = mesh->getMeshBufferCount();
for (int j = 0; j < mesh_buffer_count; j++) {

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -75,9 +60,6 @@ private:
const v3s16 blockpos_nodes;
// options
const bool enable_mesh_cache;
// current node
struct {
v3s16 p;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
#include "filecache.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2014 sapier <sapier at gmx dot net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2014 sapier <sapier at gmx dot net>
#include "fontengine.h"
#include <cmath>
@ -24,8 +9,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "filesys.h"
#include "gettext.h"
#include "settings.h"
#include "irrlicht_changes/CGUITTFont.h"
#include "util/numeric.h" // rangelim
#include <IGUIEnvironment.h>
#include <IGUIFont.h>
/** reference to access font engine, has to be initialized by main */
FontEngine *g_fontengine = nullptr;
@ -33,10 +21,20 @@ FontEngine *g_fontengine = nullptr;
/** callback to be used on change of font size setting */
static void font_setting_changed(const std::string &name, void *userdata)
{
if (g_fontengine)
g_fontengine->readSettings();
static_cast<FontEngine *>(userdata)->readSettings();
}
static const char *settings[] = {
"font_size", "font_bold", "font_italic", "font_size_divisible_by",
"mono_font_size", "mono_font_size_divisible_by",
"font_shadow", "font_shadow_alpha",
"font_path", "font_path_bold", "font_path_italic", "font_path_bold_italic",
"mono_font_path", "mono_font_path_bold", "mono_font_path_italic",
"mono_font_path_bold_italic",
"fallback_font_path",
"dpi_change_notifier", "display_density_factor", "gui_scaling",
};
/******************************************************************************/
FontEngine::FontEngine(gui::IGUIEnvironment* env) :
m_env(env)
@ -51,24 +49,15 @@ FontEngine::FontEngine(gui::IGUIEnvironment* env) :
readSettings();
const char *settings[] = {
"font_size", "font_bold", "font_italic", "font_size_divisible_by",
"mono_font_size", "mono_font_size_divisible_by",
"font_shadow", "font_shadow_alpha",
"font_path", "font_path_bold", "font_path_italic", "font_path_bold_italic",
"mono_font_path", "mono_font_path_bold", "mono_font_path_italic",
"mono_font_path_bold_italic",
"fallback_font_path",
"dpi_change_notifier", "gui_scaling",
};
for (auto name : settings)
g_settings->registerChangedCallback(name, font_setting_changed, NULL);
g_settings->registerChangedCallback(name, font_setting_changed, this);
}
/******************************************************************************/
FontEngine::~FontEngine()
{
g_settings->deregisterAllChangedCallbacks(this);
cleanCache();
}

View file

@ -1,33 +1,22 @@
/*
Minetest
Copyright (C) 2010-2014 sapier <sapier at gmx dot net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2014 sapier <sapier at gmx dot net>
#pragma once
#include <map>
#include "util/basic_macros.h"
#include "irrlichttypes.h"
#include <IGUIFont.h>
#include <IGUISkin.h>
#include <IGUIEnvironment.h>
#include "settings.h"
#include "irrString.h" // utf8_to_wide
#include "threading/mutex_auto_lock.h"
namespace irr {
namespace gui {
class IGUIEnvironment;
class IGUIFont;
}
}
#define FONT_SIZE_UNSPECIFIED 0xFFFFFFFF
enum FontMode : u8 {

View file

@ -1,26 +1,11 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "game.h"
#include <iomanip>
#include <cmath>
#include "IAttributes.h"
#include "client/renderingengine.h"
#include "camera.h"
#include "client.h"
@ -44,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "itemdef.h"
#include "log.h"
#include "log_internal.h"
#include "filesys.h"
#include "gameparams.h"
#include "gettext.h"
#include "gui/guiChatConsole.h"
@ -55,7 +39,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gui/guiVolumeChange.h"
#include "gui/mainmenumanager.h"
#include "gui/profilergraph.h"
#include "mapblock.h"
#include "minimap.h"
#include "nodedef.h" // Needed for determining pointing to nodes
#include "nodemetadata.h"
@ -73,7 +56,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/directiontables.h"
#include "util/pointedthing.h"
#include "util/quicktune_shortcutter.h"
#include "irrlicht_changes/static_text.h"
#include "irr_ptr.h"
#include "version.h"
#include "script/scripting_client.h"
@ -472,8 +454,7 @@ public:
~GameGlobalShaderConstantSetter()
{
for (auto &name : SETTING_CALLBACKS)
g_settings->deregisterChangedCallback(name, settingsCallback, this);
g_settings->deregisterAllChangedCallbacks(this);
}
void onSetConstants(video::IMaterialRendererServices *services) override
@ -947,7 +928,7 @@ private:
SoundMaker *soundmaker = nullptr;
ChatBackend *chat_backend = nullptr;
LogOutputBuffer m_chat_log_buf;
CaptureLogOutput m_chat_log_buf;
EventManager *eventmgr = nullptr;
QuicktuneShortcutter *quicktune = nullptr;
@ -995,6 +976,7 @@ private:
* (as opposed to the this local caching). This can be addressed in
* a later release.
*/
bool m_cache_disable_escape_sequences;
bool m_cache_doubletap_jump;
bool m_cache_enable_clouds;
bool m_cache_enable_joysticks;
@ -1038,6 +1020,10 @@ Game::Game() :
m_chat_log_buf(g_logger),
m_game_ui(new GameUI())
{
g_settings->registerChangedCallback("chat_log_level",
&settingChangedCallback, this);
g_settings->registerChangedCallback("disable_escape_sequences",
&settingChangedCallback, this);
g_settings->registerChangedCallback("doubletap_jump",
&settingChangedCallback, this);
g_settings->registerChangedCallback("enable_clouds",
@ -1106,44 +1092,8 @@ Game::~Game()
clearTextureNameCache();
g_settings->deregisterChangedCallback("doubletap_jump",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_clouds",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_joysticks",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_particles",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_fog",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("mouse_sensitivity",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("joystick_frustum_sensitivity",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("repeat_place_time",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("repeat_dig_time",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("noclip",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("free_move",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("fog_start",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("cinematic",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("cinematic_camera_smoothing",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("camera_smoothing",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("invert_mouse",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("invert_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("pause_on_lost_focus",
&settingChangedCallback, this);
g_settings->deregisterAllChangedCallbacks(this);
if (m_rendering_engine)
m_rendering_engine->finalize();
}
@ -1334,15 +1284,13 @@ void Game::shutdown()
/* cleanup menus */
while (g_menumgr.menuCount() > 0) {
g_menumgr.m_stack.front()->setVisible(false);
g_menumgr.deletingMenu(g_menumgr.m_stack.front());
g_menumgr.deleteFront();
}
m_game_ui->deleteFormspec();
chat_backend->addMessage(L"", L"# Disconnected.");
chat_backend->addMessage(L"", L"");
m_chat_log_buf.clear();
if (client) {
client->Stop();
@ -1633,6 +1581,9 @@ bool Game::createClient(const GameStartData &start_data)
bool Game::shouldShowTouchControls()
{
if (!device->supportsTouchEvents())
return false;
const std::string &touch_controls = g_settings->get("touch_controls");
if (touch_controls == "auto")
return RenderingEngine::getLastPointerType() == PointerType::Touch;
@ -2910,7 +2861,7 @@ static void pauseNodeAnimation(PausedNodesList &paused, scene::ISceneNode *node)
float speed = animated_node->getAnimationSpeed();
if (!speed)
return;
paused.push_back({grab(animated_node), speed});
paused.emplace_back(grab(animated_node), speed);
animated_node->setAnimationSpeed(0.0f);
}
@ -3273,9 +3224,27 @@ void Game::processClientEvents(CameraOrientation *cam)
void Game::updateChat(f32 dtime)
{
auto color_for = [](LogLevel level) -> const char* {
switch (level) {
case LL_ERROR : return "\x1b(c@#F00)"; // red
case LL_WARNING: return "\x1b(c@#EE0)"; // yellow
case LL_INFO : return "\x1b(c@#BBB)"; // grey
case LL_VERBOSE: return "\x1b(c@#888)"; // dark grey
case LL_TRACE : return "\x1b(c@#888)"; // dark grey
default : return "";
}
};
// Get new messages from error log buffer
while (!m_chat_log_buf.empty())
chat_backend->addMessage(L"", utf8_to_wide(m_chat_log_buf.get()));
std::vector<LogEntry> entries = m_chat_log_buf.take();
for (const auto& entry : entries) {
std::string line;
if (!m_cache_disable_escape_sequences) {
line.append(color_for(entry.level));
}
line.append(entry.combined);
chat_backend->addMessage(L"", utf8_to_wide(line));
}
// Get new messages from client
std::wstring message;
@ -3584,7 +3553,7 @@ PointedThing Game::updatePointedThing(
if (show_entity_selectionbox && runData.selected_object->doShowSelectionBox() &&
runData.selected_object->getSelectionBox(&selection_box)) {
v3f pos = runData.selected_object->getPosition();
selectionboxes->push_back(aabb3f(selection_box));
selectionboxes->push_back(selection_box);
hud->setSelectionPos(pos, camera_offset);
GenericCAO* gcao = dynamic_cast<GenericCAO*>(runData.selected_object);
if (gcao != nullptr && gcao->getProperties().rotate_selectionbox)
@ -4498,6 +4467,14 @@ void Game::settingChangedCallback(const std::string &setting_name, void *data)
void Game::readSettings()
{
LogLevel chat_log_level = Logger::stringToLevel(g_settings->get("chat_log_level"));
if (chat_log_level == LL_MAX) {
warningstream << "Supplied unrecognized chat_log_level; showing none." << std::endl;
chat_log_level = LL_NONE;
}
m_chat_log_buf.setLogLevel(chat_log_level);
m_cache_disable_escape_sequences = g_settings->getBool("disable_escape_sequences");
m_cache_doubletap_jump = g_settings->getBool("doubletap_jump");
m_cache_enable_clouds = g_settings->getBool("enable_clouds");
m_cache_enable_joysticks = g_settings->getBool("enable_joysticks");

View file

@ -1,28 +1,14 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
#include "irrlichttypes.h"
#include "config.h"
#include <string>
#ifdef SERVER
#if !IS_CLIENT_BUILD
#error Do not include in server builds
#endif

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2018 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2018 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#include "gameui.h"
#include <irrlicht_changes/static_text.h>

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2018 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2018 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#pragma once

View file

@ -1,20 +1,6 @@
/*
Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
#include "guiscalingfilter.h"
#include "imagefilters.h"

View file

@ -1,20 +1,6 @@
/*
Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
#pragma once

View file

@ -1,23 +1,8 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2010-2013 blue42u, Jonathon Anderson <anderjon@umail.iu.edu>
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2010-2013 blue42u, Jonathon Anderson <anderjon@umail.iu.edu>
// Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
#include "client/hud.h"
#include <string>
@ -61,6 +46,7 @@ Hud::Hud(Client *client, LocalPlayer *player,
readScalingSetting();
g_settings->registerChangedCallback("dpi_change_notifier", setting_changed_callback, this);
g_settings->registerChangedCallback("display_density_factor", setting_changed_callback, this);
g_settings->registerChangedCallback("hud_scaling", setting_changed_callback, this);
for (auto &hbar_color : hbar_colors)
@ -98,15 +84,11 @@ Hud::Hud(Client *client, LocalPlayer *player,
}
// Initialize m_selection_material
if (g_settings->getBool("enable_shaders")) {
IShaderSource *shdrsrc = client->getShaderSource();
IShaderSource *shdrsrc = client->getShaderSource();
{
auto shader_id = shdrsrc->getShader(
m_mode == HIGHLIGHT_HALO ? "selection_shader" : "default_shader", TILE_MATERIAL_ALPHA);
m_selection_material.MaterialType = shdrsrc->getShaderInfo(shader_id).material;
} else {
m_selection_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
if (m_mode == HIGHLIGHT_BOX) {
@ -120,12 +102,9 @@ Hud::Hud(Client *client, LocalPlayer *player,
}
// Initialize m_block_bounds_material
if (g_settings->getBool("enable_shaders")) {
IShaderSource *shdrsrc = client->getShaderSource();
{
auto shader_id = shdrsrc->getShader("default_shader", TILE_MATERIAL_ALPHA);
m_block_bounds_material.MaterialType = shdrsrc->getShaderInfo(shader_id).material;
} else {
m_block_bounds_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
m_block_bounds_material.Thickness =
rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
@ -169,8 +148,7 @@ void Hud::readScalingSetting()
Hud::~Hud()
{
g_settings->deregisterChangedCallback("dpi_change_notifier", setting_changed_callback, this);
g_settings->deregisterChangedCallback("hud_scaling", setting_changed_callback, this);
g_settings->deregisterAllChangedCallbacks(this);
if (m_selection_mesh)
m_selection_mesh->drop();
@ -300,20 +278,20 @@ void Hud::drawItems(v2s32 screen_pos, v2s32 screen_offset, s32 itemcount, v2f al
// Draw items
core::rect<s32> imgrect(0, 0, m_hotbar_imagesize, m_hotbar_imagesize);
const s32 list_size = mainlist ? mainlist->getSize() : 0;
for (s32 i = inv_offset; i < itemcount && i < list_size; i++) {
const s32 list_max = std::min(itemcount, (s32) (mainlist ? mainlist->getSize() : 0 ));
for (s32 i = inv_offset; i < list_max; i++) {
s32 fullimglen = m_hotbar_imagesize + m_padding * 2;
v2s32 steppos;
switch (direction) {
case HUD_DIR_RIGHT_LEFT:
steppos = v2s32(-(m_padding + (i - inv_offset) * fullimglen), m_padding);
steppos = v2s32(m_padding + (list_max - 1 - i - inv_offset) * fullimglen, m_padding);
break;
case HUD_DIR_TOP_BOTTOM:
steppos = v2s32(m_padding, m_padding + (i - inv_offset) * fullimglen);
break;
case HUD_DIR_BOTTOM_TOP:
steppos = v2s32(m_padding, -(m_padding + (i - inv_offset) * fullimglen));
steppos = v2s32(m_padding, m_padding + (list_max - 1 - i - inv_offset) * fullimglen);
break;
default:
steppos = v2s32(m_padding + (i - inv_offset) * fullimglen, m_padding);
@ -816,8 +794,6 @@ void Hud::drawHotbar(const v2s32 &pos, const v2f &offset, u16 dir, const v2f &al
u16 playeritem = player->getWieldIndex();
v2s32 screen_offset(offset.X, offset.Y);
v2s32 centerlowerpos(m_displaycenter.X, m_screensize.Y);
s32 hotbar_itemcount = player->getMaxHotbarItemcount();
s32 width = hotbar_itemcount * (m_hotbar_imagesize + m_padding * 2);
@ -827,15 +803,11 @@ void Hud::drawHotbar(const v2s32 &pos, const v2f &offset, u16 dir, const v2f &al
drawItems(pos, screen_offset, hotbar_itemcount, align, 0,
mainlist, playeritem + 1, dir, true);
} else {
v2s32 firstpos = pos;
firstpos.X += width/4;
v2s32 upper_pos = pos - v2s32(0, m_hotbar_imagesize + m_padding);
v2s32 secondpos = firstpos;
firstpos = firstpos - v2s32(0, m_hotbar_imagesize + m_padding);
drawItems(firstpos, screen_offset, hotbar_itemcount / 2, align, 0,
drawItems(upper_pos, screen_offset, hotbar_itemcount / 2, align, 0,
mainlist, playeritem + 1, dir, true);
drawItems(secondpos, screen_offset, hotbar_itemcount, align,
drawItems(pos, screen_offset, hotbar_itemcount, align,
hotbar_itemcount / 2, mainlist, playeritem + 1, dir, true);
}
}
@ -1192,6 +1164,7 @@ void drawItemStack(
auto &p = imesh->buffer_colors[j];
p.applyOverride(c);
// TODO: could be moved to a shader
if (p.needColorize(c)) {
buf->setDirty(scene::EBT_VERTEX);
if (imesh->needs_shading)

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
Copyright (C) 2017 red-001 <red-001@outlook.ie>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
// Copyright (C) 2017 red-001 <red-001@outlook.ie>
#pragma once

View file

@ -1,20 +1,6 @@
/*
Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
#include "imagefilters.h"
#include "util/numeric.h"

View file

@ -1,20 +1,6 @@
/*
Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2015 Aaron Suen <warr1024@gmail.com>
#pragma once

View file

@ -1,34 +1,19 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "imagesource.h"
#include <IFileSystem.h>
#include "settings.h"
#include "mesh.h"
#include "util/strfnd.h"
#include "renderingengine.h"
#include "util/base64.h"
#include "irrlicht_changes/printing.h"
#include "imagefilters.h"
#include "mesh.h"
#include "renderingengine.h"
#include "settings.h"
#include "texturepaths.h"
#include "irrlicht_changes/printing.h"
#include "util/base64.h"
#include "util/numeric.h"
#include "util/strfnd.h"
////////////////////////////////
@ -1832,6 +1817,12 @@ bool ImageSource::generateImagePart(std::string_view part_of_name,
#undef CHECK_DIM
ImageSource::ImageSource() :
m_setting_mipmap{g_settings->getBool("mip_map")},
m_setting_trilinear_filter{g_settings->getBool("trilinear_filter")},
m_setting_bilinear_filter{g_settings->getBool("bilinear_filter")},
m_setting_anisotropic_filter{g_settings->getBool("anisotropic_filter")}
{}
video::IImage* ImageSource::generateImage(std::string_view name,
std::set<std::string> &source_image_names)

View file

@ -1,27 +1,15 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
#include <IImage.h>
#include <map>
#include <set>
#include <string>
#include "settings.h"
using namespace irr;
// This file is only used for internal generation of images.
// Use texturesource.h to handle textures.
@ -45,6 +33,8 @@ private:
// Generates images using texture modifiers, and caches source images.
struct ImageSource {
ImageSource();
/*! Generates an image from a full string like
* "stone.png^mineral_coal.png^[crack:1:0".
* The returned Image should be dropped.
@ -58,13 +48,6 @@ struct ImageSource {
// TODO should probably be moved elsewhere
static video::SColor getImageAverageColor(const video::IImage &image);
ImageSource() :
m_setting_mipmap{g_settings->getBool("mip_map")},
m_setting_trilinear_filter{g_settings->getBool("trilinear_filter")},
m_setting_bilinear_filter{g_settings->getBool("bilinear_filter")},
m_setting_anisotropic_filter{g_settings->getBool("anisotropic_filter")}
{};
private:
// Generate image based on a string like "stone.png" or "[crack:1:0".

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#include "settings.h"
#include "util/numeric.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2016 est31, <MTest31@outlook.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2016 est31, <MTest31@outlook.com>
#include "joystick_controller.h"
#include "irrlichttypes_extrabloated.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2016 est31, <MTest31@outlook.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2016 est31, <MTest31@outlook.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "keycode.h"
#include "settings.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2016 est31, <MTest31@outlook.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2016 est31, <MTest31@outlook.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "localplayer.h"
#include <cmath>
@ -60,10 +45,7 @@ void PlayerSettings::registerSettingsCallback()
void PlayerSettings::deregisterSettingsCallback()
{
for (auto &name : PlayerSettings_names) {
g_settings->deregisterChangedCallback(name,
&PlayerSettings::settingsChangedCallback, this);
}
g_settings->deregisterAllChangedCallbacks(this);
}
void PlayerSettings::settingsChangedCallback(const std::string &name, void *data)
@ -227,7 +209,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
return true;
}
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
void LocalPlayer::move(f32 dtime, Environment *env,
std::vector<CollisionInfo> *collision_info)
{
// Node at feet position, update each ClientEnvironment::step()
@ -236,7 +218,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
// Temporary option for old move code
if (!physics_override.new_move) {
old_move(dtime, env, pos_max_d, collision_info);
old_move(dtime, env, collision_info);
return;
}
@ -338,17 +320,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
nodemgr->get(node2.getContent()).climbable) && !free_move;
}
/*
Collision uncertainty radius
Make it a bit larger than the maximum distance of movement
*/
//f32 d = pos_max_d * 1.1;
// A fairly large value in here makes moving smoother
f32 d = 0.15f * BS;
// This should always apply, otherwise there are glitches
sanity_check(d > pos_max_d);
// Player object property step height is multiplied by BS in
// /src/script/common/c_content.cpp and /src/content_sao.cpp
float player_stepheight = (m_cao == nullptr) ? 0.0f :
@ -359,7 +330,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
const v3f initial_speed = m_speed;
collisionMoveResult result = collisionMoveSimple(env, m_client,
pos_max_d, m_collisionbox, player_stepheight, dtime,
m_collisionbox, player_stepheight, dtime,
&position, &m_speed, accel_f, m_cao);
bool could_sneak = control.sneak && !free_move && !in_liquid &&
@ -546,12 +517,12 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
m_can_jump = m_can_jump && jumpspeed != 0.0f;
// Autojump
handleAutojump(dtime, env, result, initial_position, initial_speed, pos_max_d);
handleAutojump(dtime, env, result, initial_position, initial_speed);
}
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
void LocalPlayer::move(f32 dtime, Environment *env)
{
move(dtime, env, pos_max_d, NULL);
move(dtime, env, nullptr);
}
void LocalPlayer::applyControl(float dtime, Environment *env)
@ -845,7 +816,7 @@ void LocalPlayer::accelerate(const v3f &target_speed, const f32 max_increase_H,
}
// Temporary option for old move code
void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
void LocalPlayer::old_move(f32 dtime, Environment *env,
std::vector<CollisionInfo> *collision_info)
{
Map *map = &env->getMap();
@ -942,15 +913,6 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
is_climbing = (nodemgr->get(node.getContent()).climbable ||
nodemgr->get(node2.getContent()).climbable) && !free_move;
/*
Collision uncertainty radius
Make it a bit larger than the maximum distance of movement
*/
//f32 d = pos_max_d * 1.1;
// A fairly large value in here makes moving smoother
f32 d = 0.15f * BS;
// This should always apply, otherwise there are glitches
sanity_check(d > pos_max_d);
// Maximum distance over border for sneaking
f32 sneak_max = BS * 0.4f;
@ -989,7 +951,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
const v3f initial_speed = m_speed;
collisionMoveResult result = collisionMoveSimple(env, m_client,
pos_max_d, m_collisionbox, player_stepheight, dtime,
m_collisionbox, player_stepheight, dtime,
&position, &m_speed, accel_f, m_cao);
// Position was slightly changed; update standing node pos
@ -1173,7 +1135,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
}
// Autojump
handleAutojump(dtime, env, result, initial_position, initial_speed, pos_max_d);
handleAutojump(dtime, env, result, initial_position, initial_speed);
}
float LocalPlayer::getSlipFactor(Environment *env, const v3f &speedH)
@ -1196,8 +1158,7 @@ float LocalPlayer::getSlipFactor(Environment *env, const v3f &speedH)
}
void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
const collisionMoveResult &result, const v3f &initial_position,
const v3f &initial_speed, f32 pos_max_d)
const collisionMoveResult &result, v3f initial_position, v3f initial_speed)
{
PlayerSettings &player_settings = getPlayerSettings();
if (!player_settings.autojump)
@ -1214,7 +1175,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
bool horizontal_collision = false;
for (const auto &colinfo : result.collisions) {
if (colinfo.type == COLLISION_NODE && colinfo.plane != 1) {
if (colinfo.type == COLLISION_NODE && colinfo.axis != COLLISION_AXIS_Y) {
horizontal_collision = true;
break; // one is enough
}
@ -1253,7 +1214,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
v3f jump_speed = initial_speed;
// try at peak of jump, zero step height
collisionMoveResult jump_result = collisionMoveSimple(env, m_client, pos_max_d,
collisionMoveResult jump_result = collisionMoveSimple(env, m_client,
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f), m_cao);
// see if we can get a little bit farther horizontally if we had

View file

@ -1,28 +1,12 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
#include "player.h"
#include "environment.h"
#include "constants.h"
#include "settings.h"
#include "lighting.h"
#include <string>
@ -32,6 +16,7 @@ class GenericCAO;
class ClientActiveObject;
class ClientEnvironment;
class IGameDef;
struct CollisionInfo;
struct collisionMoveResult;
enum class LocalPlayerAnimation
@ -84,11 +69,8 @@ public:
f32 gravity = 0; // total downwards acceleration
void move(f32 dtime, Environment *env, f32 pos_max_d);
void move(f32 dtime, Environment *env, f32 pos_max_d,
std::vector<CollisionInfo> *collision_info);
// Temporary option for old move code
void old_move(f32 dtime, Environment *env, f32 pos_max_d,
void move(f32 dtime, Environment *env);
void move(f32 dtime, Environment *env,
std::vector<CollisionInfo> *collision_info);
void applyControl(float dtime, Environment *env);
@ -190,10 +172,11 @@ private:
const f32 max_increase_V, const bool use_pitch);
bool updateSneakNode(Map *map, const v3f &position, const v3f &sneak_max);
float getSlipFactor(Environment *env, const v3f &speedH);
void old_move(f32 dtime, Environment *env,
std::vector<CollisionInfo> *collision_info);
void handleAutojump(f32 dtime, Environment *env,
const collisionMoveResult &result,
const v3f &position_before_move, const v3f &speed_before_move,
f32 pos_max_d);
v3f position_before_move, v3f speed_before_move);
v3f m_position;
v3s16 m_standing_node;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "mapblock_mesh.h"
#include "client.h"
@ -40,10 +25,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
MeshMakeData
*/
MeshMakeData::MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_shaders, bool use_tangent_vertices):
MeshMakeData::MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_tangent_vertices):
side_length(side_length),
nodedef(ndef),
m_use_shaders(use_shaders),
m_use_tangent_vertices(use_tangent_vertices)
{}
@ -283,7 +267,8 @@ u16 getSmoothLightTransparent(const v3s16 &p, const v3s16 &corner, MeshMakeData
return getSmoothLightCombined(p, dirs, data);
}
void get_sunlight_color(video::SColorf *sunlight, u32 daynight_ratio){
void get_sunlight_color(video::SColorf *sunlight, u32 daynight_ratio)
{
f32 rg = daynight_ratio / 1000.0f - 0.04f;
f32 b = (0.98f * daynight_ratio) / 1000.0f + 0.078f;
sunlight->r = rg;
@ -610,14 +595,13 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
m_shdrsrc(client->getShaderSource()),
m_bounding_sphere_center((data->side_length * 0.5f - 0.5f) * BS),
m_animation_force_timer(0), // force initial animation
m_last_crack(-1),
m_last_daynight_ratio((u32) -1)
m_last_crack(-1)
{
ZoneScoped;
for (auto &m : m_mesh)
m = make_irr<scene::SMesh>();
m_enable_shaders = data->m_use_shaders;
m_use_tangent_vertices = data->m_use_tangent_vertices;
auto mesh_grid = client->getMeshGrid();
@ -712,30 +696,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
p.layer.texture = (*p.layer.frames)[0].texture;
}
if (!m_enable_shaders) {
// Extract colors for day-night animation
// Dummy sunlight to handle non-sunlit areas
video::SColorf sunlight;
get_sunlight_color(&sunlight, 0);
std::map<u32, video::SColor> colors;
const u32 vertex_count = p.vertices.size();
for (u32 j = 0; j < vertex_count; j++) {
video::SColor *vc = &p.vertices[j].Color;
video::SColor copy = *vc;
if (vc->getAlpha() == 0) // No sunlight - no need to animate
final_color_blend(vc, copy, sunlight); // Finalize color
else // Record color to animate
colors[j] = copy;
// The sunlight ratio has been stored,
// delete alpha (for the final rendering).
vc->setAlpha(255);
}
if (!colors.empty())
m_daynight_diffs[{layer, i}] = std::move(colors);
}
// Create material
video::SMaterial material;
material.BackfaceCulling = true;
@ -746,12 +706,10 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
tex.MagFilter = video::ETMAGF_NEAREST;
});
if (m_enable_shaders) {
{
material.MaterialType = m_shdrsrc->getShaderInfo(
p.layer.shader_id).material;
p.layer.applyMaterialOptionsWithShaders(material);
} else {
p.layer.applyMaterialOptions(material);
}
if (m_use_tangent_vertices && !p.layer.isTransparent()) {
@ -805,7 +763,6 @@ MapBlockMesh::MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offs
// Check if animation is required for this mesh
m_has_animation =
!m_crack_materials.empty() ||
!m_daynight_diffs.empty() ||
!m_animation_info.empty();
}
@ -878,24 +835,6 @@ bool MapBlockMesh::animate(bool faraway, float time, int crack,
buf->getMaterial().setTexture(0, frame.texture);
}
// Day-night transition
if (!m_enable_shaders && (daynight_ratio != m_last_daynight_ratio)) {
video::SColorf day_color;
get_sunlight_color(&day_color, daynight_ratio);
for (auto &daynight_diff : m_daynight_diffs) {
auto *mesh = m_mesh[daynight_diff.first.first].get();
mesh->setDirty(scene::EBT_VERTEX); // force reload to VBO
scene::IMeshBuffer *buf = mesh->
getMeshBuffer(daynight_diff.first.second);
video::S3DVertex *vertices = (video::S3DVertex *)buf->getVertices();
for (const auto &j : daynight_diff.second)
final_color_blend(&(vertices[j.first].Color), j.second,
day_color);
}
m_last_daynight_ratio = daynight_ratio;
}
return true;
}

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -50,10 +35,10 @@ struct MeshMakeData
u16 side_length;
const NodeDefManager *nodedef;
bool m_use_shaders;
bool m_use_tangent_vertices;
MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_shaders, bool use_tangent_vertices = false);
MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_tangent_vertices = false);
/*
Copy block data manually (to allow optimizations by the caller)
@ -251,7 +236,6 @@ private:
f32 m_bounding_radius;
v3f m_bounding_sphere_center;
bool m_enable_shaders;
bool m_use_tangent_vertices;
// Must animate() be called before rendering?
@ -269,14 +253,6 @@ private:
// Keys are pairs of (mesh index, buffer index in the mesh)
std::map<std::pair<u8, u32>, AnimationInfo> m_animation_info;
// Animation info: day/night transitions
// Last daynight_ratio value passed to animate()
u32 m_last_daynight_ratio;
// For each mesh and mesh buffer, stores pre-baked colors
// of sunlit vertices
// Keys are pairs of (mesh index, buffer index in the mesh)
std::map<std::pair<u8, u32>, std::map<u32, video::SColor > > m_daynight_diffs;
// list of all semitransparent triangles in the mapblock
std::vector<MeshTriangle> m_transparent_triangles;
// Binary Space Partitioning tree for the block

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "mesh.h"
#include "S3DVertex.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013, 2017 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013, 2017 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "mesh_generator_thread.h"
#include "settings.h"
@ -54,8 +39,8 @@ QueuedMeshUpdate::~QueuedMeshUpdate()
MeshUpdateQueue::MeshUpdateQueue(Client *client):
m_client(client)
{
m_cache_enable_shaders = g_settings->getBool("enable_shaders");
m_cache_use_tangent_vertices = m_cache_enable_shaders && g_settings->getBool("enable_bumpmaps");
m_cache_use_tangent_vertices = g_settings->getBool("enable_bumpmaps");
m_cache_smooth_lighting = g_settings->getBool("smooth_lighting");
}
@ -193,7 +178,9 @@ void MeshUpdateQueue::done(v3s16 pos)
void MeshUpdateQueue::fillDataFromMapBlocks(QueuedMeshUpdate *q)
{
auto mesh_grid = m_client->getMeshGrid();
MeshMakeData *data = new MeshMakeData(m_client->ndef(), MAP_BLOCKSIZE * mesh_grid.cell_size, m_cache_enable_shaders, m_cache_use_tangent_vertices);
MeshMakeData *data = new MeshMakeData(m_client->ndef(), MAP_BLOCKSIZE * mesh_grid.cell_size, m_cache_use_tangent_vertices);
q->data = data;
data->fillBlockDataBegin(q->p);

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013, 2017 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013, 2017 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -85,12 +70,10 @@ private:
std::mutex m_mutex;
// TODO: Add callback to update these when g_settings changes
bool m_cache_enable_shaders;
bool m_cache_use_tangent_vertices;
bool m_cache_smooth_lighting;
void fillDataFromMapBlocks(QueuedMeshUpdate *q);
void cleanupCache();
};
struct MeshUpdateResult

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "collector.h"
#include <stdexcept>

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2018 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include <array>

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2015 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2015 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "minimap.h"
#include <cmath>
@ -25,6 +10,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "shader.h"
#include "mapblock.h"
#include "client/renderingengine.h"
#include "client/texturesource.h"
#include "gettext.h"
////
@ -187,7 +173,6 @@ Minimap::Minimap(Client *client)
m_current_mode_index = 0;
// Initialize static settings
m_enable_shaders = g_settings->getBool("enable_shaders");
m_surface_mode_scan_height =
g_settings->getBool("minimap_double_scan_height") ? 256 : 128;
@ -489,17 +474,15 @@ video::ITexture *Minimap::getMinimapTexture()
blitMinimapPixelsToImageRadar(map_image);
break;
case MINIMAP_TYPE_TEXTURE:
// Want to use texture source, to : 1 find texture, 2 cache it
// FIXME: this is a pointless roundtrip through the gpu
video::ITexture* texture = m_tsrc->getTexture(data->mode.texture);
video::IImage* image = driver->createImageFromData(
texture->getColorFormat(), texture->getSize(),
texture->lock(video::ETLM_READ_ONLY), true, false);
texture->unlock();
texture->getColorFormat(), texture->getSize(),
texture->lock(video::ETLM_READ_ONLY), true, false);
auto dim = image->getDimension();
map_image->fill(video::SColor(255, 0, 0, 0));
image->copyTo(map_image,
irr::core::vector2d<int> {
((data->mode.map_size - (static_cast<int>(dim.Width))) >> 1)
@ -507,7 +490,9 @@ video::ITexture *Minimap::getMinimapTexture()
((data->mode.map_size - (static_cast<int>(dim.Height))) >> 1)
+ data->pos.Z / data->mode.scale
});
image->drop();
texture->unlock();
}
map_image->copyToScaling(minimap_image);
@ -613,7 +598,7 @@ void Minimap::drawMinimap(core::rect<s32> rect)
material.TextureLayers[0].Texture = minimap_texture;
material.TextureLayers[1].Texture = data->heightmap_texture;
if (m_enable_shaders && data->mode.type == MINIMAP_TYPE_SURFACE) {
if (data->mode.type == MINIMAP_TYPE_SURFACE) {
auto sid = m_shdrsrc->getShader("minimap_shader", TILE_MATERIAL_ALPHA);
material.MaterialType = m_shdrsrc->getShaderInfo(sid).material;
} else {

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2010-2015 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2015 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once
@ -167,7 +152,6 @@ private:
const NodeDefManager *m_ndef;
std::unique_ptr<MinimapUpdateThread> m_minimap_update_thread;
irr_ptr<scene::SMeshBuffer> m_meshbuffer;
bool m_enable_shaders;
std::vector<MinimapModeDef> m_modes;
size_t m_current_mode_index;
u16 m_surface_mode_scan_height;

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "particles.h"
#include <cmath>
@ -25,6 +10,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/content_cao.h"
#include "client/clientevent.h"
#include "client/renderingengine.h"
#include "client/texturesource.h"
#include "util/numeric.h"
#include "light.h"
#include "localplayer.h"
@ -103,7 +89,7 @@ void Particle::step(float dtime, ClientEnvironment *env)
aabb3f box(v3f(-m_p.size / 2.0f), v3f(m_p.size / 2.0f));
v3f p_pos = m_pos * BS;
v3f p_velocity = m_velocity * BS;
collisionMoveResult r = collisionMoveSimple(env, env->getGameDef(), BS * 0.5f,
collisionMoveResult r = collisionMoveSimple(env, env->getGameDef(),
box, 0.0f, dtime, &p_pos, &p_velocity, m_acceleration * BS, nullptr,
m_p.object_collision);

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#pragma once

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "anaglyph.h"
#include "client/camera.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "stereo.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "core.h"
#include "plain.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "irrlichttypes_extrabloated.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "factory.h"
#include "log.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "interlaced.h"
#include "secondstage.h"
@ -39,7 +24,7 @@ void InitInterlacedMaskStep::run(PipelineContext &context)
last_mask = mask;
auto size = mask->getSize();
u8 *data = reinterpret_cast<u8 *>(mask->lock());
u8 *data = reinterpret_cast<u8 *>(mask->lock(video::ETLM_WRITE_ONLY));
for (u32 j = 0; j < size.Height; j++) {
u8 val = j % 2 ? 0xff : 0x00;
memset(data, val, 4 * size.Width);
@ -50,6 +35,13 @@ void InitInterlacedMaskStep::run(PipelineContext &context)
void populateInterlacedPipeline(RenderPipeline *pipeline, Client *client)
{
// FIXME: "3d_mode = interlaced" is currently broken. Two options:
// 1. Remove it
// 2. Fix it
// If you fix it, make sure to test it with "enable_post_processing = false".
// You'll probably have to add a depth texture to make that combination work.
// Also, this code should probably use selectColorFormat/selectDepthFormat.
static const u8 TEXTURE_LEFT = 0;
static const u8 TEXTURE_RIGHT = 1;
static const u8 TEXTURE_MASK = 2;
@ -82,4 +74,4 @@ void populateInterlacedPipeline(RenderPipeline *pipeline, Client *client)
merge->setRenderSource(buffer);
merge->setRenderTarget(pipeline->createOwned<ScreenTarget>());
pipeline->addStep<DrawHUD>();
}
}

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "stereo.h"

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 x2048, Dmitry Kostenko <codeforsmile@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 x2048, Dmitry Kostenko <codeforsmile@gmail.com>
#include "pipeline.h"
#include "client/client.h"
@ -191,13 +176,6 @@ void TextureBufferOutput::activate(PipelineContext &context)
size = texture->getSize();
}
// Use legacy call when there's single texture without depth texture
// This binds default depth buffer to the FBO
if (textures.size() == 1 && depth_stencil == NO_DEPTH_TEXTURE) {
driver->setRenderTarget(textures[0], m_clear, m_clear, context.clear_color);
return;
}
video::ITexture *depth_texture = nullptr;
if (depth_stencil != NO_DEPTH_TEXTURE)
depth_texture = buffer->getTexture(depth_stencil);
@ -225,7 +203,7 @@ video::ITexture *DynamicSource::getTexture(u8 index)
void ScreenTarget::activate(PipelineContext &context)
{
auto driver = context.device->getVideoDriver();
driver->setRenderTarget(nullptr, m_clear, m_clear, context.clear_color);
driver->setRenderTargetEx(nullptr, m_clear ? video::ECBF_ALL : video::ECBF_NONE, context.clear_color);
driver->OnResize(size);
RenderTarget::activate(context);
}

View file

@ -1,21 +1,6 @@
/*
Minetest
Copyright (C) 2022 x2048, Dmitry Kostenko <codeforsmile@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 x2048, Dmitry Kostenko <codeforsmile@gmail.com>
#pragma once
#include "irrlichttypes_extrabloated.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "plain.h"
#include "secondstage.h"
@ -102,7 +87,7 @@ void UpscaleStep::run(PipelineContext &context)
std::unique_ptr<RenderStep> create3DStage(Client *client, v2f scale)
{
RenderStep *step = new Draw3D();
if (g_settings->getBool("enable_shaders") && g_settings->getBool("enable_post_processing")) {
if (g_settings->getBool("enable_post_processing")) {
RenderPipeline *pipeline = new RenderPipeline();
pipeline->addStep(pipeline->own(std::unique_ptr<RenderStep>(step)));
@ -119,24 +104,30 @@ static v2f getDownscaleFactor()
return v2f(1.0f / undersampling);
}
RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f downscale_factor)
RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f downscale_factor, Client *client)
{
const int TEXTURE_UPSCALE = 0;
const int TEXTURE_LOWRES_COLOR = 0;
const int TEXTURE_LOWRES_DEPTH = 1;
if (downscale_factor.X == 1.0f && downscale_factor.Y == 1.0f)
return previousStep;
// When shaders are enabled, post-processing pipeline takes care of rescaling
if (g_settings->getBool("enable_shaders") && g_settings->getBool("enable_post_processing"))
// post-processing pipeline takes care of rescaling
if (g_settings->getBool("enable_post_processing"))
return previousStep;
auto driver = client->getSceneManager()->getVideoDriver();
video::ECOLOR_FORMAT color_format = selectColorFormat(driver);
video::ECOLOR_FORMAT depth_format = selectDepthFormat(driver);
// Initialize buffer
TextureBuffer *buffer = pipeline->createOwned<TextureBuffer>();
buffer->setTexture(TEXTURE_UPSCALE, downscale_factor, "upscale", video::ECF_A8R8G8B8);
buffer->setTexture(TEXTURE_LOWRES_COLOR, downscale_factor, "lowres_color", color_format);
buffer->setTexture(TEXTURE_LOWRES_DEPTH, downscale_factor, "lowres_depth", depth_format);
// Attach previous step to the buffer
TextureBufferOutput *buffer_output = pipeline->createOwned<TextureBufferOutput>(buffer, TEXTURE_UPSCALE);
TextureBufferOutput *buffer_output = pipeline->createOwned<TextureBufferOutput>(
buffer, std::vector<u8> {TEXTURE_LOWRES_COLOR}, TEXTURE_LOWRES_DEPTH);
previousStep->setRenderTarget(buffer_output);
// Add upscaling step
@ -155,9 +146,25 @@ void populatePlainPipeline(RenderPipeline *pipeline, Client *client)
pipeline->addStep<DrawWield>();
pipeline->addStep<MapPostFxStep>();
step3D = addUpscaling(pipeline, step3D, downscale_factor);
step3D = addUpscaling(pipeline, step3D, downscale_factor, client);
step3D->setRenderTarget(pipeline->createOwned<ScreenTarget>());
pipeline->addStep<DrawHUD>();
}
video::ECOLOR_FORMAT selectColorFormat(video::IVideoDriver *driver)
{
if (driver->queryTextureFormat(video::ECF_A16B16G16R16F))
return video::ECF_A16B16G16R16F;
return video::ECF_A8R8G8B8;
}
video::ECOLOR_FORMAT selectDepthFormat(video::IVideoDriver *driver)
{
if (driver->queryTextureFormat(video::ECF_D24))
return video::ECF_D24;
if (driver->queryTextureFormat(video::ECF_D24S8))
return video::ECF_D24S8;
return video::ECF_D16; // fallback depth format
}

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "core.h"
@ -97,6 +82,9 @@ private:
};
std::unique_ptr<RenderStep> create3DStage(Client *client, v2f scale);
RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f downscale_factor);
RenderStep* addUpscaling(RenderPipeline *pipeline, RenderStep *previousStep, v2f downscale_factor, Client *client);
void populatePlainPipeline(RenderPipeline *pipeline, Client *client);
video::ECOLOR_FORMAT selectColorFormat(video::IVideoDriver *driver);
video::ECOLOR_FORMAT selectDepthFormat(video::IVideoDriver *driver);

View file

@ -1,23 +1,8 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
Copyright (C) 2020 appgurueu, Lars Mueller <appgurulars@gmx.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
// Copyright (C) 2020 appgurueu, Lars Mueller <appgurulars@gmx.de>
#include "secondstage.h"
#include "client/client.h"
@ -102,16 +87,12 @@ RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep
auto driver = client->getSceneManager()->getVideoDriver();
// configure texture formats
video::ECOLOR_FORMAT color_format = video::ECF_A8R8G8B8;
if (driver->queryTextureFormat(video::ECF_A16B16G16R16F))
color_format = video::ECF_A16B16G16R16F;
video::ECOLOR_FORMAT depth_format = video::ECF_D16; // fallback depth format
if (driver->queryTextureFormat(video::ECF_D32))
depth_format = video::ECF_D32;
else if (driver->queryTextureFormat(video::ECF_D24S8))
depth_format = video::ECF_D24S8;
video::ECOLOR_FORMAT color_format = selectColorFormat(driver);
video::ECOLOR_FORMAT depth_format = selectDepthFormat(driver);
verbosestream << "addPostProcessing(): color = "
<< video::ColorFormatNames[color_format] << " depth = "
<< video::ColorFormatNames[depth_format] << std::endl;
// init post-processing buffer
static const u8 TEXTURE_COLOR = 0;

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "stereo.h"

View file

@ -1,24 +1,10 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "sidebyside.h"
#include "client/client.h"
#include "client/hud.h"
#include "client/camera.h"
@ -50,6 +36,11 @@ void populateSideBySidePipeline(RenderPipeline *pipeline, Client *client, bool h
{
static const u8 TEXTURE_LEFT = 0;
static const u8 TEXTURE_RIGHT = 1;
static const u8 TEXTURE_DEPTH = 2;
auto driver = client->getSceneManager()->getVideoDriver();
video::ECOLOR_FORMAT color_format = selectColorFormat(driver);
video::ECOLOR_FORMAT depth_format = selectDepthFormat(driver);
v2f offset;
if (horizontal) {
@ -62,15 +53,17 @@ void populateSideBySidePipeline(RenderPipeline *pipeline, Client *client, bool h
}
TextureBuffer *buffer = pipeline->createOwned<TextureBuffer>();
buffer->setTexture(TEXTURE_LEFT, virtual_size_scale, "3d_render_left", video::ECF_A8R8G8B8);
buffer->setTexture(TEXTURE_RIGHT, virtual_size_scale, "3d_render_right", video::ECF_A8R8G8B8);
buffer->setTexture(TEXTURE_LEFT, virtual_size_scale, "3d_render_left", color_format);
buffer->setTexture(TEXTURE_RIGHT, virtual_size_scale, "3d_render_right", color_format);
buffer->setTexture(TEXTURE_DEPTH, virtual_size_scale, "3d_depthmap_sidebyside", depth_format);
auto step3D = pipeline->own(create3DStage(client, virtual_size_scale));
// eyes
for (bool right : { false, true }) {
pipeline->addStep<OffsetCameraStep>(flipped ? !right : right);
auto output = pipeline->createOwned<TextureBufferOutput>(buffer, right ? TEXTURE_RIGHT : TEXTURE_LEFT);
auto output = pipeline->createOwned<TextureBufferOutput>(
buffer, std::vector<u8> {right ? TEXTURE_RIGHT : TEXTURE_LEFT}, TEXTURE_DEPTH);
pipeline->addStep<SetRenderTargetStep>(step3D, output);
pipeline->addStep(step3D);
pipeline->addStep<DrawWield>();

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "stereo.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#include "stereo.h"
#include "client/client.h"

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 numzero, Lobachevskiy Vitaliy <numzer0@yandex.ru>
#pragma once
#include "core.h"

View file

@ -1,25 +1,11 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#include <optional>
#include <irrlicht.h>
#include "IMeshCache.h"
#include "fontengine.h"
#include "client.h"
#include "clouds.h"
@ -27,14 +13,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiscalingfilter.h"
#include "localplayer.h"
#include "client/hud.h"
#include "client/texturesource.h"
#include "camera.h"
#include "minimap.h"
#include "clientmap.h"
#include "renderingengine.h"
#include "render/core.h"
#include "render/factory.h"
#include "inputhandler.h"
#include "gettext.h"
#include "filesys.h"
#include "irrlicht_changes/static_text.h"
#include "irr_ptr.h"
@ -237,8 +222,7 @@ RenderingEngine::~RenderingEngine()
{
sanity_check(s_singleton == this);
g_settings->deregisterChangedCallback("fullscreen", settingChangedCallback, this);
g_settings->deregisterChangedCallback("window_maximized", settingChangedCallback, this);
g_settings->deregisterAllChangedCallbacks(this);
core.reset();
m_device->closeDevice();

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
#pragma once
@ -26,13 +11,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/inputhandler.h"
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
#include "config.h"
#include "client/shader.h"
#include "client/render/core.h"
// include the shadow mapper classes too
#include "client/shadows/dynamicshadowsrender.h"
#include <IVideoDriver.h>
#ifdef SERVER
#if !IS_CLIENT_BUILD
#error Do not include in server builds
#endif

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Kahrl <kahrl@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2013 Kahrl <kahrl@gmx.net>
#include <fstream>
#include <iterator>
@ -322,9 +307,6 @@ public:
private:
// Are shaders even enabled?
bool m_enabled;
// The id of the thread that is allowed to use irrlicht directly
std::thread::id m_main_thread;
@ -363,12 +345,6 @@ ShaderSource::ShaderSource()
// Add a dummy ShaderInfo as the first index, named ""
m_shaderinfo_cache.emplace_back();
m_enabled = g_settings->getBool("enable_shaders");
if (!m_enabled) {
warningstream << "You are running " PROJECT_NAME_C " with shaders disabled, "
"this is not a recommended configuration." << std::endl;
}
// Add main global constant setter
addShaderConstantSetterFactory(new MainShaderConstantSetterFactory());
}
@ -377,11 +353,9 @@ ShaderSource::~ShaderSource()
{
MutexAutoLock lock(m_shaderinfo_cache_mutex);
if (!m_enabled)
return;
// Delete materials
auto *gpu = RenderingEngine::get_video_driver()->getGPUProgrammingServices();
assert(gpu);
for (ShaderInfo &i : m_shaderinfo_cache) {
if (!i.name.empty())
gpu->deleteShaderMaterial(i.material);
@ -510,11 +484,9 @@ void ShaderSource::rebuildShaders()
{
MutexAutoLock lock(m_shaderinfo_cache_mutex);
if (!m_enabled)
return;
// Delete materials
auto *gpu = RenderingEngine::get_video_driver()->getGPUProgrammingServices();
assert(gpu);
for (ShaderInfo &i : m_shaderinfo_cache) {
if (!i.name.empty()) {
gpu->deleteShaderMaterial(i.material);
@ -561,14 +533,14 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
}
shaderinfo.material = shaderinfo.base_material;
if (!m_enabled)
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
// The null driver doesn't support shaders (duh), but we can pretend it does.
if (driver->getDriverType() == video::EDT_NULL)
return shaderinfo;
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
auto *gpu = driver->getGPUProgrammingServices();
if (!driver->queryFeature(video::EVDF_ARB_GLSL) || !gpu) {
throw ShaderException(gettext("Shaders are enabled but GLSL is not "
"supported by the driver."));
throw ShaderException(gettext("GLSL is not supported by the driver"));
}
// Create shaders header
@ -764,19 +736,18 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
shaders_header << "#define VOLUMETRIC_DEPTH_ATTENUATION 1\n";
}
shaders_header << "#line 0\n"; // reset the line counter for meaningful diagnostics
std::string common_header = shaders_header.str();
const char *final_header = "#line 0\n"; // reset the line counter for meaningful diagnostics
std::string vertex_shader = m_sourcecache.getOrLoad(name, "opengl_vertex.glsl");
std::string fragment_shader = m_sourcecache.getOrLoad(name, "opengl_fragment.glsl");
std::string geometry_shader = m_sourcecache.getOrLoad(name, "opengl_geometry.glsl");
vertex_shader = common_header + vertex_header + vertex_shader;
fragment_shader = common_header + fragment_header + fragment_shader;
vertex_shader = common_header + vertex_header + final_header + vertex_shader;
fragment_shader = common_header + fragment_header + final_header + fragment_shader;
const char *geometry_shader_ptr = nullptr; // optional
if (!geometry_shader.empty()) {
geometry_shader = common_header + geometry_header + geometry_shader;
geometry_shader = common_header + geometry_header + final_header + geometry_shader;
geometry_shader_ptr = geometry_shader.c_str();
}

View file

@ -1,22 +1,7 @@
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Kahrl <kahrl@gmx.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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.
*/
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
// Copyright (C) 2013 Kahrl <kahrl@gmx.net>
#pragma once

Some files were not shown because too many files have changed in this diff Show more