Commit Graph

7405 Commits

Author SHA1 Message Date
HybridDog
cda112493a
Faster blit_with_alpha() (#14448)
* Add test nodes for alpha compositing and the fill texture modifier

Texture test nodes can be helpful to test if `blit_with_alpha` works correctly.

The alpha compositing test node covers different cases where pixel colors are mixed with each other.
The test currently fails because `blitPixel` does not work correctly if a semi-transparent color
is drawn on top of another semi-transparent color.
The test nodes for the fill texture modifier show if the size and position arguments of the modifier work correctly.
They do not cover special cases such as very large or negative position or size values.

* Faster blit_with_alpha()

The `blit_with_alpha` function has a noticeable effect on the time it takes to join a game.

To reduce the join times, I replace the `blit_with_alpha` function with a new one:
* It does not uses floating-point numbers.
* It directly operates on the raw pixel data instead of using the comparatively
  slow `setPixel` and `getPixel` functions from Irrlicht.
  Only ECF_A8R8G8B8 base images are supported now.
  If the top image does not have the ECF_A8R8G8B8 color format, it is converted;
  I assume that this happens rarely.
* There are case distinctions for fully opaque, fully transparent and semi-transparent pixels.
  This empirically increases the performance since the mixing between two semi-transparent happens rarely.
* The new function no longer has the `src_pos` argument since it was always the zero vector.
* The function is only documented once where it is declared.

For backwards compatibility, `blit_with_alpha` still mixes colors without gamma correction.
`blit_with_alpha` nonetheless behaves slightly different than before:
If a semi-transparent pixel is drawn on top of another semi-transparent pixel,
the color is mixed in a way which we can consider to be more correct now.
2024-03-19 19:56:47 +01:00
SmallJoker
a862e4290c Script API: Fix invalid rotation of L-system trees
The MapNode struct fields param1 and param2 were previously
not initialized. This commit now sets them to a sane default.
2024-03-17 18:01:48 +01:00
cx384
234b01a8c2
Item meta pointing range (#14347) 2024-03-17 15:55:38 +01:00
sfan5
e3b9828f24 Add unit tests for SAO load / unload behaviour 2024-03-17 15:55:24 +01:00
sfan5
8339594206 Handle static_save changes at runtime and between restarts 2024-03-17 15:55:24 +01:00
sfan5
2386bfda7e Fix static_save=false not working & related cleanups 2024-03-17 15:55:24 +01:00
sfan5
ef0009aea7 Sort out server destruction order
fixes #14421
2024-03-17 15:55:24 +01:00
Gregor Parzefall
4f84b01356 Touchscreen: Fix virtual joystick sometimes going backwards
This fixes a regression introduced by 34286d77c7ee65be480a372233c5ab7c4b81d9db / #14075.
2024-03-17 15:00:37 +01:00
grorp
c8b615acc9
Remove excessive touchscreengui.h includes (#14466) 2024-03-17 14:59:50 +01:00
SmallJoker
61a5733692 Unittest: Add inventory callback tests 2024-03-16 20:14:05 +01:00
SmallJoker
4245a7604b Inventory: Fix order of callbacks when swapping items 2024-03-16 20:14:05 +01:00
sfan5
d5d6e36ae0
Create CACHEDIR.TAG in path_cache (#14458) 2024-03-15 11:24:08 +01:00
sfan5
658bc9fcc8 Fix infinite loop in Server::stopAttachedSounds 2024-03-13 21:24:50 +01:00
cx384
60810c2d37
Add L-system trees as decorations (#14355) 2024-03-12 20:10:28 +01:00
grorp
f07e1026ac
Allow sync HTTP fetches to be interrupted to fix hanging (#14412)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2024-03-12 20:09:43 +01:00
SmallJoker
32f68f35cf
Avoid packets getting sent to disconnected players (#14444)
Many functions expect RemotePlayer to have a valid peer ID,
this however is not the case immediately after disconnecting
where the object is still alive and pending for removal.

ServerEnvironment::getPlayer(const char *, bool) now only
returns players that are connected unless forced to.
2024-03-10 13:24:35 +01:00
SmallJoker
02a893d613 Client: fix failing assert on empty texture name 2024-03-10 10:50:04 +01:00
sfan5
d88f0866b7 Reduce translations log spam 2024-03-06 22:33:32 +01:00
Lars Müller
bf52d1e624
Fix attached sounds stopping if objects are removed serverside (#14436)
Restores backwards compatibility for death sounds or other sounds that are not supposed to be "cut off" abruptly.

---------

Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: grorp <gregor.parzefall@posteo.de>
2024-03-06 20:36:02 +01:00
y5nw
fc80f65a6d
Try to preserve metatable when exchanging data with the async env (#14369)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
2024-03-06 18:04:49 +01:00
sfan5
badd42789a Move PlayerSettings class to client code 2024-03-06 18:03:57 +01:00
sfan5
c524c52baa Fix some common SAO methods to not generate useless update packets 2024-03-06 18:03:57 +01:00
sfan5
585ca90ae0 Reorder ObjectProperties struct 2024-03-06 18:03:57 +01:00
sfan5
e734b3f0d8 Fix core.get_node_or_nil in emerge env
"ignore" does not mean unloaded, we have to properly check it.
2024-03-03 20:16:32 +01:00
sfan5
9b97147637 Fix assertion failure in clientlauncher.cpp 2024-03-03 19:11:37 +01:00
DS
d4d4712361
Implement get_node with a get_node_raw (#14384)
Add /bench_bulk_get_node
Considerably improves the execution speed of core.get_node
2024-03-03 15:53:23 +01:00
cx384
879f7e9f03 Refactor tile.cpp/h parts except texturesource.cpp 2024-03-03 15:52:05 +01:00
cx384
aaf77025b6 Split up tile.cpp/h 2024-03-03 15:52:05 +01:00
Desour
cdce33dd05 Fix some narrowing warnings 2024-03-02 01:56:25 +01:00
Desour
b10797b3d5 Add missing include in container.h
BUILD_BENCHMAKRS builds were broken.
2024-03-02 01:47:03 +01:00
sfan5
e73e562a63 Allow curl to use all content encodings 2024-03-01 18:22:59 +01:00
grorp
e40417f687
Allow giving "pointabilities" to Lua raycasts (#14390) 2024-03-01 17:12:13 +01:00
Gregor Parzefall
aac616fcc5 Avoid visible camera jumps because of touchscreen_threshold 2024-03-01 17:11:46 +01:00
Gregor Parzefall
fa0745f7da Adjust touchscreen_sensitivity to display density 2024-03-01 17:11:46 +01:00
Gregor Parzefall
00a3e6bbd7 Touchscreen: Allow camera movement while digging without touch_use_crosshair 2024-03-01 17:11:46 +01:00
sfan5
bb7f57b095 VBO-related optimizations and improvements (#14395) 2024-02-29 17:20:57 +01:00
sfan5
d85c842ce9 Refactor fog shader to reuse Irrlicht values 2024-02-29 17:20:50 +01:00
sfan5
dce166dc93 Support deleting shader materials 2024-02-29 17:20:50 +01:00
sfan5
13a0e5fb4a Share FpsControl code between game and menu 2024-02-29 17:20:50 +01:00
sfan5
0c3a4cc7b9 Improve ergonomics of CachedShaderSetting 2024-02-29 17:20:49 +01:00
sfan5
e9ab5bc223 Factor shadow constants out of MainShaderConstantSetter 2024-02-29 17:20:49 +01:00
sfan5
5da18d34ba Properly warn that shader queue is unimplemented 2024-02-29 17:20:49 +01:00
sfan5
09d542dfe0 Drop enable_vbo setting
Consistently applying this setting requires some code work,
because Irrlicht does not provide a global toggle.
At the same time I don't see any reason for someone to disable this.
2024-02-29 17:20:49 +01:00
sfan5
5280863300 Set VBO hints in more places 2024-02-29 17:20:49 +01:00
sfan5
fbec378869 Fix more type promotion mistakes
Someone of these are probably actual bugs and gcc totally doesn't care to warn about them, wtf?
This issue seems to be new with the IrrlichtMt update.
2024-02-26 22:07:40 +01:00
sfan5
9fcd7f2dc0 Fix clang-tidy type promotion errors 2024-02-26 20:47:47 +01:00
sfan5
5d8a22066c
Change how max_lag is calculated and reported (#14378)
-Change how max_lag is calculated and reported

- Cap singleplayer step at 60Hz

- Clarify dedicated_server_step
2024-02-26 20:46:57 +01:00
sfence
63a9853811
Remove attached sounds when the active object is removed (#14341) 2024-02-25 22:10:39 +00:00
rubenwardy
f4eba3bfba
Add support for ContentDB package translation (#14410) 2024-02-25 22:09:52 +00:00
sfan5
762fca538c
Expose SHA256 algorithm to Lua (#14403)
Co-authored-by: chmodsayshello <chmodsayshello@hotmail.com>
2024-02-25 18:12:23 +01:00
SmallJoker
fa1d80b53b
MetaData: restore undocumented set_string behaviour (#14396) 2024-02-25 16:03:05 +01:00
rubenwardy
b4be483d3e
Add support for translating content titles and descriptions (#12208) 2024-02-24 19:13:07 +00:00
grorp
57de599a29
Restore pre-5.9.0-dev behavior of touch_use_crosshair=false shootline (#14389)
* Fix incorrect shootline after releasing pointer if touch_use_crosshair=false

This happened because Android reuses pointer IDs.
Also includes a refactor to merge "m_known_ids" and "m_pointer_pos".

* Restore pre-5.9.0-dev behavior of shootline when !m_has_move_id
2024-02-24 13:12:53 +01:00
sfan5
492aab20fe Fix compiler warnings 2024-02-24 12:39:12 +01:00
lhofhansl
0d4b489545
Detect air-only blocks instead of day/night differences (#14264)
* Detect air-only blocks instead day/night differences

* Write !is_air into the former day-night-diff bit on disk, so that old server can still read maps written by new servers

* Only set is_air bit when reading from disk
2024-02-22 21:47:42 -08:00
numzero
0d30a3071a Add meshgen tests 2024-02-22 15:45:17 +00:00
numzero
753f03ff6a Add mesh comparison functions, for tests 2024-02-22 15:45:17 +00:00
numzero
bf2098c07f Decouple MeshMakeData from Client 2024-02-22 15:45:17 +00:00
numzero
2f35b121a4 Const correctness 2024-02-22 15:45:17 +00:00
David Heidelberg
34286d77c7
Allow toggling touchscreen mode at runtime (#14075)
Signed-off-by: David Heidelberg <david@ixit.cz>
Co-authored-by: Gregor Parzefall <gregor.parzefall@posteo.de>
2024-02-22 15:44:49 +00:00
sfan5
e3cc26cb7c
Irrlicht support changes (#14383) 2024-02-19 21:14:47 +01:00
Lars Müller
4acbd59162
Support absent scene node names (#14330)
Contains a hack to support IrrlichtMT revision 14 for now (until we release revision 15)
2024-02-18 11:39:16 +01:00
DS
1e316a9704
Don't use a reference for RaycastState::m_pointabilities (#14376) 2024-02-17 18:36:20 +01:00
sfan5
6ca214fefc
Introduce std::string_view into wider use (#14368) 2024-02-17 15:35:33 +01:00
sfan5
f483d10c95
Switch to LLVM-based MinGW toolchain (#14329) 2024-02-16 21:36:19 +01:00
sfan5
933432e62d Annotate Lua packer with more comments 2024-02-16 12:34:40 +01:00
sfan5
2b97fead9e Fix some potential iterator invalidation issues 2024-02-16 12:34:40 +01:00
cx384
9ac6d330b4
Fix minimap textures overwrite (#14349) 2024-02-15 21:52:41 +01:00
DS
4843890c56
Inline g/setPixel in imageCleanTransparent (#14323) 2024-02-15 19:38:23 +01:00
lhofhansl
c81e0b7433
Allow shaders with disabled post processing pipeline (#14338)
- Allow disabling of the post processing pipeline while leaving shaders enabled
- Also disable post processing on Android by default
2024-02-15 08:25:33 -08:00
sfan5
ce97210eb1 Refactor how script api reads current mod name
This is to prevent future mistakes and make it clearer whether
the mod name can be trusted depending on how it is retrieved.
2024-02-15 11:06:21 +01:00
sfan5
cb5fa56e17 Remove insecure environment from async and emerge environment 2024-02-15 11:06:21 +01:00
fuzun
6cbb9193ea
Fix undefined behaviors (#14365)
* Initialize member `floats` in ContentFeatures

* Do not assign big double to u32

* Do not assign negative floating point number to unsigned integer
2024-02-15 11:05:42 +01:00
sfan5
3cac17d23e
Lua on each mapgen thread (#13092) 2024-02-13 22:47:30 +01:00
sfan5
d4b107e2e8 Enable dynamic_add_media to take the file data instead of a path 2024-02-13 22:44:10 +01:00
sfan5
c90ebad46b Allow specifying name for dynamic media files 2024-02-13 22:44:10 +01:00
sfan5
af69d4f7a9 Allow dynamic_add_media at mod load time 2024-02-13 22:44:10 +01:00
cx384
7901087466
Rename MINETEST_SUBGAME_PATH to MINETEST_GAME_PATH (#14351) 2024-02-12 23:21:19 +01:00
paradust7
e2ccd14c05
Allow using VBOs for meshes all the way down to 4 vertices (#14366)
This may improve performance substantially if there are many meshes with "few" vertices that would otherwise be retransmitted to the GPU every frame. In testing, this does not seem to decrease performance, even if as few as 4 vertices are used (e.g. particles).
2024-02-12 23:20:48 +01:00
Lars Mueller
a14320fc44 Improve deprecation error messages 2024-02-12 22:58:26 +01:00
David Heidelberg
eb52a149a0
Enable IPO/LTO by default except for debug builds (#14198)
Test case:

```
$ cmake . -DRUN_IN_PLACE=TRUE -DCMAKE_BUILD_TYPE=Release -DBUILD_SERVER=TRUE -DENABLE_TOUCH=FALSE

         minetest minetestserver
W/o LTO:      13M           7.3M
W/  LTO:      11M           5.9M
difference:   15%            19%
```

Also fixes various compiler warnings resulting from compilation using LTO.

---------

Signed-off-by: David Heidelberg <david@ixit.cz>
2024-02-09 00:01:12 +01:00
cx384
adaa4cc2f3
Move hard coded minimap to builtin (#14071) 2024-02-07 20:13:23 +01:00
grorp
f2b99332d9
Add Lua API function to resolve node/collision/selection boxes (#13964) 2024-02-06 20:45:16 +01:00
sfence
83f779c52d
Fix active object adding to not generated block (#14311) 2024-02-04 21:24:08 +01:00
sfan5
c9e10e1dd9 Drop valgrind from CI and instead enable ASan
The recently added ioctl use is reported as a false-positive by valgrind.
I tried moving it to different compilers/versions two times and only
hit further issues that were valgrind's fault.

Also includes a tiny fix.
2024-02-04 21:23:05 +01:00
sfan5
4259ac96ea Optimize fs::CopyFileContents on Linux and Windows 2024-02-04 21:23:05 +01:00
sfan5
714c9361ea Add unit tests for fs::CopyFileContents 2024-02-04 21:23:05 +01:00
sfan5
93381014a0 Bypass media transfer in single player 2024-02-04 21:23:05 +01:00
Lars Müller
1d9c9710d7
Fix short raycasts missing large objects (#14339)
Increases the tolerance from one node to five nodes.
Also optimizes the "sphere" used for pre-filtering entities
to start in the middle of the line segment rather than at the start.
2024-02-04 14:04:05 +01:00
SmallJoker
e7dbd325d2
RemotePlayer: make peer ID always reflect the validity of PlayerSAO (#14317)
Upon disconnect, RemotePlayer still had a peer ID assigned even though
the PlayerSAO object was maked as gone (for removal). This commit makes
that the following always holds true:

	(!sao || sao->isGone()) === (peer_id == PEER_ID_INEXISTENT)
2024-02-02 22:13:24 +01:00
techno-sam
176e674a51
Add wear bar color API (#13328)
---------

Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
Co-authored-by: grorp <gregor.parzefall@posteo.de>
2024-02-02 21:21:00 +01:00
sfan5
e10d8080ba
Add flag to control mgv6 temple generation (#14293) 2024-01-30 21:52:04 +01:00
sfan5
9da1354f3a
Fix missing limit check for block y pos (#14320) 2024-01-30 21:51:51 +01:00
sfan5
e1f6108789 Revert class forward declaration in {client,server}opcodes.h
closes #14324
2024-01-30 17:04:12 +01:00
Lars Mueller
40bf88ac74 Performance: Limit blitting work to overlapping area 2024-01-28 13:01:54 +01:00
sfan5
ffec698d3e Change how [combine parameters are checked
the old checks were too strict
2024-01-28 13:01:54 +01:00
grorp
fbec168e91
Only pause rendering if the Android activity is stopped (#14211) 2024-01-27 14:37:00 +01:00
sfan5
89f3502b56 Move Server ban check to different point 2024-01-27 10:33:32 +01:00
sfan5
5dbc1d4c08 Move some files to src/server/ 2024-01-27 10:33:32 +01:00
sfan5
c0f852e016 Change NetworkPacket to reserve instead of resize
also make the bool serialization clearer and move the constructor
to the header file
2024-01-27 10:33:32 +01:00