Commit Graph

641 Commits

Author SHA1 Message Date
sfan5
575caa8015 Properly keep noclip state in Game and ClientMap 2022-06-03 21:48:52 +02:00
sfan5
5f3af7d18b Remove obsolete eye_height related workaround
This was added a long time ago in 42bbd5c9ae06a8d8ffb7915599097ead6f848755
and meant to fix prevent the view becoming black when jumping into a
ceiling, this no longer happens today.
2022-06-03 21:48:52 +02:00
sfan5
85c824ed13 Make sure real disconnect reason isn't overwritten
bug introduced in 2f32044273d107e82fb1c35d4a0f616fa480cdf0
2022-05-29 14:00:19 +02:00
sfan5
5cd7b0c6e4 Remove remains of video mode querying 2022-05-29 14:00:19 +02:00
x2048
ef22c0206f
Force-update shadows when the world is changed (#12364) 2022-05-26 22:28:34 +02:00
sfan5
5d26ac0088 Improve code in mapblock_mesh.cpp a bit 2022-05-26 15:49:12 +02:00
x2048
ed26ed5a1f
Quantize light frustum calculations (#12357)
* Quantize light frustum calculations

Reduces shadow flicker

* Fix function name to match conventions
2022-05-23 23:45:18 +02:00
paradust7
2742fef458
Fixes needed to use irrArray backed by std::vector (#12263) 2022-05-22 00:11:49 +02:00
sfan5
2f32044273 Don't ignore server disconnects in client code
If the server stops talking to us without saying bye we
should actually end the in-game session with an error message.
2022-05-21 17:49:55 +02:00
x2048
dc45b85a54
Improve shadow filters (#12195)
* Rewrite shadow filtering for the new distortion
* Calculate penumbra radius using a single sample
* Avoid peter-panning effect due to filtering of short shadows
* Add adaptive filter quality for soft shadows
* Avoid sharp shadows on surfaces without normals (e.g. plants)
* Increase default and maximum soft shadow radius
* Make line numbers in shader errors match the code
2022-05-21 16:49:30 +02:00
x2048
a4ef62f5b2
Fix lighting of upright_sprite entities (#12336)
Use MeshNode materials to set the light since ReadOnlyMaterials is now false
2022-05-20 22:35:03 +02:00
x2048
604fb2b738
Fix lighting of the wield mesh (#12341)
* Assign node light to player before final color blend.
  Fixes day/night lightbank ratio for wield meshes
* Update wield mesh light when changing mesh
2022-05-20 22:33:52 +02:00
paradust7
273bfee9a1
Use std::map instead of core::map (#12301) 2022-05-18 12:31:49 +02:00
Dmitry Kostenko
8756b7a735 Initialize wield mesh color when wield_image is set
#12245
2022-05-15 21:44:55 +02:00
Lars Müller
c2898f53bc
HUD: Update selection mesh every frame (#12270)
Fixes outdated selection boxes after entity property changes.
2022-05-09 20:43:47 +02:00
sfan5
a66e6d4dff Consolidate some data structures in MapBlockMesh 2022-05-08 19:12:10 +02:00
ROllerozxa
f128f4cba1 Fix mapblock geometry optimisation not working
Caused by the depth sorting PR marking not only transparent nodes to be ignored but also opaque ones with the TILE_MATERIAL_BASIC material type
2022-05-08 19:11:44 +02:00
x2048
cc56ebd90d
Avoid rendering invisible faces of simple nodeboxes (#12262)
* Skip rendering faces adjacent to opaque nodes
* Cancel out opposite faces of adjacent nodebox nodes of the same type

Fixes #6409
2022-05-04 23:44:55 +02:00
SmallJoker
3ce5a68cd1
guiScalingFilter: Fix most memory leaks (#12256)
Calls to the cache function ended up creating a new texture regardless whether
the texture is already cached.
2022-05-04 20:55:13 +02:00
paradust7
0704ca0550
Make logging cost free when there is no output target (#12247)
The logging streams now do almost no work when there is no output target for them.

For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing.
2022-05-04 20:55:01 +02:00
sfan5
71a56c3552 Fix broken FPS/dtime counters in debug info
was broken by a89afe1229e327da3c397a3912b2d43d2196ea2b
2022-05-03 20:17:43 +02:00
x2048
c7bcebb628
Initialize wield mesh colors when changing item. (#12254)
Fixes #12245
2022-05-01 17:21:00 +02:00
sfan5
a89afe1229 Deal with compiler warnings 2022-04-30 16:49:41 +02:00
Oblomov
0d91ef78dd
Refactor local time getter functions (#12221)
This commit introduces mt_localtime() in src/gettime.h, a wrapper
around the OS-specific thread-safe versions of localtime()
(resp. localtime_s on Windows and localtime_r in other systems).

Per the Open Group recommendation,
«portable applications should call tzset() explicitly before using
ctime_r() or localtime_r() because setting timezone information is
optional for those functions», so we also do a one-shot
call of tzset() (_tzset() on Windows to avoid warning C4996).

The function is used to replace the localtime() calls in
getTimestamp() and makeScreenshot().

(The only reminaing call to localtime() in the tree now is the one in
the local copy of the Lua source code.)
2022-04-28 18:53:33 +02:00
paradust7
7e18a1f1be
Remove HW_buffer_counter after IrrlichtMt fix to remove HWBufferMap (#12232)
Keep code and use version check instead, for backwards compatibility
2022-04-28 18:52:19 +02:00
Wuzzy
7f4fc6f8a7
Show unknown node in debug screen (#12230) 2022-04-28 18:51:46 +02:00
Giuseppe Bilotta
b55d7cd45a Fix worldaligned textures
As reported in #12197, b0b9732359d43325c8bd820abeb8417353365a0c
introduces a regression in worldalign textures.

The specific change that seems to be responsible for this issue is the
change in order between the computation of the cuboid texture
coordinates and the box edge correction.

Fix #12197 by moving the box edge correction back to before the cuboid
texture coordinates, as it used to be.
2022-04-24 21:11:24 +02:00
Lars Müller
4558793caf
Fix some debug info showing despite being disabled in the UI (#12205) 2022-04-21 21:45:47 +02:00
paradust7
7cea688a1c
Fix '[combine' when EVDF_TEXTURE_NPOT is disabled. (#12187)
Stop scaling images to POT immediately when loaded. The 'combine'
modifier hardcodes X and Y coordinates, and so behaves incorrectly
if applied to a scaled image. Images emitted by generateImage()
are already scaled to POT before being used as a texture, so
nothing should break.
2022-04-16 18:50:59 +02:00
SmallJoker
1d07a36552
upright_sprite: Fix walk animation in first person (#12194) 2022-04-15 18:55:08 +02:00
x2048
a5d29fa1d4
Implement shadow offsets for the new SM distortion function (#12191)
* Move shadow position calculation to vertex shaders
* Animate entire scene before rendering shadows to prevent lagging of shadows
* Remove unnecessary use of PolygonOffsetFactor
* Apply normal offset to both nodes and objects
* Rename getPerspectiveFactor -> applyPerspectiveDistortion
* Remove perspective distortion from fragment shaders
2022-04-14 22:49:30 +02:00
ShadowNinja
7993909fab Spacing fixes 2022-04-08 14:55:21 +01:00
ShadowNinja
5683bb76cc Fix compiler warnings 2022-04-08 14:55:21 +01:00
Dmitry Kostenko
23516acd0b Remove obsolete commented code (follow up to #12166) 2022-04-07 22:38:01 +02:00
x2048
48f7c5603e
Adjust shadowmap distortion to use entire SM texture (#12166) 2022-04-07 22:13:50 +02:00
Jude Melton-Houghton
0b5b2b2633
Disentangle map implementations (#12148)
Fixes violation of Liskov substitution principle
Fixes #12144
2022-04-07 21:58:04 +02:00
x2048
b0b9732359
Add depth sorting for node faces (#11696)
Use BSP tree to order transparent triangles
https://en.wikipedia.org/wiki/Binary_space_partitioning
2022-04-02 10:42:27 +02:00
Dmitry Kostenko
26c046a563 Increase the ratio between shadow range and viewing range 2022-04-02 10:39:43 +02:00
x2048
3dd7d7867b
Limit shadow map to the viewing range (#12158) 2022-03-31 22:40:59 +02:00
x2048
31578303a4
Tune shadow perspective distortion (#12146)
* Pass perspective distortion parameters as uniforms
* Set all perspective bias parameters via ShadowRenderer
* Recalibrate perspective distortion and shadow range to render less shadow geometry with the same quality and observed shadow distance
2022-03-31 22:40:06 +02:00
x2048
0f25fa7af6
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
2022-03-26 16:58:26 +01:00
Gregor Parzefall
289c3ff377
Fix footsteps for players whose collision box min y != 0 (#12110) 2022-03-14 21:01:18 +01:00
Daroc Alden
11f3f72f1c
Fix undefined behavior in TileLayer (#12125)
Initialize the values properly
2022-03-11 21:22:49 +01:00
sfan5
51294163bb Use Irrlicht bindings for GL call 2022-03-09 22:37:34 +01:00
Dmitry Kostenko
4801bdf45a Correct normal bias for entities
Remove use of magic constants.
Apply cameraOffset
Calculate distance projected on SM plane
2022-03-07 23:45:26 +01:00
Dmitry Kostenko
8f652f4e31 Fix shadows for upright sprite nodes
Avoid using read only materials in mesh scene node, as
it confuses shadow renderer.
2022-03-07 23:45:26 +01:00
Dmitry Kostenko
d2a3bed240 Avoid possible buffer overflow when checking face normals 2022-03-07 23:45:26 +01:00
Dmitry Kostenko
e4583cb9b7 Use correct indexes when checking mesh normals 2022-03-07 23:45:26 +01:00
Dmitry Kostenko
1175f48d05 Detect 'insane' normals in checkMeshNormals.
Detect non-zero normals which point in the opposite direction from the
face plane normal.
2022-03-07 23:45:26 +01:00
Dmitry Kostenko
54dccc480e Improve lighting of entities.
Pass correct natural & artificial light to the shaders
Use natural/artificial light ratio for correct rendering of shadows
2022-03-07 23:45:26 +01:00