Commit Graph

114 Commits

Author SHA1 Message Date
Lars Müller
fef28aced9
Irrlicht: Get rid of obsolete setDebugName (#15541)
Co-authored-by: sfan5 <sfan5@live.de>
2024-12-14 17:03:08 +01:00
Lars Müller
23e502fa0e
Test & document conventions used by matrix4::setRotation* (#15542)
Also includes a minor `matrix4::transformVect` refactor to make testing easier.
2024-12-14 17:02:16 +01:00
Lars Müller
1e59b9a756
Refactor SkinnedMesh (#15522) 2024-12-12 15:33:08 +01:00
Lars Müller
05d31222f7
Allow non-normalized weights in glTF models (#15310)
We are being lax here, but the glTF specification just requires that "when the weights are stored using float component type, their linear sum SHOULD be as close as reasonably possible to 1.0 for a given vertex"

In particular weights > 1 and weight sums well below or above 1 can be observed in models exported by Blender if they aren't manually normalized.
These fail the glTF validator but Irrlicht normalizes weights itself so we can support them just fine.

The docs have been updated to recommend normalizing weights (as well as documenting the status of interpolation support).

Weights < 0, most of them close to 0, also occur. Consistent with Irrlicht, we ignore them, but we also raise a warning.
2024-12-06 18:05:03 +01:00
Lars Müller
3e10d9ccf5
Refactor: Merge [IC]SkinnedMesh into SkinnedMesh (#15511) 2024-12-06 18:03:44 +01:00
sfan5
810f39767c Move SMaterial std::hash impl to its header 2024-12-04 18:20:34 +01:00
sfan5
a799a54894 Fix some issues with mt_opengl 2024-12-04 18:20:34 +01:00
sfan5
1fb7202028 GL: fix and clean up some code 2024-12-04 18:20:34 +01:00
sfan5
36edc3f161 Add 10-bit texture format and setting to chose PP color depth
(and move some settings to the advanced category)
2024-12-04 18:20:34 +01:00
Lars Müller
18caf3a18d
Fix false positive compiler warning 2024-12-04 18:19:12 +01:00
HybridDog
a45b04ffb4
Less explicit memory management in Irrlicht image writer classes (#15493)
CImageWriterPNG::writeImage() and writeJPEGFile() explicitly allocate
and deallocate memory with `new` and `delete`, which is prone to programming errors.
The code also has non-functional error handling:
When memory allocation fails, `new` throws an `std::bad_alloc` exception
and never returns `nullptr`, so the check for `nullptr` is always false.

Co-authored-by: DS <ds.desour@proton.me>
2024-12-03 16:52:48 +01:00
JosiahWI
c3db9492a7
Update CMakeLists to use add_compile_definitions (#15483)
This is a newer feature introduced in CMake 3.12, which is now our
minimum version. It supercedes `add_definitions`. I've also replaced
some calls to set `CMAKE_<LANG>_FLAGS` that were used to set
definitions. This is a fairly trivial routine build maintenance that
is not intended to have any behavioral effects.
2024-11-29 12:02:48 +01:00
Lars Müller
d068f34753
Get rid of definitelyIdentityMatrix (#15480) 2024-11-29 12:00:09 +01:00
Christian Betancourt Dias
b63e988bd6
Fix naming conventions for CMatrix4::set(Inverse)RotationRadians() (#15204) 2024-11-19 13:38:19 +01:00
Lars Müller
15e8f9e6a0
Fix rendering regression with TGA type 1 files with BGRA8 color (#15402)
TGA uses BGR(A)8, stored in memory in that order. Irrlicht typically expects 0xAARRGGBB, which depends on endianness.
(This means that on little endian, no [B][G][R][A] -> 0xAARRGGBB conversion needs to be done, but Irrlicht was swapping the bytes.)

This makes both conversion functions consistently convert from [B][G][R]([A]) to 0xAARRGGBB (SColor), documents them properly and moves them to CImageLoaderTGA.cpp
so no poor soul shall be fooled by them in the near future.

---------

Co-authored-by: Ælla Chiana Moskopp <erle@dieweltistgarnichtso.net>
2024-11-19 13:37:05 +01:00
grorp
9b6a399011
Implement support for FSAA in combination with post-processing (#15392)
- Actually it's MSAA I think, or perhaps the terms are equivalent
- I've made it fit into the existing Irrlicht architecture, but that has resulted in code duplication compared to my original "hacky" approach
- OpenGL 3.2+ and OpenGL ES 3.1+ are supported
- EDT_OPENGL3 is not required, EDT_OPENGL works too
- Helpful tutorial: https://learnopengl.com/Advanced-OpenGL/Anti-Aliasing, section "Off-screen MSAA"
- This may be rough around the edges, but in general it works
2024-11-18 14:06:48 +01:00
HybridDog
7295b6c88c
Remove unused and rarely used irrlicht color functions (#15442)
SColor.h contains many functions which are unused and/or perform linear
operations on non-linear 8 bit sRGB color values, such as the plus operator and
`SColor::getInterpolated()`, and there is no documentation about missing gamma
correction.
Some of these functions are not called or called only once:
* `getAverage(s16 color)`: Unused
* `SColor::getLightness()`: Unused
* `SColor::getAverage()`: Claims to determine a color's average intensity but
  calculates something significantly different since SColor represents
  non-linear sRGB values.
* `SColor::getInterpolated_quadratic()`: Claims to interpolate between colors
  but uses the sRGB color space, which is neither physically nor perceptually
  linear.
* `SColorf::getInterpolated_quadratic()`: Unused
* `SColorf::setColorComponentValue()`: Unused

Removing or inlining these functions can simplify the code and documenting
gamma-incorrect operations can reduce confusion about what the functions do.

This commit does the following:
* Remove the above-mentioned unused functions
* Inline `SColor::getAverage()` into
  `CIrrDeviceLinux::TextureToMonochromeCursor()`
* Rename `SColor::getLuminance()` into `SColor::getBrightness()` since it does
  not determine a color's luminance but calculates something which differs
  significantly from physical luminance since SColor represents non-linear sRGB
  values.
* Inline `SColor::getInterpolated_quadratic()` into `GameUI::update()`,
  where it is only used for the alpha value calculation for fading
* Document gamma-incorrect behaviour in docstrings
2024-11-18 00:02:53 +01:00
sfan5
8d2e770361 Minor corrections in gl3/gles2 drivers 2024-11-16 16:54:22 +01:00
sfan5
cc8c3d501c Don't keep a copy of all texture images around 2024-11-16 16:54:22 +01:00
sfan5
58ccf0ba82 Fix some smaller issues with texture/image handling 2024-11-16 16:54:22 +01:00
sfan5
4aae31ad5e Add support for ECF_D24 texture format
and prefer it over D32 for our depth buffer, this can have performance benefits
2024-11-16 16:54:22 +01:00
sfan5
3c42cc8684 Revive texture download code and fix it on GLES 2024-11-16 16:54:22 +01:00
sfan5
11837d4623
Remove BMP image support (#15434)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
2024-11-15 12:21:30 +01:00
SmallJoker
8f03b70584 IrrlichtMt: Document Driver/Device compatibility 2024-11-15 12:18:48 +01:00
SmallJoker
4838eb2f7d Non-SDL: Add opengl3 support 2024-11-15 12:18:48 +01:00
sfan5
794aea8e92
Drop fixed pipeline support code (#15421)
OpenGL 2.0 is now mandatory.
2024-11-13 14:24:01 +01:00
grorp
11e04ec113
Replace forgotten SEvent memset 2024-11-13 14:23:13 +01:00
sfan5
a5e3fca40c Revert "Disable SDL2 for 5.10.0 (#15284)"
This reverts commit 6d7a5197407460515b68e1ca18052c124b2fe15b.
2024-11-10 20:56:09 +01:00
sfence
e55ba9c390
Support generation of working Xcode project for signature purposes on MacOS (#15303) 2024-11-10 19:06:52 +01:00
sfan5
8b27340b2e Work around Intel driver bug on Win 8.1 and older 2024-11-10 17:44:45 +01:00
Lars Mueller
0391d91e5d Improve error messages for failed mesh loading 2024-11-09 18:13:56 +01:00
grorp
50b7523336 ogles 2 driver: Delete some dead code
grepping for IRR_COMPILE_GLES2_COMMON gives no other results

COGLESCoreExtensionHandler is only used through COpenGL3ExtensionHandler
2024-11-08 20:43:24 +01:00
grorp
fced6ff240 Fix ECF_D32 support in ogles2 video driver
OES_depth32 only talks about support for render buffers, not textures,
so it's not relevant here:
https://github.com/KhronosGroup/OpenGL-Registry/blob/main/extensions/OES/OES_depth32.txt

This fixes the scene being black with "video_driver = ogles2" and
"enable_post_processing = true" on my desktop computer.
2024-11-08 20:43:24 +01:00
grorp
bafc477919
Revert "2D rendering: Enable bilinear filter for downscaling textures" (#15385)
This reverts commit minetest/irrlicht@fb7a0e4298.
2024-11-08 11:17:15 +01:00
Ælla Chiana Moskopp
60cd1e4529 Correctly render transparency in TGA type 1 with color format A1R5G5B5
The branch removed in this patch handled color format A1R5G5B5 specially
when creating a texture from a TGA type 1 file, i.e. an image that has a
colormap. It did not handle the 1-bit alpha channel correctly, rendering
transparent pixels black instead.

Since the colormap is converted to A8R8G8B8 earlier anyways, the code
for the general case is able to handle this scenario already – at the
expense of making the created texture use twice as much GPU memory as
necessary.
2024-11-06 20:07:05 +01:00
sfan5
5c5538685e
Don't memset SEvent directly (#15359)
Fixes a compiler warning by manually zeroing the tag and the largest union member instead
2024-10-31 19:24:43 +01:00
grorp
4b90e582b4
Rename to Luanti (#15294)
The new header intentionally isn't in MTG stone design (or any other MTG-esque design), since we want to distance Luanti and MTG from each other. The font "undefined medium" (https://undefined-medium.com/) was used. 

ASCII art generated by https://patorjk.com/software/taag/#p=display&f=Graffiti&t=luanti
https://github.com/minetest/minetest/pull/11952#issuecomment-1013364703

---------

Co-authored-by: sfan5 <sfan5@live.de>
2024-10-27 14:04:51 +01:00
sfan5
2d135cc1bb
Revert "Use EGL over GLX" (#15315)
This reverts commit aa273119f292e52df8d99f663df5337bac31556d.
2024-10-24 17:52:06 +02:00
sfan5
aa273119f2
Irrlicht: Use EGL over GLX (#15286) 2024-10-22 23:04:46 +02:00
DS
e5d321d286
Cleanup headers in irr/include/ (#15181) 2024-10-18 10:58:32 +02:00
grorp
9f43018df2
Better UX when touch events aren't supported by Irrlicht device (#15288) 2024-10-16 21:37:00 +02:00
Lars Müller
c7938ce81c
Improve glTF logging (#15274)
Also removes all animations but the first one from gltf_frog.gltf
to address the corresponding warning.

Catches some more possible exceptions (out of bounds, optional access)
which might be caused by a broken model to properly log them.
2024-10-15 12:19:19 +02:00
sfan5
6d7a519740
Disable SDL2 for 5.10.0 (#15284)
see #14545
2024-10-14 22:09:11 +02:00
Lars Mueller
06907aa99b Support floating-point animation frame numbers 2024-10-10 21:39:57 +02:00
Lars Mueller
323fc0a798 Add glTF animation support 2024-10-10 21:39:57 +02:00
Lars Mueller
d8274af670 Refactor global inversed matrix usage (+ minor fix)
Thanks to GreenXenith and Josiah for spotting a bug here
2024-10-10 21:39:57 +02:00
Lars Mueller
224066c1d3 Implement glTF texture wrapping support 2024-10-10 21:02:05 +02:00
Lars Mueller
2fee37f31b Fix gltf / glb loader oversights
- Avoid an unnecessary copy
- Reject models requiring extensions

Co-authored-by: DS <ds.desour@proton.me>
2024-10-10 21:02:05 +02:00
Lars Mueller
521e678d39 Add binary glTF (.glb) support 2024-10-10 21:02:05 +02:00
Lars Mueller
7e4919c6ed Refactor matrix4.h
Sets the surprising row-major conventions used here straight.

Renames rotateVect to rotateAndScaleVect:
If the matrix also scales, that is applied as well by the method.
Obsolete rotateVect variants are removed.
The inverseRotateVect method is also renamed accordingly.
Note that this applies the transpose of the product
of the scale and rotation matrices, which inverts just the rotation.
2024-10-10 17:40:31 +02:00