Commit Graph

378 Commits

Author SHA1 Message Date
David Heidelberg
73e62f8676 Keep RTTI for Minetest IPO/LTO
Minetest using RTTI, so we cannot apply the flag here
if we want to start using IPO/LTO.

If we keep `-fno-rtti` here, compiler loses part of informations and
cannot do efficient optimizations.

The benefit of using RTTI on Irrlicht disappears with IPO/LTO on whole binary.

Signed-off-by: David Heidelberg <david@ixit.cz>
2024-01-06 21:30:15 +01:00
HybridDog
fb4ee6ac93 Fix mip map size calculation for non-square textures
The size of a mip map is `max{floor(width / 2 ^ level), 1} x max{floor(height / 2 ^ level), 1}`,
where `width x height` is the size of the full-resolution image,
`level` is the integer mip map level
and the smallest mip map has `1 x 1` resolution.
If `regenerateMipMapLevels` is called with custom mip map data,
the mip map sizes are calculated in this function and separately in `uploadTexture`.
`uploadTexture` calculates a size by `floor(width / 2 ^ level) x floor(height / 2 ^ level)`.

To support non-square textures, after this change,
`uploadTexture` sets the mip map width or height to `1` if it is `0`.
2024-01-05 14:09:50 +01:00
Muhammad Rifqi Priyo Susanto
91e4129615
Windows: Return early if the clipboard data is not Unicode text 2024-01-04 21:24:50 +01:00
grorp
54b82aad26
Add IrrlichtDevice::isWindowVisible for Android 2024-01-04 16:48:35 +01:00
sfan5
03dd8b0336 Update vendored khrplatform.h 2023-12-19 22:56:31 +01:00
sfan5
6e6b4a6f3c Fix some minor issues with GL loader
fixes #258
2023-12-19 22:56:31 +01:00
sfan5
0110826ce9 Resync mt_opengl_loader.cpp with BindingGenerator.lua
also add a warning that you can't edit it by hand
2023-12-19 22:56:31 +01:00
Vitaliy
9a439a3646
Use SDL2 by default
Except on Android and macOS, for now
2023-12-17 18:46:08 +01:00
paradust7
bb7c06d32a Initialize X11 thread safety 2023-12-10 16:29:22 +01:00
Muhammad Rifqi Priyo Susanto
a2884e4000
Android: Make ALooper_pollAll call always non-blocking (#255) 2023-11-30 15:52:04 +01:00
numzero
85081d6fe0 Fix off-by-one error in the TGA RLE decompressor 2023-11-01 14:40:11 +01:00
numzero
a07cfc0f7a Require C++17 at the top level 2023-11-01 14:40:11 +01:00
sfan5
6fccc79270 Convert built-in font to PNG 2023-10-25 16:54:43 +02:00
Loic Blot
7cade6f27f cleanup: remove _IRR_COMPILE_ANDROID_ASSET_READER_ build flag
it's enabled inconditionally on android

also remove some _IRR_COMPILE_WITH_ANDROID_DEVICE_ which are useless because cmake is already properly configured
2023-10-22 12:19:14 +02:00
Loic Blot
ae63f1bf02 build: drop _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
it's enabled inconditionally
2023-10-22 12:19:14 +02:00
cutealien
4a7d3de89a Merging r6555 through r6560 from branch releases/1.8 to trunk
- Fixing buffer overflow in tga loader

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6561 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-21 17:27:11 +02:00
cutealien
9813b460e1 Fix number overflows in TGA loader causing crashes
Image size calculation could overflow s32 in one place (but not others where it was done correct), which first lead to wrong amount of memory getting allocated for image data and later crash in the CColorConverter.
Thanks @sfan5 for his fuzzing tests @https://github.com/minetest/irrlicht/issues/236
and @erlehmann for passing them on: https://irrlicht.sourceforge.io/forum/viewtopic.php?t=52925
Also updating changes.txt with TGA loader changes from this and previous commits.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6535 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:54:39 +02:00
cutealien
565f14677c Fix crash caused by memory overwriting in TGA loader caused by bad RLE data
From sfan5's fuzzing test reported in Minetest here: https://github.com/minetest/irrlicht/issues/236
Was missing test if it writes beyond allocated memory which can be triggered by TGA's which lie in their RLE data.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6534 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:54:24 +02:00
cutealien
f53af0f2cf TGA images with palettes in 24 or 32 bit now create 32 bit images
Was creating 16-bit images for those before.
Could also support 24-bit images, but either we need another convert function or another palette for that (the 16 and 32 bit both work with 32 bit palettes, the 24 bit conversion function only with 24 bit palettes)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6533 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:54:21 +02:00
cutealien
05ebc43222 Fix TGA's with bad palette colors reading from behind palette memory
TGA's can claim to use less palette colors than they later do.
We only support 8-bit palettes, so to make this safer lets just always allocate at least 256 bytes.
Thanks @erlehmann for report and testcase: https://irrlicht.sourceforge.io/forum/viewtopic.php?p=307191
Based on Minetest bug report: https://github.com/minetest/irrlicht/issues/236

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6532 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:54:16 +02:00
cutealien
c01de80583 Merging r6511 through r6520 from branch releases/1.8 to trunk
Note: Due to OSX always failing merge OSX it's rather applying a second patch
from Ryan Schmidt from bugreport #462 to trunk
(Not sure why svn merging always fails for OSX. Probably related to MacOSX files getting moved in the past. Was that done without svn move commands? I guess that can't be fixed anymore now)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6521 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:49:54 +02:00
cutealien
627a3a5172 Spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6475 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:39:42 +02:00
cutealien
01e05f3c94 Fix recently broken scroll behaviour of listbox with moveOverSelect
This also fixes the combobox which users the listbox like that.
This got broken in [r6454] which had fixed the events send out by the listbox
Note: Still a bit strange behaviour when leaving the combobox at the bottom, but that was already that way in Irrlicht 1.8, so I've got to investigate that on it's own.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6463 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:38:24 +02:00
cutealien
b673a4b2bb Tiny spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6462 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:38:06 +02:00
cutealien
5e01152f56 Avoid warning in VS 2022
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6460 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:37:30 +02:00
cutealien
c2dd664fc6 CIrrDeviceWin32::yield() now uses Sleep(0) instead of Sleep(1).
We had changed that once before in the other direction in svn r421
Reason back then was "Sleep(0) doesn't allow any lower priority threads to execute"
But Microsoft changed the behaviour of Sleep(0) after Windows XP so that's no longer true.
And the costs of it is pretty high - due to this using a timer with a 15ms resolutions it meant not just giving up the thread but it also always waited for 15ms on Windows.
I also replaced a few sleep calls in examples for that reason with yield() calls.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6459 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:37:26 +02:00
cutealien
774d3d6d2b Spelling fixes
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6458 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-10-15 13:36:47 +02:00
Gregor Parzefall
c766c3a023 Fix character encoding conversion issues 2023-10-15 12:59:40 +02:00
Gregor Parzefall
93eebed8c9 Unify documentation between IOSOperator and COSOperator 2023-10-15 12:59:40 +02:00
numzero
645b51a34d OpenGL3: Use std::vector in VertexType instead of clever lifetime games 2023-10-13 11:36:52 +02:00
numzero
bcc53e1e1a OpenGL3: Make sure mt_opengl is only included after GLAPI is defined 2023-10-13 11:36:52 +02:00
numzero
d4735ebc76 OpenGL3: Replace direct calls into libGL with mt_opengl 2023-10-13 11:36:52 +02:00
numzero
063079b372 OpenGL3: Make VertexType reference and not store the attribute list 2023-10-13 11:36:52 +02:00
numzero
3b198bdfda OpenGL3: Fix noexcept mismatch 2023-10-13 11:36:52 +02:00
Gregor Parzefall
5b2f1927d0
Revert #225 (d98dc90b38)
Fixes that Windows+SDL builds use the Windows Irrlicht device instead of the SDL Irrlicht device.
2023-10-04 23:29:59 +02:00
Vitaliy
9954667c45
Cleanup line endings (#245)
The exact commands to make this commit were:

git reset --hard origin/master
find -type f |  # list all regular files
  grep -E '\.(h|cpp|fsh|vsh|mm)|LICENSE$' |  # filter for text files
  xargs -n 1 -P $(nproc) sed -i 's:\s*$::'  # for each file, trim trailing whitespace including the CR
git commit -a
2023-10-03 20:37:00 +02:00
Gregor Parzefall
ea1b58387e
ComboBox API additions for minetest#13814
- Allow reliably detecting when the user opens a combobox.
- Allow preventing comboboxes from opening.
- Allow sending a combobox change event.
2023-09-30 16:46:30 +02:00
sfan5
d767d27ca8 CXMeshFileLoader: revise error checking
Even when an error was encountered ::load() would still attempt
to assemble the mesh, this was a pretty big problem.
2023-09-29 13:49:03 +02:00
sfan5
6f4f7c4d75 CXMeshFileLoader: fix buffer overreads with text format 2023-09-29 13:49:03 +02:00
sfan5
103ab16679 CB3DMeshFileLoader: fix string read primitive 2023-09-29 13:49:03 +02:00
sfan5
64688f4490 CB3DMeshFileLoader: add some bounds checks 2023-09-29 13:49:03 +02:00
sfan5
827710f74a COBJMeshFileLoader: properly check indices 2023-09-29 13:49:03 +02:00
sfan5
80e160935d COBJMeshFileLoader: fix buffer overruns 2023-09-29 13:49:03 +02:00
sfan5
4506d23dc3 CImageLoaderBMP: add bound checks to RLE decompression 2023-09-29 13:49:03 +02:00
sfan5
028cb8dbed CImageLoaderBMP: check bitmap data against required size 2023-09-29 13:49:03 +02:00
sfan5
a5c9945bb8 CImageLoaderBMP: fix palette overreads 2023-09-29 13:49:03 +02:00
numzero
cfb73d07d7 Remove more obsolete files 2023-09-26 17:42:00 +02:00
numzero
87f7cf3438 Drop unused resource script 2023-09-26 17:42:00 +02:00
numzero
b0a070d980 Drop Irrlicht icon 2023-09-26 17:42:00 +02:00
numzero
b89455f385 Build OpenGL3 by default 2023-09-17 21:07:07 +02:00
numzero
6a5fceb8fd Hide OpenGL3 behind SDL2 (it won’t build otherwise anyway) 2023-09-17 21:07:07 +02:00
Gregor Parzefall
0b9ee5884f Fix Android build after #231 2023-09-17 20:34:43 +02:00
sfan5
679dfd3343 Fix CNullDriver::removeTexture() segfault
`Textures` is not an one-to-one mapping.
Minetest still crashes with this commit but that's because
it attempts to double-free a texture.
broken by 7298b46504
2023-09-13 15:16:57 +02:00
Desour
03fd4ff533 Remove unused IVideoDriver::getTextureByIndex and IVideoDriver::renameTexture
* getTextureByIndex is pretty useless (apart from iterating over all texture,
  which we don't do), as you can't get an id.
* renameTexture is broken anyway: The sort call does nothing because the array
  is still flagged as sorted.
2023-09-13 13:24:08 +02:00
Desour
b7292226b4 Remove the unnecessary sort in CNullDriver::addTexture 2023-09-13 13:24:08 +02:00
sfan5
7298b46504 Use binary search in CNullDriver::removeTexture() 2023-09-13 12:33:50 +02:00
Caleb Butler
00dd1f8ef3 Remove deprecated functionality of SMaterial 2023-09-05 17:21:35 +02:00
Caleb Butler
364cb37698 Remove deprecated methods from IVideoDriver 2023-09-05 17:21:35 +02:00
Caleb Butler
3492fd0d2d Remove primitive types not supported in OpenGL 3+
I removed old primitive types that do not work with modern OpenGL.
2023-09-05 17:21:35 +02:00
Kai Giebeler
c6b06533f3
Deduplicate KP_5 from KP_HOME 2023-09-01 15:54:55 +02:00
sfan5
e609f5f263 Remove leftovers from D3D 2023-09-01 12:45:56 +02:00
sfan5
ddecc0fae2 Inline a pointless function 2023-09-01 12:26:43 +02:00
sfan5
dd3a34d674 Remove unused (I)Timer methods 2023-09-01 12:22:27 +02:00
Desour
0735220f86 Suppress a -Wunused-but-set-variable warning 2023-08-29 17:33:25 +02:00
Jessica Clarke
ef3bab610d CIrrDeviceLinux: Fix type for NET_WM_PID XChangeProperty
This uses format=32 which in X11's API means a C type of long (with
restricted range when > 32 bits). pid_t is of unknown type, though on
Linux and FreeBSD it's a 32-bit type, so does not have the same size as
long on 64-bit architectures, and thus XChangeProperty reads outside its
bounds. Fix this by casting to and passing a long.
2023-08-15 20:42:12 +02:00
Loïc Blot
d98dc90b38
cleanup: only build some files on WIN32 and compile EGL only if needed 2023-08-01 20:53:25 +02:00
Loic Blot
e0d4d7d8b4 cleanup: get rid of the legacy #ifndef #define craziness 2023-07-20 16:29:09 +02:00
Gregor Parzefall
fb7a0e4298 2D rendering: Enable bilinear filter for downscaling textures
This looks much better and doesn't have any downsides (e.g. regarding pixel art).
2023-07-16 13:02:48 +02:00
Gregor Parzefall
a994c31ccf Expose all OpenGL filtering modes, use OpenGL names for them
Because of a review comment by numberZero.
2023-07-16 13:02:48 +02:00
Gregor Parzefall
c40045a40a Rename SMaterial::TextureLayer -> SMaterial::TextureLayers
It's not the "texture layer" of the material, but an array of texture layers.
2023-07-16 13:02:48 +02:00
Gregor Parzefall
5ececc7d29 Split up texture filtering properties of SMaterialLayer into MinFilter and MagFilter
You can now set the filter used when scaling textures down and the filter used when scaling textures up separately.
2023-07-16 13:02:26 +02:00
Gregor Parzefall
9e0189019e Refactor the way you set material properties
Instead	of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
2023-07-16 13:02:25 +02:00
ndren
b249e4523d
Use precise y-direction scroll values in SDL 2023-07-03 22:46:08 +02:00
Gregor Parzefall
83699a835d Remove content-less comments 2023-06-15 10:01:34 +02:00
Gregor Parzefall
98589d2fd2 Remove unused fixed function materials 2023-06-15 10:01:34 +02:00
Desour
cbc7aeb302 Bump C++ std to 17 2023-06-14 09:45:16 +02:00
Gregor Parzefall
09af5ac00d Actually fix Android build 2023-06-06 16:20:06 +02:00
sfan5
2c6efbdf06 Remove native_app_glue linkage
We don't provide android_main(), Minetest does. This also didn't even work correctly.
2023-06-04 19:56:30 +02:00
JosiahWI
510976f130
Prefer GLVND at CMake>=3.11
CMake 3.10 introduced GLVND support. CMake 3.11 introduced CMP0072,
which prefers GLVND when NEW behavior is set. I set default policies to
3.11 for CMake versions >=3.11 and did not bother with requesting GLVND
for CMake 3.10.
2023-05-14 20:54:03 +02:00
numzero
b958fdc271 Fix casing for Android device name (MATCHES is case sensitive) 2023-05-11 22:34:08 +02:00
numzero
1387370260 OpenGL3: Sort out texture color format support 2023-04-29 13:07:57 +02:00
Desour
49b6ccde72 SDL: Implement getDisplayDensity() and setWindowIcon() 2023-04-29 13:06:35 +02:00
Desour
acbc90a000 Add the platform-dependent stuff from renderingengine.cpp 2023-04-29 13:06:35 +02:00
Desour
6a2a569233 Add IImage::copyToNoScaling
(Useful for const-correctness.)
2023-04-29 13:06:35 +02:00
numzero
1f15fd0805 OpenGL3: Support min/max blend modes 2023-04-24 21:43:36 +02:00
numzero
81ad195aa3 OpenGL3: New extension listing system 2023-04-23 09:48:04 +02:00
Vitaliy
13680ef42d OpenGL3: Use DrawBuffer[s] from mt_opengl 2023-04-18 23:22:53 +02:00
numzero
44f7c22bbf OpenGL3: Version asserts 2023-04-18 23:22:53 +02:00
numzero
2e477a07d1 OpenGL3: Add version check helper 2023-04-18 23:22:53 +02:00
numzero
78d0819a2c Add missing include 2023-04-18 23:22:53 +02:00
numzero
df07b3bf99 OpenGL3: Remove stencil buffer presence test 2023-04-18 23:22:53 +02:00
numzero
523590e16c OpenGL3: Refuse 3.0 and 3.1 2023-04-18 23:22:53 +02:00
numzero
8cf02ea27f OpenGL3: ExtensionHandler::initExtensionsNew: use GetInteger 2023-04-18 23:22:53 +02:00
numzero
efb660e7ed OpenGL3: drop unused ExtensionHandler functions 2023-04-18 23:22:53 +02:00
numzero
5f88555ed3 OpenGL3: restore MRT support 2023-04-18 23:22:53 +02:00
numzero
4ee1ab261e OpenGL3: Add driver-dependent feature checks 2023-04-18 23:22:53 +02:00
numzero
ab628e641c OpenGL3: Add two missing OpenGL extensions to COGLESCoreExtensionHandler 2023-04-18 23:22:53 +02:00
numzero
1d782702e1 OpenGL3: new version format 2023-04-18 23:22:53 +02:00
rubenwardy
896c825b9e
Fix ComboBox changing on scroll when in a scroll container (#192) 2023-04-14 19:58:13 +01:00
nephele
7a3fc62ada
Haiku: build fix 2023-04-11 20:16:35 +02:00